public frmCategory() { InitializeComponent(); catbal = new CategoryBAL(); cat = new tbl_000_H_CATEGORY(); err = new ErrorProviderExtended(); }
private void AssignRecord(Boolean IsSave) { try { if (IsSave) { cat.CATCODE = mtxtCategoryCode.Text; cat.CATDESC = mtxtCategoryDesc.Text; cat.RATECONVERSION = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtPhp.Text, 0)); cat.FIXEDCHARGELABOR = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtFCLabor.Text, 0)); cat.FIXEDCHARGEFO = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtFCFOverhead.Text, 0)); cat.PRODALLOWANCETIME = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtPTAllowance.Text, 0)); cat.FIXEDRATELOSS = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtFRLMProcess.Text, 0)); cat.FIXEDRATEPROFIT = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtFPRate.Text, 0)); cat.YENRATECONVERSION = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtYen.Text, 0)); cat.FIXEDRATEDEPNMOLD = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtFCDMold.Text, 0)); cat.FIXEDRATEDEPNFILM = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtFCDFilm.Text, 0)); cat.OTHERPROCESSCOST = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtOPCost.Text, 0)); cat.YEARUSED = UserSettings.LogInYear; cat.MoldSetup = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtMoldSetup.Text, 0)); cat.LotSize = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtLotSize.Text, 0)); cat.IsDependent = mcbDependent.Checked; cat.IsActive = mcbActive.Checked; } else { cat = catbal.GetByID(CategoryCode, YearUsed); if (cat != null) { mtxtCategoryCode.Text = cat.CATCODE; mtxtCategoryDesc.Text = cat.CATDESC; mtxtPhp.Text = cat.RATECONVERSION.ToString(); mtxtFCLabor.Text = cat.FIXEDCHARGELABOR.ToString(); mtxtFCFOverhead.Text = cat.FIXEDCHARGEFO.ToString(); mtxtPTAllowance.Text = cat.PRODALLOWANCETIME.ToString(); mtxtFRLMProcess.Text = cat.FIXEDRATELOSS.ToString(); mtxtFPRate.Text = cat.FIXEDRATEPROFIT.ToString(); mtxtYen.Text = cat.YENRATECONVERSION.ToString(); mtxtFCDMold.Text = cat.FIXEDRATEDEPNMOLD.ToString(); mtxtFCDFilm.Text = cat.FIXEDRATEDEPNFILM.ToString(); mtxtOPCost.Text = cat.OTHERPROCESSCOST.ToString(); mtxtMoldSetup.Text = cat.MoldSetup.ToString(); mtxtLotSize.Text = cat.LotSize.ToString(); mcbDependent.Checked = cat.IsDependent; mcbActive.Checked = cat.IsActive; } else { throw new Exception("Record doesn't exist!"); } } } catch (Exception ex) { throw ex; } }
private void mtxtCatCode_TextChanged(object sender, EventArgs e) { string selectedcatcode = BPSUtilitiesV1.NZ(mtxtCatCode.Text, "").ToString(); cat = catbal.GetByID(selectedcatcode, selyear); if (cat != null) { mtxtCatDesc.Text = BPSUtilitiesV1.NZ(cat.CATDESC, "").ToString(); } }
public Boolean Save(tbl_000_H_CATEGORY record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { db.CategoryList.Add(record); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }
public Boolean Update(tbl_000_H_CATEGORY record) { try { if (record == null) { throw new Exception("Invalid Parameter"); } if (!catdal.IsExistID(record.CATCODE, record.YEARUSED)) { throw new Exception("Record does not exist!"); } return(catdal.Update(record)); } catch (Exception ex) { throw ex; } }
public Boolean Save(tbl_000_H_CATEGORY record) { try { if (record == null) { throw new Exception("Invalid Parameter"); } if (catdal.IsExistID(record.CATCODE, record.YEARUSED)) { throw new Exception("Code already taken!"); } return(catdal.Save(record)); } catch (Exception ex) { throw ex; } }
public Boolean Delete(tbl_000_H_CATEGORY record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { var existrecord = GetByID(record.CATCODE, record.YEARUSED); db.CategoryList.Remove(existrecord); 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 void DeleteRecord() { try { FormHelpers.CursorWait(true); var categorycode = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colCATCODE"].Value.ToString(); var cyearused = UserSettings.LogInYear; int yearused = Convert.ToInt32(cyearused); if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes) { var isSuccess = false; var msg = "Deleting"; cat = Categorybal.GetByID(categorycode, yearused); if (Categorybal.Delete(cat)) { isSuccess = true; } if (isSuccess) { MessageHelpers.ShowInfo(msg + " Successful!"); RefreshGrid(); PageManager(1); } else { MessageHelpers.ShowWarning(msg + " Failed!"); } } } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } finally { FormHelpers.CursorWait(false); } }
public void RemoveYear() { try { FormHelpers.CursorWait(true); var recyear = mgridYearList.SelectedRows[0].Cells["colYear"].Value.ToString(); if (MessageHelpers.ShowQuestion("Are you sure you want to remove this year?") == DialogResult.Yes) { var RemovingisSuccess = false; var msg = "Removing"; fxsp = yearbal.CheckFXSPYear(Convert.ToInt32(recyear)); cat = yearbal.CheckCatYear(Convert.ToInt32(recyear)); if (yearbal.Remove(Convert.ToInt32(recyear))) { RemovingisSuccess = true; } if (RemovingisSuccess) { MessageHelpers.ShowInfo(msg + " Successful!"); RefreshGrid(); } else { MessageHelpers.ShowWarning(msg + " Failed!"); } } } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } finally { FormHelpers.CursorWait(false); } }
private void mbtnAdd_Click(object sender, EventArgs e) { //GridRefresh(); try { FormHelpers.CursorWait(true); Int32 selectedRowCount = mgridList.Rows.GetRowCount(DataGridViewElementStates.Selected); for (int i = 0; i < selectedRowCount; i++) { colname = this.mgridList.Columns[2].Name; no = mgridList.SelectedRows[i].Cells[colname].Value.ToString(); if (MyCaller != null) { MyCaller.yearused = yused; } switch (KindOfList) { case "CL": MyCaller.partnoCL = no; MyCaller.LoadGridCL(); break; case "MT_PI": MyCaller.moldno = no; MyCaller.LoadGridPI(); break; case "MT_VP": MyCaller.partnoVP = no; MyCaller.LoadGridVP(); break; case "MT_ASSY": MyCaller.partnoAssy = no; MyCaller.LoadGridAssy(); break; case "MPT": var scode = mgridList.SelectedRows[i].Cells[2].Value.ToString(); MyCaller.sectioncode = scode.ToString(); MyCaller.LoadGridMPT(); break; case "ITEM": var icode = mgridList.SelectedRows[i].Cells[2].Value.ToString(); var item = itembal.GetAll().Where(w => w.YEARUSED == yused && w.ItemNo == icode).FirstOrDefault(); if (MyCaller_Copier != null) { item = itembal.GetAll().Where(w => w.YEARUSED == PreviousYear && w.ItemNo == icode).FirstOrDefault(); MyCaller_Copier.mtxtItemNo.Text = item.ItemNo; } else if (MyCaller_scr != null) { MyCaller_scr.mtxtItemNo.Text = item.ItemNo; MyCaller_scr.mtxtItemDesc.Text = item.Description; } break; case "CAT": var ccode = mgridList.SelectedRows[i].Cells[2].Value.ToString(); cat = catbal.GetByID(ccode, PreviousYear); MyCaller_CopierCat.mtxtCatCode.Text = cat.CATCODE; MyCaller_CopierCat.mtxtCatDesc.Text = cat.CATDESC; break; } } } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } finally { FormHelpers.CursorWait(false); } this.Close(); }
public frm_CopierCat() { InitializeComponent(); catbal = new CategoryBAL(); cat = new tbl_000_H_CATEGORY(); }