private void btnRemoveFromList_Click(object sender, EventArgs e) { if (AddedDiagnosisList == null || AddedDiagnosisList.Count == 0) { XtraMessageBox.Show( "You should select at least one Diagnose to be remove." + "\r\n" + "You can select one or more Diagnose to remove", "Note", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1, DefaultBoolean.Default); return; } foreach (object selectedItem in lstAddedDiagnosis.SelectedItems) { if (selectedItem is Diagnosis_cu) { Diagnosis_cu diagnosis = Diagnosis_cu.ItemsList.Find(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(((Diagnosis_cu)selectedItem).ID))); if (diagnosis != null) { if (AddedDiagnosisList.Exists(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(((Diagnosis_cu)selectedItem).ID)))) { AddedDiagnosisList.Remove(diagnosis); } VisitTiming_Diagnosis visitTimingDiagnosis = PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_Diagnosis.Find(item => Convert.ToInt32(item.Diagnosis_CU_ID).Equals(Convert.ToInt32(diagnosis.ID))); if (visitTimingDiagnosis != null) { visitTimingDiagnosis.PEMRElementStatus = PEMRElementStatus.Removed; } } } } CommonViewsActions.FillListBoxControl(lstAddedDiagnosis, AddedDiagnosisList, "DiagnosisFullName"); lstAddedDiagnosis.Refresh(); SetDiagnosisCount(AddedDiagnosisList); lstDiagnosis.SelectedIndex = -1; lstDoctorDiagnosis.SelectedIndex = -1; lstAddedDiagnosis.SelectedIndex = -1; }
private void btnAddList_Click(object sender, System.EventArgs e) { if (TempDiagnosisListToBeAdded == null || TempDiagnosisListToBeAdded.Count == 0) { XtraMessageBox.Show( "You should select at least one Diagnose to be added." + "\r\n" + "You can select one or more Diagnose to add", "Note", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } switch (ApplicationStaticConfiguration.Organization) { case DB_Organization.Ophthalmology: if (EyeType == null) { XtraMessageBox.Show("You should select Eye Type before adding Diagnosis", "Note", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } break; } if (AddedDiagnosisList == null) { AddedDiagnosisList = new List <Diagnosis_cu>(); } if (TempDiagnosisListToBeAdded != null && TempDiagnosisListToBeAdded.Count > 0) { foreach (Diagnosis_cu diagnosisCu in TempDiagnosisListToBeAdded) { if (!AddedDiagnosisList.Exists(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(diagnosisCu.ID)))) { AddedDiagnosisList.Add(diagnosisCu); if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainDiagnosis == null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainDiagnosis = new List <VisitTiming_MainDiagnosis>(); _mainVisitDiagnosis = PEMRBusinessLogic.CreateNew_VisitTiming_MainDiagnosis(FurtherDetails, DiagnosisType, ApplicationStaticConfiguration.PEMRSavingMode); PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainDiagnosis.Add(_mainVisitDiagnosis); } if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainDiagnosis[0] != null) { if (!string.IsNullOrEmpty(txtReccommednations.Text) || !string.IsNullOrWhiteSpace(txtReccommednations.Text)) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainDiagnosis[0].GeneralDescription = txtReccommednations.Text; } else { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainDiagnosis[0] .GeneralDescription = null; } } if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_Diagnosis == null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_Diagnosis = new List <VisitTiming_Diagnosis>(); } _visitDiagnosis = PEMRBusinessLogic.CreateNew_VisitTiming_Diagnosis( PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainDiagnosis[0], diagnosisCu, EyeType, ApplicationStaticConfiguration.PEMRSavingMode); if (_visitDiagnosis != null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_Diagnosis.Add(_visitDiagnosis); } } } } TempDiagnosisListToBeAdded = null; CommonViewsActions.FillListBoxControl(lstAddedDiagnosis, AddedDiagnosisList, "DiagnosisFullName"); lstAddedDiagnosis.Refresh(); SetDiagnosisCount(AddedDiagnosisList); lstDiagnosis.SelectedIndex = -1; lstDoctorDiagnosis.SelectedIndex = -1; }