private void btnRemoveFromList_OD_Click(object sender, EventArgs e) { if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign == null || PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign.Count == 0) { return; } if (AddedPosteriorSegmentSign_OD == null || AddedPosteriorSegmentSign_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 lstAddedPosteriorSegment_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 (AddedPosteriorSegmentSign_OD.Exists(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(((SegmentSign_cu)selectedItem).ID)))) { AddedPosteriorSegmentSign_OD.Remove(segment); } VisitTiming_PosteriorSegmentSign visitTimingPosteriorSegment = PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign.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 (visitTimingPosteriorSegment != null) { visitTimingPosteriorSegment.PEMRElementStatus = PEMRElementStatus.Removed; } PEMRBusinessLogic.Remove_VisitTiming_PosteriorSegmentSign(visitTimingPosteriorSegment); } } } TempPosteriorSegmentSignListToBeAdded_OD = null; CommonViewsActions.FillListBoxControl(lstAddedPosteriorSegment_OD, AddedPosteriorSegmentSign_OD); lstAddedPosteriorSegment_OD.Refresh(); SetCount_OD(); SetCount_OS(); lstPosteriorSegment_OD.SelectedIndex = -1; }
private void btnAddList_OD_Click(object sender, EventArgs e) { if (TempPosteriorSegmentSignListToBeAdded_OD == null || TempPosteriorSegmentSignListToBeAdded_OD.Count == 0) { XtraMessageBox.Show( "You should select at least one Posterior Segment Sign to be added." + "\r\n" + "You can select one or more Posterior Segment Sign to add", "Note", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (AddedPosteriorSegmentSign_OD == null) { AddedPosteriorSegmentSign_OD = new List <SegmentSign_cu>(); } if (TempPosteriorSegmentSignListToBeAdded_OD != null && TempPosteriorSegmentSignListToBeAdded_OD.Count > 0) { foreach (SegmentSign_cu segmentSign in TempPosteriorSegmentSignListToBeAdded_OD) { if (!AddedPosteriorSegmentSign_OD.Exists(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(segmentSign.ID)))) { AddedPosteriorSegmentSign_OD.Add(segmentSign); if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign == null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign = new List <VisitTiming_MainPosteriorSegmentSign>(); _mainPosteriorSegmentSign = PEMRBusinessLogic.CreateNew_VisitTiming_MainPosteriorSegmentSign( FurtherDetails_OD, FurtherDetails_OS, ApplicationStaticConfiguration.PEMRSavingMode); PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign.Add( _mainPosteriorSegmentSign); } if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0] != null) { if (!string.IsNullOrEmpty(txtReccommednations_OD.Text) || !string.IsNullOrWhiteSpace(txtReccommednations_OD.Text)) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0].GeneralDescription_OD = txtReccommednations_OD.Text; } else { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0] .GeneralDescription_OD = null; } } if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign == null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign = new List <VisitTiming_PosteriorSegmentSign>(); } _visitTimingPosteriorSegment = PEMRBusinessLogic.CreateNew_VisitTiming_PosteriorSegmentSign( PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0], segmentSign, DB_EyeType_p.OD, DB_PEMRSavingMode.SaveImmediately); if (_visitTimingPosteriorSegment != null) { PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign.Add( _visitTimingPosteriorSegment); } } } } TempPosteriorSegmentSignListToBeAdded_OD = null; CommonViewsActions.FillListBoxControl(lstAddedPosteriorSegment_OD, AddedPosteriorSegmentSign_OD); lstAddedPosteriorSegment_OD.Refresh(); SetCount_OD(); SetCount_OS(); lstPosteriorSegment_OD.SelectedIndex = -1; }