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);
        }
 public override void ClearControls()
 {
     lst_DiagnosisCategory_Diagnosis.DataSource = null;
     lkeMedication.EditValue      = null;
     List_SelectedDosesToBedAdded = null;
     SelectedDoseFromGrid         = null;
     List_Medication_Dose         = null;
 }
        private void lkeMedications_EditValueChanged(object sender, EventArgs e)
        {
            if (lkeMedications.EditValue == null)
            {
                CommonViewsActions.FillGridlookupEdit(lkeDoses, Dose_cu.ItemsList);
                return;
            }

            if (chkAllDoses.Checked)
            {
                CommonViewsActions.FillGridlookupEdit(lkeDoses, Dose_cu.ItemsList);
                return;
            }

            List <Medication_Dose_cu> bridgeList = Medication_Dose_cu.ItemsList.FindAll(item =>
                                                                                        Convert.ToInt32(item.Medication_CU_ID).Equals(Convert.ToInt32(lkeMedications.EditValue)));

            if (bridgeList.Count == 0)
            {
                CommonViewsActions.FillGridlookupEdit(lkeDoses, Dose_cu.ItemsList);
                return;
            }

            List <Dose_cu> dosesList = new List <Dose_cu>();

            foreach (Medication_Dose_cu bridge in bridgeList)
            {
                Dose_cu dose = Dose_cu.ItemsList.Find(item =>
                                                      Convert.ToInt32(item.ID).Equals(Convert.ToInt32(bridge.Dose_CU_ID)));
                if (dose == null)
                {
                    continue;
                }
                dosesList.Add(dose);
            }

            CommonViewsActions.FillGridlookupEdit(lkeDoses, dosesList);
        }
 private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     SelectedDoseFromGrid = CommonViewsActions.GetSelectedRowObject <Dose_cu>(gridView1);
 }