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 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); } }
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(); }