Exemplo n.º 1
0
        private void btnAddToList_Click(object sender, EventArgs e)
        {
            if (lkeServices.EditValue == null)
            {
                XtraMessageBox.Show("You select Investigation before adding", "Notice",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                    DefaultBoolean.Default);
                return;
            }

            if (PEMRBusinessLogic.ActivePEMRObject == null)
            {
                return;
            }

            VisitTiming_InvestigationReservation investigationReservation =
                PEMRBusinessLogic.CreateNew_VisitTiming_InvestigationReservation(lkeServices.EditValue,
                                                                                 dtRequestedDate.EditValue, txtDescription.EditValue,
                                                                                 ApplicationStaticConfiguration.PEMRSavingMode);

            if (investigationReservation != null)
            {
                if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_InvestigationReservation == null)
                {
                    PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_InvestigationReservation =
                        new List <VisitTiming_InvestigationReservation>();
                }
                PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_InvestigationReservation.Add(
                    investigationReservation);
            }
            grdTreatmentPlans.DataSource = PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_InvestigationReservation.FindAll(
                item => !Convert.ToInt32(item.PEMRElementStatus).Equals(Convert.ToInt32(PEMRElementStatus.Removed)));
            grdTreatmentPlans.RefreshDataSource();
            ClearControls(false);
        }