convert silverlit code to javascript foreach (CListItem oCListItem in…
- User
convert silverlit code to javascript foreach (CListItem oCListItem in oOverrideBarcodeScanVM.OverrideScan) { if (string.Equals(sReasonCode, oCListItem.Value)) { if (oCListItem.ConceptProperties != null && oCListItem.ConceptProperties.Any()) { if (isPatWBOverride) { return oCListItem.ConceptProperties.Where(y => (y.Name.Equals("PAT_WRSTOTHER") && y.Value.Equals("PAT_WRST_OTHER"))).Any(); } else if (isMedicationOverride) { return oCListItem.ConceptProperties.Where(y => (y.Name.Equals("MEDS_BARCODEOVERIDE") && y.Value.Equals("MEDS_BARCODEOVERIDE"))).Any(); } return false; } else { return false; } } }
- Assistant
Here's the JavaScript equivalent of the given C# code:
for (let oCListItem of oOverrideBarcodeScanVM.OverrideScan) { if (sReasonCode === oCListItem.Value) { if (oCListItem.ConceptProperties != null && oCListItem.ConceptProperties.length > 0) { if (isPatWBOverride) { return oCListItem.ConceptProperties.some(y => y.Name === "PAT_WRSTOTHER" && y.Value === "PAT_WRST_OTHER"); } else if (isMedicationOverride) { return oCListItem.ConceptProperties.some(y => y.Name === "MEDS_BARCODEOVERIDE" && y.Value === "MEDS_BARCODEOVERIDE"); } return false; } else { return false; } } }
- User
in typescript
- Assistant
Here's the TypeScript equivalent of the given C# code:
for (let oCListItem of oOverrideBarcodeScanVM.OverrideScan) { if (sReasonCode === oCListItem.Value) { if (oCListItem.ConceptProperties != null && oCListItem.ConceptProperties.length > 0) { if (isPatWBOverride) { return oCListItem.ConceptProperties.some(y => y.Name === "PAT_WRSTOTHER" && y.Value === "PAT_WRST_OTHER"); } else if (isMedicationOverride) { return oCListItem.ConceptProperties.some(y => y.Name === "MEDS_BARCODEOVERIDE" && y.Value === "MEDS_BARCODEOVERIDE"); } return false; } else { return false; } } }