private void OldCIReferenceChanged() { if (!_oldCIReferenceSelectedRow.IsNotNullOrEmpty()) { return; } DataTable dt = bll.GetCIReferenceNumber(new DDCI_INFO() { IDPK = -99999 }).ToDataTable <V_CI_REFERENCE_NUMBER>().Clone(); dt.ImportRow(_oldCIReferenceSelectedRow.Row); List <V_CI_REFERENCE_NUMBER> lstEntity = (from row in dt.AsEnumerable() select new V_CI_REFERENCE_NUMBER() { CI_REFERENCE = row.Field <string>("CI_REFERENCE"), FRCS_DATE = row.Field <string>("FRCS_DATE"), CUST_DWG_NO = row.Field <string>("CUST_DWG_NO"), CUST_CODE = row.Field <string>("CUST_CODE").ToDecimalValue(), FINISH_CODE = row.Field <string>("FINISH_CODE"), CUST_DWG_NO_ISSUE = row.Field <string>("CUST_DWG_NO_ISSUE"), CUST_STD_DATE = row.Field <string>("CUST_STD_DATE"), IDPK = row.Field <string>("IDPK").ToIntValue(), }).ToList <V_CI_REFERENCE_NUMBER>(); if (lstEntity.IsNotNullOrEmpty() && lstEntity.Count > 0) { V_CI_REFERENCE_NUMBER currentEntity = lstEntity[0]; List <DDCI_INFO> lstActiveEntity = bll.GetEntitiesByPrimaryKey(new DDCI_INFO() { IDPK = currentEntity.IDPK }); if (lstActiveEntity.IsNotNullOrEmpty() && lstActiveEntity.Count > 0) { OldActiveEntity = lstActiveEntity[0].DeepCopy <DDCI_INFO>(); OldActiveEntity.ZONE_CODE = null; CIReferenceZoneDataSource.RowFilter = "CODE in('" + lstActiveEntity[0].ZONE_CODE.ToValueAsString() + "','" + (lstActiveEntity[0].CI_REFERENCE.IsNotNullOrEmpty() ? lstActiveEntity[0].CI_REFERENCE.ToValueAsString().Substring(0, 1) : "") + "')"; if (CIReferenceZoneDataSource.Count > 0) { OldActiveEntity.ZONE_CODE = CIReferenceZoneDataSource[0].Row["CODE"].ToValueAsString(); } CIReferenceZoneDataSource.RowFilter = null; } } }
private void CopyData() { try { bool blnok = false; string varOldCIref = ""; FeasibleReportAndCostSheet frcs; Window win = new Window(); DDCI_INFO activeEntity = new DDCI_INFO(); DDCI_INFO getEntity = new DDCI_INFO(); List <DDCI_INFO> lstEntity = new List <DDCI_INFO>(); if (SelectedCostSheet == null) { Message = "CI Reference should be Selected"; return; } getEntity.IDPK = SelectedCostSheet["CI_INFO_PK"].ToValueAsString().ToIntValue(); frcs = new FeasibleReportAndCostSheet(_userInformation); lstEntity = frcs.GetEntitiesByPrimaryKey(getEntity); if (lstEntity.Count == 0) { return; } activeEntity = lstEntity[0]; frmCopyCIReference userControl = new frmCopyCIReference(_userInformation, win, activeEntity.DeepCopy <DDCI_INFO>(), OperationMode.AddNew); win.Title = "Copy Data"; win.Content = userControl; win.Height = userControl.Height + 50; win.Width = userControl.Width + 10; win.ShowInTaskbar = true; win.WindowStartupLocation = WindowStartupLocation.CenterScreen; win.WindowState = WindowState.Normal; win.ResizeMode = ResizeMode.NoResize; win.ShowDialog(); if (userControl.Vm.Reload == true) { SearchCostSheet(); SelectedCostSheet = dvCostSheetSearch[0]; NotifyPropertyChanged("SelectedCostSheet"); } //CIReferenceDataSource = bll.GetCIReferenceNumber().ToDataTable<V_CI_REFERENCE_NUMBER>().DefaultView; } catch (Exception ex) { throw ex.LogException(); } }