private void btnAddToList_Click(object sender, EventArgs e) { if (lkeServices.EditValue == null) { XtraMessageBox.Show("You select Surgery before adding", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, DefaultBoolean.Default); return; } if (PEMRBusinessLogic.ActivePEMRObject == null) { return; } if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_SurgeryReservation == null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_SurgeryReservation = new List <VisitTiming_SurgeryReservation>(); } VisitTiming_SurgeryReservation surgeryReservation = PEMRBusinessLogic.CreateNew_VisitTiming_SurgeryReservation(lkeServices.EditValue, dtRequestedDate.EditValue, txtDescription.EditValue, ApplicationStaticConfiguration.PEMRSavingMode); if (surgeryReservation != null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_SurgeryReservation.Add(surgeryReservation); } grdTreatmentPlans.DataSource = PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_SurgeryReservation.FindAll( item => !Convert.ToInt32(item.PEMRElementStatus) .Equals(Convert.ToInt32(PEMRElementStatus.Removed))); grdTreatmentPlans.RefreshDataSource(); ClearControls(false); }