/// //////////////////////////////////////////////////////////////////////// /// STEP2 - SECTION2 - METHODS /// public JlinerAddTDS.MasterAreaDataTable GetSectionsNew() { masterArea = (JlinerAddTDS.MasterAreaDataTable)Session["masterAreaDummy"]; if (masterArea == null) { masterArea = (JlinerAddTDS.MasterAreaDataTable)Session["masterArea"]; } return masterArea; }
protected void AddSectionsNewEmptyFix(GridView grdView) { if (grdView.Rows.Count == 0) { JlinerAddTDS.MasterAreaDataTable dt = new JlinerAddTDS.MasterAreaDataTable(); dt.AddMasterAreaRow(Guid.NewGuid(), -1, "", "", -1, "", "", "", "", "", "", new DateTime(), "", -1, "", new DateTime(), new DateTime(), new DateTime(), new DateTime(), "", false, false, false, false, false, false, -1, -1, new DateTime(), new DateTime(), false, false, false, false, false, false, false, new DateTime(), new DateTime(), new DateTime(), new DateTime(), new DateTime(), false, false, -1, -1, new DateTime(), new DateTime(), "", "", "", "", "", "", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "", "", false, "", false, "", "", -1, false, false, "", "", "", "", false, false, "", "", "", false, false, false, false, false, false, false, false, false, false, false, false, "", false, "", false, "", "", "", false, -1, "", -1, -1, false, "", "", "", -1, -1, false); Session["masterAreaDummy"] = dt; grdView.DataBind(); } // normally executes at all postbacks if (grdView.Rows.Count == 1) { JlinerAddTDS.MasterAreaDataTable dt = (JlinerAddTDS.MasterAreaDataTable)Session["masterAreaDummy"]; if (dt != null) { grdView.Rows[0].Visible = false; grdView.Rows[0].Controls.Clear(); } } }
private int StepSection1Next() { int step = -1; // Search Section int companyId = Int32.Parse(Session["companyID"].ToString()); JlinerAddMasterAreaGateway jlinerAddMasterAreaGateway = new JlinerAddMasterAreaGateway(jlinerAddTDS); if ((tbxRecordIdForSearch.Text.Trim() == "") && (tbxStreetForSearch.Text.Trim() == "")) { jlinerAddMasterAreaGateway.LoadByCompaniesId(companyId, int.Parse((string)ViewState["client"])); if (jlinerAddMasterAreaGateway.Table.Rows.Count > 0) { step = 1; } } else { if (tbxStreetForSearch.Text.Trim() == "") { jlinerAddMasterAreaGateway.LoadByCompaniesIdRecordId(companyId, int.Parse((string)ViewState["client"]), tbxRecordIdForSearch.Text.Trim()); if (jlinerAddMasterAreaGateway.Table.Rows.Count == 1) { step = 2; hdfRecordId.Value = tbxRecordIdForSearch.Text.Trim(); hdfSelectedId.Value = jlinerAddMasterAreaGateway.GetId(hdfRecordId.Value).ToString(); hdfStreet.Value = jlinerAddMasterAreaGateway.GetStreet(hdfRecordId.Value); hdfUsmh.Value = jlinerAddMasterAreaGateway.GetUSMH(hdfRecordId.Value); hdfDsmh.Value = jlinerAddMasterAreaGateway.GetDSMH(hdfRecordId.Value); hdfActualLength.Value = jlinerAddMasterAreaGateway.GetActualLength(hdfRecordId.Value); } else { jlinerAddMasterAreaGateway.LoadByCompaniesIdRecordId(companyId, int.Parse((string)ViewState["client"]), "%" + tbxRecordIdForSearch.Text.Trim() + "%"); if (jlinerAddMasterAreaGateway.Table.Rows.Count > 0) { step = 1; } } } if (step == -1) { jlinerAddMasterAreaGateway.LoadByCompaniesIdRecordIdStreet(companyId, int.Parse((string)ViewState["client"]), "%" + tbxRecordIdForSearch.Text.Trim() + "%", "%" + tbxStreetForSearch.Text.Trim() + "%"); if (jlinerAddMasterAreaGateway.Table.Rows.Count > 0) { step = 1; } } } // Store datasets Session["jlinerAddTDS"] = jlinerAddTDS; masterArea = jlinerAddTDS.MasterArea; Session["masterArea"] = masterArea; // Databind grdSection.DataBind(); // Check next step if (step == -1) { cvSection1.IsValid = false; } return step; }
private void GrdJLinerAdd() { Page.Validate("dataFooter"); if (Page.IsValid) { if (ValidateJlinerFooter()) { Guid id = new Guid(hdfSelectedId.Value); int companyId = Convert.ToInt32(Session["companyID"]); string detailId = ""; if (((TextBox)grdJliner2.FooterRow.FindControl("tbxDetailIdFooter")).Text.Trim() != "") detailId = ((TextBox)grdJliner2.FooterRow.FindControl("tbxDetailIdFooter")).Text.Trim(); string address = ""; if (((TextBox)grdJliner2.FooterRow.FindControl("tbxAddressFooter")).Text.Trim() != "") address = ((TextBox)grdJliner2.FooterRow.FindControl("tbxAddressFooter")).Text.Trim(); double? distanceFromUSMH = null; if (((TextBox)grdJliner2.FooterRow.FindControl("tbxDistanceFromUSMHFooter")).Text.Trim() != "") distanceFromUSMH = double.Parse(((TextBox)grdJliner2.FooterRow.FindControl("tbxDistanceFromUSMHFooter")).Text.Trim()); int buildRebuild = 0; bool inDatabase = false; string issue = "No"; // Calculate fields double? distanceFromDSMH = null; if (distanceFromUSMH.HasValue) { Distance length = new Distance(tbxActualLength.Text.Trim()) - new Distance(distanceFromUSMH.ToString()); distanceFromDSMH = length.ToDoubleInEng3(); } JlinerAddJunctionLiner2 model = new JlinerAddJunctionLiner2(jlinerAddTDS); model.Insert(id, companyId, detailId, address, null, null, null, null, null, null, null, null, null, "", null, null, null, buildRebuild, null, null, null, distanceFromUSMH, distanceFromDSMH, "", issue, null, false, null, false, false, "", false, "", "", null, null, "", "", false, "", null, inDatabase); Session.Remove("jliner2Dummy"); Session["jlinerAddTDS"] = jlinerAddTDS; jliner2 = jlinerAddTDS.JunctionLiner2; masterArea = jlinerAddTDS.MasterArea; Session["masterArea"] = masterArea; grdJliner2.DataBind(); grdJliner2.PageIndex = grdJliner2.PageCount - 1; } } }
// //////////////////////////////////////////////////////////////////////// // INITIAL EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_APP_VIEW"]) && Convert.ToBoolean(Session["sgLFS_APP_ADD"]))) { 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) || ((string)Request.QueryString["client"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in jliner_add.aspx"); } // Tag page ViewState["client"] = Request.QueryString["client"]; // Prepare initial data jlinerAddTDS = new JlinerAddTDS(); Session.Remove("masterAreaDummy"); Session.Remove("jliner2Dummy"); // ... Initialize viewstate variables ViewState["StepFrom"] = "Out"; // StepSection1In wizard.ActiveStepIndex = 0; StepSection1In(); // Create and store datasets sectionTDS = new SectionTDS(); Session["sectionTDSForJlinerAdd"] = sectionTDS; Session["jlinerAddTDS"] = jlinerAddTDS; masterArea = jlinerAddTDS.MasterArea; Session["masterArea"] = masterArea; jliner2 = jlinerAddTDS.JunctionLiner2; Session["jliner2"] = jliner2; } else { // Restore datasets sectionTDS = (SectionTDS)Session["sectionTDSForJlinerAdd"]; jlinerAddTDS = (JlinerAddTDS)Session["jlinerAddTDS"]; } }