public frmMT_PI() { InitializeComponent(); pibal = new PlasticInjectionBAL(); pi = new tbl_000_H_PI(); err = new ErrorProviderExtended(); }
private void Delete() { try { FormHelpers.CursorWait(true); var msg = "Deleting"; if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes) { var yearused = UserSettings.LogInYear; var moldno = mgridListPI.Rows[mgridListPI.SelectedCells[0].RowIndex].Cells["colMoldNo"].Value.ToString(); pi = pibal.GetByID(Convert.ToInt32(yearused), moldno.ToString());; if (pibal.Delete(pi)) { MessageHelpers.ShowInfo(msg + " Successful!"); RefreshGrid(); PageManager(1); } else { MessageHelpers.ShowWarning(msg + " Failed!"); } } } catch (Exception ex) { throw ex; } finally { FormHelpers.CursorWait(false); } }
public Boolean DeleteAll(tbl_000_H_PI record) { try { return(pidal.DeleteAll(record)); } catch (Exception ex) { throw ex; } }
public Boolean DeleteAll(tbl_000_H_PI record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { db.PlasticInjectionList.Remove(record); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }
public Boolean Delete(tbl_000_H_PI record) { try { if (record == null) { throw new Exception("Invalid Parameter!"); } if (!pidal.IsExistID(record.YEARUSED, record.MoldNo)) { throw new Exception("Record does not exist!"); } return(pidal.Delete(record)); } catch (Exception ex) { throw ex; } }
public Boolean Update(tbl_000_H_PI record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { var existrecord = GetByID(record.YEARUSED, record.MoldNo); db.Entry(existrecord).CurrentValues.SetValues(record); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }
public frm_DynamicList() { InitializeComponent(); combal = new ComponentBAL(); com = new tbl_000_H_PART(); pibal = new PlasticInjectionBAL(); pi = new tbl_000_H_PI(); vpbal = new VacuumPlatingBAL(); vp = new tbl_000_H_VP(); assybal = new AssymblyBAL(); assy = new tbl_000_H_ASSY(); mrbal = new MODRCBAL(); modrc = new tbl_000_MODRC(); itembal = new ItemBAL(); item = new tbl_000_H_ITEM(); catbal = new CategoryBAL(); cat = new tbl_000_H_CATEGORY(); comlist = new List <tbl_000_H_PART>(); }
public Boolean Save(tbl_000_H_PI record) { try { if (record == null) { throw new Exception("Invalid Paramter!"); } if (pidal.IsExistID(record.YEARUSED, record.MoldNo)) { throw new Exception("No. already taken!"); } if (pidal.IsExistName(record.YEARUSED, record.MoldName)) { throw new Exception("Name already taken!"); } return(pidal.Save(record)); } catch (Exception ex) { throw ex; } }
private void AssignRecord(Boolean IsSave) { try { if (IsSave) { tbl_000_H_PI existpi = new tbl_000_H_PI(); existpi = pibal.GetAll().Where(w => w.YEARUSED == UserSettings.LogInYear && w.MoldNo == mtxtMoldNo.Text).FirstOrDefault(); if (existpi == null) { pi.YEARUSED = UserSettings.LogInYear; pi.CreatedDate = DateTime.Now; pi.CreatedBy = UserSettings.Username; pi.IsCopied = false; pi.CopyDate = DateTime.Now; pi.IsImported = false; pi.ImportDate = DateTime.Now; pi.ImportBy = UserSettings.Username; } pi.MoldNo = mtxtMoldNo.Text; pi.MoldName = mtxtMoldName.Text; pi.Oz = mtxtOz.Text; pi.Cavity = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtCavity.Text, 0)); pi.SPH = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtSPH.Text, 0)); pi.PPH = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtPPH.Text, 0)); pi.Cavity = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtCavity.Text, 0)); pi.MolSetUpTime = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtMoldSetupTime.Text, 0)); pi.Usage = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtUsage.Text, 0)); pi.PurgePerG = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtPPG.Text, 0)); pi.IsLocked = mcbLocked.Checked; pi.UpdatedDate = DateTime.Now; pi.UpdatedBy = UserSettings.Username; } else { pi = pibal.GetByID(yearused, moldno); if (pi != null) { mtxtMoldNo.Text = pi.MoldNo; mtxtMoldName.Text = pi.MoldName; mtxtOz.Text = pi.Oz; mtxtPPG.Text = pi.PurgePerG.ToString(); mtxtSPH.Text = Convert.ToInt32(pi.SPH).ToString(); mtxtCavity.Text = Convert.ToInt32(pi.Cavity).ToString(); mtxtPPH.Text = Convert.ToInt32(pi.PPH).ToString(); mtxtMoldSetupTime.Text = pi.MolSetUpTime.ToString(); mtxtUsage.Text = Convert.ToInt32(pi.Usage).ToString(); mcbLocked.Checked = pi.IsLocked; pi.UpdatedDate = DateTime.Now; pi.UpdatedBy = UserSettings.Username; } else { throw new Exception("Record doesn't exist!"); } } } catch (Exception ex) { throw ex; } }