private void SetFlags() { VaccineObsType vaccineObsType = (VaccineObsType)listValueType.SelectedIndex; if (vaccineObsType == VaccineObsType.Coded) { listCodeSystem.Enabled = true; } else { listCodeSystem.Enabled = false; } if (vaccineObsType == VaccineObsType.Numeric) { comboUnits.Enabled = true; } else { comboUnits.Enabled = false; } VaccineObsIdentifier vaccineObsIdentifier = (VaccineObsIdentifier)comboObservationQuestion.SelectedIndex; if (vaccineObsIdentifier == VaccineObsIdentifier.FundPgmEligCat) { textMethodCode.ReadOnly = false; } else { textMethodCode.ReadOnly = true; } }
private void FormVaccineObsEdit_Load(object sender, EventArgs e) { comboObservationQuestion.Items.Clear(); string[] arrayQuestionNames = Enum.GetNames(typeof(VaccineObsIdentifier)); for (int i = 0; i < arrayQuestionNames.Length; i++) { comboObservationQuestion.Items.Add(arrayQuestionNames[i]); VaccineObsIdentifier vaccineObsIdentifier = (VaccineObsIdentifier)i; if (_vaccineObsCur.IdentifyingCode == vaccineObsIdentifier) { comboObservationQuestion.SelectedIndex = i; } } listValueType.Items.Clear(); string[] arrayValueTypeNames = Enum.GetNames(typeof(VaccineObsType)); for (int i = 0; i < arrayValueTypeNames.Length; i++) { listValueType.Items.Add(arrayValueTypeNames[i]); VaccineObsType vaccineObsType = (VaccineObsType)i; if (_vaccineObsCur.ValType == vaccineObsType) { listValueType.SelectedIndex = i; } } listCodeSystem.Items.Clear(); string[] arrayCodeSystems = Enum.GetNames(typeof(VaccineObsValCodeSystem)); for (int i = 0; i < arrayCodeSystems.Length; i++) { listCodeSystem.Items.Add(arrayCodeSystems[i].ToString()); VaccineObsValCodeSystem valCodeSystem = (VaccineObsValCodeSystem)i; if (_vaccineObsCur.ValCodeSystem == valCodeSystem) { listCodeSystem.SelectedIndex = i; } } textValue.Text = _vaccineObsCur.ValReported; comboUnits.Items.Clear(); comboUnits.Items.Add("none"); comboUnits.SelectedIndex = 0; List <string> listUcumCodes = Ucums.GetAllCodes(); for (int i = 0; i < listUcumCodes.Count; i++) { string ucumCode = listUcumCodes[i]; comboUnits.Items.Add(ucumCode); if (ucumCode == _vaccineObsCur.UcumCode) { comboUnits.SelectedIndex = i + 1; } } if (_vaccineObsCur.DateObs.Year > 1880) { textDateObserved.Text = _vaccineObsCur.DateObs.ToShortDateString(); } textMethodCode.Text = _vaccineObsCur.MethodCode; SetFlags(); }