Пример #1
0
        private void btnAddList_OS_Click(object sender, EventArgs e)
        {
            if (TempAdnexaSegmentSignListToBeAdded_OS == null || TempAdnexaSegmentSignListToBeAdded_OS.Count == 0)
            {
                XtraMessageBox.Show(
                    "You should select at least one Adnexa Segment Sign to be added." + "\r\n" +
                    "You can select one or more Adnexa Segment Sign to add", "Note", MessageBoxButtons.OK,
                    MessageBoxIcon.Hand);
                return;
            }

            if (AddedAdnexaSegmentSign_OS == null)
            {
                AddedAdnexaSegmentSign_OS = new List <SegmentSign_cu>();
            }
            if (TempAdnexaSegmentSignListToBeAdded_OS != null && TempAdnexaSegmentSignListToBeAdded_OS.Count > 0)
            {
                foreach (SegmentSign_cu segmentSign in TempAdnexaSegmentSignListToBeAdded_OS)
                {
                    if (!AddedAdnexaSegmentSign_OS.Exists(item =>
                                                          Convert.ToInt32(item.ID).Equals(Convert.ToInt32(segmentSign.ID))))
                    {
                        AddedAdnexaSegmentSign_OS.Add(segmentSign);
                        if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainAdnexaSegmentSign == null)
                        {
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainAdnexaSegmentSign =
                                new List <VisitTiming_MainAdnexaSegmentSign>();
                            _mainAdnexaSegmentSign = PEMRBusinessLogic.CreateNew_VisitTiming_MainAdnexaSegmentSign(
                                FurtherDetails_OD, FurtherDetails_OD,
                                ApplicationStaticConfiguration.PEMRSavingMode);
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainAdnexaSegmentSign.Add(
                                _mainAdnexaSegmentSign);
                        }

                        if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainAdnexaSegmentSign[0] != null)
                        {
                            if (!string.IsNullOrEmpty(txtReccommednations_OD.Text) ||
                                !string.IsNullOrWhiteSpace(txtReccommednations_OD.Text))
                            {
                                PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainAdnexaSegmentSign[0].GeneralDescription_OD
                                    = txtReccommednations_OD.Text;
                            }
                            else
                            {
                                PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainAdnexaSegmentSign[0]
                                .GeneralDescription_OD = null;
                            }
                        }

                        if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AdnexaSegmentSign == null)
                        {
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AdnexaSegmentSign =
                                new List <VisitTiming_AdnexaSegmentSign>();
                        }
                        _visitTimingAdnexaSegment = PEMRBusinessLogic.CreateNew_VisitTiming_AdnexaSegmentSign(
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainAdnexaSegmentSign[0], segmentSign,
                            DB_EyeType_p.OS, DB_PEMRSavingMode.SaveImmediately);
                        if (_visitTimingAdnexaSegment != null)
                        {
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AdnexaSegmentSign.Add(
                                _visitTimingAdnexaSegment);
                        }
                    }
                }
            }

            TempAdnexaSegmentSignListToBeAdded_OS = null;
            CommonViewsActions.FillListBoxControl(lstAddedAdnexaSegment_OS, AddedAdnexaSegmentSign_OS);
            lstAddedAdnexaSegment_OS.Refresh();
            SetCount_OS();
            SetCount_OS();
            lstAdnexaSegment_OS.SelectedIndex = -1;
        }