public frmWIPMT1() { InitializeComponent(); mtbal = new WIPMTBAL(); mt = new tbl_100_WIP_MT(); err = new ErrorProviderExtended(); }
private void AssignRecord(Boolean IsSave) { try { if (IsSave) { mt.YEARUSED = UserSettings.LogInYear; mt.PartNo = mtxtPartNo.Text; mt.PartName = mtxtPartName.Text; mt.Usage = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtUsage.Text, 0)); mt.Process = mtxtProcess.Text; mt.Vendor = mtxtVendor.Text; } else { mt = mtbal.GetByID(UserSettings.LogInYear, pno); if (mt != null) { mtxtPartNo.Text = mt.PartNo; mtxtPartName.Text = mt.PartName; mtxtUsage.Text = mt.Usage.ToString(); mtxtProcess.Text = mt.Process; mtxtVendor.Text = mt.Vendor; } else { throw new Exception("Record doesn't exist!"); } } } catch (Exception ex) { throw ex; } }
public Boolean Delete(tbl_100_WIP_MT record) { try { return(mtdal.Delete(record)); } catch (Exception ex) { throw ex; } }
public Boolean Save(tbl_100_WIP_MT record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { db.WIPMTList.Add(record); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }
public Boolean Update(tbl_100_WIP_MT record) { try { if (record == null) { throw new Exception("Invalid Parameter!"); } if (!mtdal.IsExistID(record.YEARUSED, record.PartNo)) { throw new Exception("Record does not exist!"); } return(mtdal.Update(record)); } catch (Exception ex) { throw ex; } }
public Boolean Save(tbl_100_WIP_MT record) { try { if (record == null) { throw new Exception("Invalid Parameter!"); } if (mtdal.IsExistID(record.YEARUSED, record.PartNo)) { throw new Exception("No. already taken!"); } return(mtdal.Save(record)); } catch (Exception ex) { throw ex; } }
public Boolean Update(tbl_100_WIP_MT record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { var existrecord = GetByID(record.YEARUSED, record.PartNo); db.Entry(existrecord).GetDatabaseValues().SetValues(record); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }
public Boolean Delete(tbl_100_WIP_MT record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { var existrecord = GetByID(record.YEARUSED, record.PartNo); db.WIPMTList.Attach(existrecord); db.WIPMTList.Remove(existrecord); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }
private void DeleteRecord() { try { FormHelpers.CursorWait(true); var pno = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colPartNo"].Value.ToString(); if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes) { var isSuccess = false; var msg = "Deleting"; mt = mtbal.GetByID(UserSettings.LogInYear, pno); if (mtbal.Delete(mt)) { isSuccess = true; } if (isSuccess) { MessageHelpers.ShowInfo(msg + " Successful!"); FillComboBoxes(); RefreshGrid(); PageManager(1); } else { MessageHelpers.ShowWarning(msg + " Failed!"); } } } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } finally { FormHelpers.CursorWait(false); } }
public frmWIPMT1List() { InitializeComponent(); mtbal = new WIPMTBAL(); mt = new tbl_100_WIP_MT(); }