Пример #1
0
        private void btnRemoveFromList_OD_Click(object sender, EventArgs e)
        {
            if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AdnexaSegmentSign == null ||
                PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AdnexaSegmentSign.Count == 0)
            {
                return;
            }

            if (AddedAdnexaSegmentSign_OD == null || AddedAdnexaSegmentSign_OD.Count == 0)
            {
                XtraMessageBox.Show(
                    "You should select at least one Segment Sign to be remove." + "\r\n" +
                    "You can select one or more Segment Signs to remove", "Note", MessageBoxButtons.OK, MessageBoxIcon.Hand,
                    MessageBoxDefaultButton.Button1, DefaultBoolean.Default);
                return;
            }

            foreach (object selectedItem in lstAddedAdnexaSegment_OD.SelectedItems)
            {
                if (selectedItem is SegmentSign_cu)
                {
                    SegmentSign_cu segment = SegmentSign_cu.ItemsList.Find(item =>
                                                                           Convert.ToInt32(item.ID).Equals(Convert.ToInt32(((SegmentSign_cu)selectedItem).ID)));
                    if (segment != null)
                    {
                        if (AddedAdnexaSegmentSign_OD.Exists(item =>
                                                             Convert.ToInt32(item.ID).Equals(Convert.ToInt32(((SegmentSign_cu)selectedItem).ID))))
                        {
                            AddedAdnexaSegmentSign_OD.Remove(segment);
                        }
                        VisitTiming_AdnexaSegmentSign visitTimingAdnexaSegment =
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AdnexaSegmentSign.Find(item =>
                                                                                                       Convert.ToInt32(item.SegmentSign_CU_ID).Equals(Convert.ToInt32(segment.ID)) &&
                                                                                                       Convert.ToInt32(item.Eye_P_ID).Equals(Convert.ToInt32(DB_EyeType_p.OD)));
                        if (visitTimingAdnexaSegment != null)
                        {
                            visitTimingAdnexaSegment.PEMRElementStatus = PEMRElementStatus.Removed;
                        }
                        PEMRBusinessLogic.Remove_VisitTiming_AdnexaSegmentSign(visitTimingAdnexaSegment);
                    }
                }
            }

            TempAdnexaSegmentSignListToBeAdded_OD = null;
            CommonViewsActions.FillListBoxControl(lstAddedAdnexaSegment_OD, AddedAdnexaSegmentSign_OD);
            lstAddedAdnexaSegment_OD.Refresh();
            SetCount_OD();
            SetCount_OS();
            lstAdnexaSegment_OD.SelectedIndex = -1;
        }