private void btnRemoveFromList_Click(object sender, EventArgs e) { if (lst_DiagnosisCategory_Diagnosis.SelectedItems.Count == 0 || List_Medication_Dose == null) { XtraMessageBox.Show("لا يـوجــد", "تنبيــــــــــه", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } Dose_cu selectedDose = (Dose_cu)lst_DiagnosisCategory_Diagnosis.SelectedItem; if (selectedDose == null) { return; } if (List_SelectedDosesToBedAdded.Exists( item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(selectedDose.ID)))) { List_SelectedDosesToBedAdded.Remove(selectedDose); } CommonViewsActions.FillListBoxControl(lst_DiagnosisCategory_Diagnosis, List_SelectedDosesToBedAdded, "Name_P"); lst_DiagnosisCategory_Diagnosis.Refresh(); Medication_Dose_cu userBridge = List_Medication_Dose.Find(item => Convert.ToInt32(item.Dose_CU_ID).Equals(Convert.ToInt32(selectedDose.ID))); if (userBridge == null) { return; } List_Medication_Dose.Remove(userBridge); }
private void btnAddList_Click(object sender, System.EventArgs e) { if (lkeMedication.EditValue == null) { XtraMessageBox.Show("يجـب إختيــار الـــدواء / العـــلاج", "تنبيــــــــــه", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (SelectedDoseFromGrid == null) { XtraMessageBox.Show("يجب إختيــار الجـرعــــــة", "تنبيــــــــــه", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (List_SelectedDosesToBedAdded == null) { List_SelectedDosesToBedAdded = new List <Dose_cu>(); } if (List_SelectedDosesToBedAdded.Count > 0) { if (List_SelectedDosesToBedAdded.Exists( item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(SelectedDoseFromGrid.ID)))) { XtraMessageBox.Show("تمــت إضافتـــه مـن قبـــل", "تنبيــــــــــه", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } } List_SelectedDosesToBedAdded.Add(SelectedDoseFromGrid); CommonViewsActions.FillListBoxControl(lst_DiagnosisCategory_Diagnosis, List_SelectedDosesToBedAdded); lst_DiagnosisCategory_Diagnosis.Refresh(); Medication_Dose_cu bridge = new Medication_Dose_cu(); bridge.Dose_CU_ID = SelectedDoseFromGrid.ID; bridge.Medication_CU_ID = Convert.ToInt32(lkeMedication.EditValue); if (List_Medication_Dose == null) { List_Medication_Dose = new List <Medication_Dose_cu>(); } List_Medication_Dose.Add(bridge); }