public void DeleteMainRow() { if (SelectedMainRows != null) { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { foreach (var row in SelectedMainRows) { if (row.Iserial != 0) { if (AllowDelete != true) { MessageBox.Show(strings.AllowDeleteMsg); return; } Glclient.DeleteTblSequenceAsync((TblSequence) new TblSequence().InjectFrom(row), MainRowList.IndexOf(row), LoggedUserInfo.DatabasEname); } else { MainRowList.Remove(row); if (!MainRowList.Any()) { AddNewMainRow(false); } } } } } }
public bool ValidHeaderData() { if (BankRec == null) { MessageBox.Show(strings.ReqBankAccountNo); return(false); } if (MainRowList.Any(r => string.IsNullOrWhiteSpace(r.MachineId))) { MessageBox.Show(strings.ReqMachineId); return(false); } var duplicatedMachineId = MainRowList.GroupBy(r => new { r.MachineId }).FirstOrDefault(x => x.Count() > 1); if (duplicatedMachineId != null) { MessageBox.Show(string.Format("Machine Id cannot be duplicated {0}", duplicatedMachineId.Key.MachineId)); return(false); } if (MainRowList.GroupBy(r => new { r.StoreIserial, r.IsDefault }).Where(r => r.Key.IsDefault).Select(r => r.Count()).Any(r => r > 1)) { MessageBox.Show("Store Can have one Default Machine"); return(false); } return(true); }
public void DeleteMainRow() { if (SelectedMainRows != null) { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { foreach (var row in SelectedMainRows) { if (row.Iserial != 0) { Loading = true; Client.DeleteTblUserCheckListAsync( (TblUserCheckList) new TblUserCheckList().InjectFrom(row), MainRowList.IndexOf(row)); } else { MainRowList.Remove(row); if (!MainRowList.Any()) { AddNewMainRow(false); } } } } } }
public void DeleteMainRow() { if (SelectedMainRows != null) { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { foreach (var row in SelectedMainRows) { if (row.Iserial != 0) { if (AllowDelete != true) { MessageBox.Show(strings.AllowDeleteMsg); return; } Loading = true; Client.DeleteTblStandardBOMHeaderAsync( (TblStandardBomHeader) new TblStandardBomHeader().InjectFrom(row), MainRowList.IndexOf(row)); } else { MainRowList.Remove(row); if (!MainRowList.Any()) { AddNewMainRow(false); } } } } } }
internal void Delete() { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { Loading = true; foreach (var item in SelectedMainRows) { if (item.Iserial == 0) { MainRowList.Remove(item); if (!MainRowList.Any()) { AddNewMainRow(false); } } else { if (AllowDelete != true) { MessageBox.Show(strings.AllowDeleteMsg); return; } Loading = true; Glclient.DeleteGenericAsync(TablEname, item.Iserial.ToString(CultureInfo.InvariantCulture), LoggedUserInfo.DatabasEname); } } } }
public void DeleteMainRow() { if (SelectedMainRows != null) { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { var ListInt = SelectedMainRows.Select(w => w.Iserial).ToList(); var ObsInt = new ObservableCollection <int>(); foreach (var item in ListInt) { ObsInt.Add(item); } if (AllowDelete != true) { MessageBox.Show(strings.AllowDeleteMsg); return; } Glclient.DeleteTblJournalSettingAsync(ObsInt, LoggedUserInfo.DatabasEname); foreach (var row in SelectedMainRows.Where(w => w.Iserial == 0).ToList()) { MainRowList.Remove(row); } if (!MainRowList.Any()) { AddNewMainRow(false); } } } }
public EmpLeavingTransactionViewModel() { if (!DesignerProperties.IsInDesignTool) { GetItemPermissions(PermissionItemName.EmpLeavingTransactionForm.ToString()); GetCustomePermissions(PermissionItemName.EmpLeavingTransactionForm.ToString()); PremCompleted += (s, sv) => AddNewMainRow(false); Client.UpdateOrInsertEmpLeavingTransactionCompleted += (s, x) => { var savedRow = (TblEmpLeavingTransactionViewModel)MainRowList.GetItemAt(x.outindex); if (savedRow != null) { savedRow.InjectFrom(x.Result); } Loading = false; }; Client.SearchBysStoreNameAsync(new ObservableCollection <int>(LoggedUserInfo.AllowedStores), LoggedUserInfo.Iserial, null, null, LoggedUserInfo.DatabasEname); Client.SearchBysStoreNameCompleted += (s, sv) => { foreach (var variable in sv.Result) { Client.GetEmpTablebyStoreAndCompanyAsync(LoggedUserInfo.DatabasEname, variable.code); Store = variable.code; } }; Client.DeleteEmpLeavingTransactionCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } if (!MainRowList.Any()) { AddNewMainRow(false); } }; EmpList = new ObservableCollection <EmployeesView>(); Client.GetEmpTablebyStoreAndCompanyCompleted += (s, sv) => { foreach (var variable in sv.Result) { EmpList.Add(variable); } }; } }
public void DeleteMainRow() { if (SelectedMainRows != null) { foreach (var row in SelectedMainRows) { MainRowList.Remove(row); if (!MainRowList.Any()) { AddNewMainRow(false); } } } }
public EmpWeeklyDayOffViewModel() { if (!DesignerProperties.IsInDesignTool) { WeekList = new List <string>(); GetItemPermissions(PermissionItemName.EmpWeeklyDayOff.ToString()); Client.UpdateOrInsertTblEmpWeeklyDayOffCompleted += (s, x) => { var savedRow = (TblEmpWeeklyDayOffViewModel)MainRowList.GetItemAt(x.outindex); if (savedRow != null) { savedRow.InjectFrom(x.Result); } }; Client.DeleteTblEmpWeeklyDayOffCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } if (!MainRowList.Any()) { AddNewMainRow(false); } }; foreach (var variable in GetDates(2015, 10)) { WeekList.Add(variable.DayOfWeek.ToString()); } GetMaindata(); Client.GetTblEmpWeeklyDayOffCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblEmpWeeklyDayOffViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (MainRowList.Any() && (SelectedMainRow == null || SelectedMainRow.Iserial == 0)) { SelectedMainRow = MainRowList.FirstOrDefault(); } if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } if (Export) { Export = false; //var handler = ExportCompleted; //if (handler != null) handler(this, EventArgs.Empty); //ExportGrid.ExportExcel("Style"); } }; } }
public GenericViewModelCollection(string tablEname, PermissionItemName userJobsForm) { if (DesignerProperties.IsInDesignTool) { return; } TablEname = tablEname; Client = new _Proxy.CRUD_ManagerServiceClient(); GetItemPermissions(userJobsForm.ToString()); Client.GetGenericCompleted += (s, ev) => { Loading = false; GenericMapper.InjectFromObCollection(MainRowList, ev.Result); //FullCount = ev.fullCount; if (MainRowList.Any() && (SelectedMainRow == null || SelectedMainRow.Iserial == 0)) { SelectedMainRow = MainRowList.FirstOrDefault(); } if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } if (Export) { Export = false; ExportGrid.ExportExcel(userJobsForm.ToString()); } }; MainRowList = new SortableCollectionView <GenericViewModel>(); Client.GenericUpdateOrInsertCompleted += (s, ev) => { if (ev.Error != null) { MessageBox.Show(ev.Error.Message); } Loading = false; MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result); }; Client.DeleteGenericCompleted += (s, ev) => { if (ev.Error != null) { MessageBox.Show(ev.Error.Message); } Loading = false; var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } if (!MainRowList.Any()) { AddNewMainRow(false); } }; GetMaindata(); }