public EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable GetCostsSetupNew() { standardCostsSetup = (EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable)Session["standardCostsSetupDummy"]; if (standardCostsSetup == null) { standardCostsSetup = ((EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable)Session["standardCostsSetup"]); } return standardCostsSetup; }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_RESOURCES_EMPLOYEES_ADMIN"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if ((string)Request.QueryString["source_page"] == null) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in employees_costing_setup.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfUpdate.Value = "no"; Session.Remove("standardCostsSetup"); Session.Remove("standardCostsSetupDummy"); // Prepare initial data // ... For Grids standardCostsSetup = new EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable(); // ... Store datasets Session["standardCostsSetup"] = standardCostsSetup; // StepSection1In wizard.ActiveStepIndex = 0; StepBeginIn(); } else { // Restore datasets standardCostsSetup = (EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable)Session["standardCostsSetup"]; } }
private void StepBeginProcessGrid() { if (ExistsDataModified()) { EmployeeStandardCostsSetupTDS dataSet = new EmployeeStandardCostsSetupTDS(); dataSet.StandardCostsSetup.Merge(standardCostsSetup, true); EmployeeStandardCostsSetup model = new EmployeeStandardCostsSetup(dataSet); // update rows foreach (GridViewRow row in grdCostSetup.Rows) { int employeeId = Int32.Parse(grdCostSetup.DataKeys[row.RowIndex].Values["EmployeeID"].ToString()); decimal? newBurdenFactor = null; if (((TextBox)row.FindControl("tbxBourdenFactor")).Text != "") { newBurdenFactor = decimal.Round(decimal.Parse(((TextBox)row.FindControl("tbxBourdenFactor")).Text),1); } decimal? newUSHealthBenefitFactor = null; if (((TextBox)row.FindControl("tbxUSHealthBenefitFactor")).Text != "") { newUSHealthBenefitFactor = decimal.Round(decimal.Parse(((TextBox)row.FindControl("tbxUSHealthBenefitFactor")).Text), 1); } decimal? newBenefitFactorCad = null; if (((TextBox)row.FindControl("tbxBenefitFactorCad")).Text != "") { newBenefitFactorCad = decimal.Round(decimal.Parse(((TextBox)row.FindControl("tbxBenefitFactorCad")).Text), 2); } decimal? newBenefitFactorUsd = null; if (((TextBox)row.FindControl("tbxBenefitFactorUsd")).Text != "") { newBenefitFactorUsd = decimal.Round(decimal.Parse(((TextBox)row.FindControl("tbxBenefitFactorUsd")).Text),2); } model.Update(employeeId, newBurdenFactor, newUSHealthBenefitFactor, newBenefitFactorCad, newBenefitFactorUsd); } standardCostsSetup = (EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable)model.Table; Session["standardCostsSetup"] = standardCostsSetup; hdfUpdate.Value = "yes"; } }
// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP1 - BEGIN // // //////////////////////////////////////////////////////////////////////// // STEP1 - BEGIN - METHODS // private void StepBeginIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Please provide job costing factors for each employee"; // Initiaize data standardCostsSetup = new EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable(); // Load EmployeeStandardCostsSetupTDS dataSet = new EmployeeStandardCostsSetupTDS(); EmployeeStandardCostsSetup model = new EmployeeStandardCostsSetup(dataSet); model.LoadAll(); // Store tables standardCostsSetup = (EmployeeStandardCostsSetupTDS.StandardCostsSetupDataTable)model.Table; Session["standardCostsSetup"] = standardCostsSetup; }