// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP2 - SUMMARY // // //////////////////////////////////////////////////////////////////////// // STEP2 - SUMMARY - METHODS // private void StepSummaryIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Summary"; // Initialize summary FlResinsAdd flResinsAddForSummary = new FlResinsAdd(flResinsAddTDS); tbxSummary.Text = flResinsAddForSummary.GetSummary(); }
// //////////////////////////////////////////////////////////////////////// // STEP1 - BEGIN - METHODS // private void StepBeginIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Please provide resins information. Resin numbers 1 - 3 are pre-set"; // Load FlResinsAdd model = new FlResinsAdd(flResinsAddTDS); model.LoadAll(Int32.Parse(hdfCompanyId.Value)); // Store tables Session["flResinsAdd"] = flResinsAddTDS.FlResinsAdd; Session["flResinsAddTDS"] = flResinsAddTDS; }
private void Save() { // save to database DB.Open(); DB.BeginTransaction(); try { FlResinsAdd model = new FlResinsAdd(flResinsAddTDS); model.Save(Int32.Parse(hdfCompanyId.Value)); DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void GrdResinsAdd() { if (ValidateResinsFooter()) { Page.Validate("dataFooter"); if (Page.IsValid) { string resinMake = ((TextBox)grdResins.FooterRow.FindControl("tbxResinMakeFooter")).Text.Trim(); string resinType = ((TextBox)grdResins.FooterRow.FindControl("tbxResinTypeFooter")).Text.Trim(); string resinNumber = ((TextBox)grdResins.FooterRow.FindControl("tbxResinNumberFooter")).Text.Trim(); string applyCatalystTo = ((DropDownList)grdResins.FooterRow.FindControl("ddlApplyCatalystToFooter")).SelectedValue; decimal lbUsg = -1; if (((TextBox)grdResins.FooterRow.FindControl("tbxLbUsgFooter")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.FooterRow.FindControl("tbxLbUsgFooter")).Text.Trim()))) { lbUsg = decimal.Round(decimal.Parse(((TextBox)grdResins.FooterRow.FindControl("tbxLbUsgFooter")).Text.Trim()),3); } } int lbDrums = -1; if (((TextBox)grdResins.FooterRow.FindControl("tbxLbDrumsFooter")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.FooterRow.FindControl("tbxLbDrumsFooter")).Text.Trim()))) { lbDrums = Int32.Parse(((TextBox)grdResins.FooterRow.FindControl("tbxLbDrumsFooter")).Text.Trim()); } } decimal activeResin = -1; if (((TextBox)grdResins.FooterRow.FindControl("tbxActiveResinFooter")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.FooterRow.FindControl("tbxActiveResinFooter")).Text.Trim()))) { activeResin = decimal.Round(decimal.Parse(((TextBox)grdResins.FooterRow.FindControl("tbxActiveResinFooter")).Text.Trim()),1); } } decimal filter = -1; if (((TextBox)grdResins.FooterRow.FindControl("tbxFilterFooter")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.FooterRow.FindControl("tbxFilterFooter")).Text.Trim()))) { filter = decimal.Round(decimal.Parse(((TextBox)grdResins.FooterRow.FindControl("tbxFilterFooter")).Text.Trim()),1); } } int companyId = Int32.Parse(hdfCompanyId.Value); bool inDatabase = false; bool deleted = false; FlResinsAdd model = new FlResinsAdd(flResinsAddTDS); model.Insert(resinMake, resinType, resinNumber, lbUsg, lbDrums, activeResin, applyCatalystTo, filter, deleted, companyId, inDatabase); Session.Remove("flResinsAddDummy"); Session["flResinsAddTDS"] = flResinsAddTDS; Session["flResinsAdd"] = flResinsAddTDS.FlResinsAdd; grdResins.DataBind(); grdResins.PageIndex = grdResins.PageCount - 1; } } }
protected void grdResins_RowUpdating(object sender, GridViewUpdateEventArgs e) { Page.Validate("dataEdit"); if (Page.IsValid) { int resinId = (int)e.Keys["ResinID"]; int companyId = Int32.Parse(hdfCompanyId.Value); string resinMake = ((TextBox)grdResins.Rows[e.RowIndex].Cells[1].FindControl("tbxResinMakeEdit")).Text.Trim(); string resinType = ((TextBox)grdResins.Rows[e.RowIndex].Cells[2].FindControl("tbxResinTypeEdit")).Text.Trim(); string resinNumber = ((TextBox)grdResins.Rows[e.RowIndex].Cells[3].FindControl("tbxResinNumberEdit")).Text.Trim(); string applyCatalystTo = ((DropDownList)grdResins.Rows[e.RowIndex].Cells[7].FindControl("ddlApplyCatalystToEdit")).SelectedValue; decimal lbUsg = -1; if (((TextBox)grdResins.Rows[e.RowIndex].Cells[4].FindControl("tbxLbUsgEdit")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.Rows[e.RowIndex].Cells[4].FindControl("tbxLbUsgEdit")).Text.Trim()))) { lbUsg = decimal.Round(decimal.Parse(((TextBox)grdResins.Rows[e.RowIndex].Cells[4].FindControl("tbxLbUsgEdit")).Text.Trim()), 3); } } int lbDrums = -1; if (((TextBox)grdResins.Rows[e.RowIndex].Cells[4].FindControl("tbxLbDrumsEdit")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.Rows[e.RowIndex].Cells[5].FindControl("tbxLbDrumsEdit")).Text.Trim()))) { lbDrums = Int32.Parse(((TextBox)grdResins.Rows[e.RowIndex].Cells[5].FindControl("tbxLbDrumsEdit")).Text.Trim()); } } decimal activeResin = -1; if (((TextBox)grdResins.Rows[e.RowIndex].Cells[4].FindControl("tbxActiveResinEdit")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.Rows[e.RowIndex].Cells[6].FindControl("tbxActiveResinEdit")).Text.Trim()))) { activeResin = decimal.Round(decimal.Parse(((TextBox)grdResins.Rows[e.RowIndex].Cells[6].FindControl("tbxActiveResinEdit")).Text.Trim()), 1); } } decimal filter = -1; if (((TextBox)grdResins.Rows[e.RowIndex].Cells[4].FindControl("tbxFilterEdit")).Text.Trim() != "") { if ((Validator.IsValidDecimal(((TextBox)grdResins.Rows[e.RowIndex].Cells[8].FindControl("tbxFilterEdit")).Text.Trim()))) { filter = decimal.Round(decimal.Parse(((TextBox)grdResins.Rows[e.RowIndex].Cells[8].FindControl("tbxFilterEdit")).Text.Trim()), 1); } } FlResinsAdd model = new FlResinsAdd(flResinsAddTDS); model.Update(resinId, resinMake, resinType, resinNumber, lbUsg, lbDrums, activeResin, applyCatalystTo, filter); // Store dataset Session["flResinsAddTDS"] = flResinsAddTDS; Session["flatSectionJlCommentDetails"] = flResinsAddTDS.FlResinsAdd; } else { e.Cancel = true; } }
protected void grdResins_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Resins Gridview, if the gridview is edition mode if (grdResins.EditIndex >= 0) { grdResins.UpdateRow(grdResins.EditIndex, true); } //Delete resins int resinId = (int)e.Keys["ResinID"]; int companyId = Int32.Parse(hdfCompanyId.Value); // Delete resins FlResinsAdd model = new FlResinsAdd(flResinsAddTDS); model.Delete(resinId, companyId); // Store dataset Session["flResinsAddTDS"] = flResinsAddTDS; grdResins.DataBind(); }