Ejemplo n.º 1
0
        private void btnRemoveFromList_OD_Click(object sender, EventArgs e)
        {
            if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AnteriorSegmentSign == null ||
                PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AnteriorSegmentSign.Count == 0)
            {
                return;
            }
            if (AddedAnteriorSegmentSign_OD == null || AddedAnteriorSegmentSign_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 lstAddedAnteriorSegment_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 (AddedAnteriorSegmentSign_OD.Exists(item =>
                                                               Convert.ToInt32(item.ID).Equals(Convert.ToInt32(((SegmentSign_cu)selectedItem).ID))))
                        {
                            AddedAnteriorSegmentSign_OD.Remove(segment);
                        }
                        VisitTiming_AnteriorSegmentSign visitTimingAnteriorSegment =
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_AnteriorSegmentSign.Find(item =>
                                                                                                         Convert.ToInt32(item.SegmentSignID).Equals(Convert.ToInt32(segment.ID)) &&
                                                                                                         Convert.ToInt32(item.Eye_P_ID).Equals(Convert.ToInt32(DB_EyeType_p.OD)));
                        if (visitTimingAnteriorSegment != null)
                        {
                            visitTimingAnteriorSegment.PEMRElementStatus = PEMRElementStatus.Removed;
                        }
                        PEMRBusinessLogic.Remove_VisitTiming_AnteriorSegmentSign(visitTimingAnteriorSegment);
                    }
                }
            }

            TempAnteriorSegmentSignListToBeAdded_OD = null;
            CommonViewsActions.FillListBoxControl(lstAddedAnteriorSegment_OD, AddedAnteriorSegmentSign_OD);
            lstAddedAnteriorSegment_OD.Refresh();
            SetCount_OD();
            SetCount_OS();
            lstAnteriorSegment_OD.SelectedIndex = -1;
        }