// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); bool isFromTabClick = false; if (!IsPostBack) { if (!isFromTabClick) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_EDIT"]))) { 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_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in fl_edit.aspx"); } // Tag Page TagPage(); // Prepare initial data Session.Remove("flAddLateralsNewDummy"); Session.Remove("wetOutCatalystsDetailsDummy"); Session.Remove("materialInformationTDS"); materialInformationTDS = new MaterialInformationTDS(); // ... for wet out section list AssetSewerSectionList assetSewerSectionList = new AssetSewerSectionList(); assetSewerSectionList.LoadAndAddItem(Int32.Parse(hdfCurrentProjectId.Value), hdfWorkType.Value, "-1", "(All)", Int32.Parse(hdfCompanyId.Value)); cbxlSectionId.DataSource = assetSewerSectionList.Table; cbxlSectionId.DataValueField = "SectionID"; cbxlSectionId.DataTextField = "FlowOrderID"; cbxlSectionId.DataBind(); cbxlInversionDataSectionId.DataSource = assetSewerSectionList.Table; cbxlInversionDataSectionId.DataValueField = "SectionID"; cbxlInversionDataSectionId.DataTextField = "FlowOrderID"; cbxlInversionDataSectionId.DataBind(); // If coming from int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString()); int assetId = Int32.Parse(hdfAssetId.Value.Trim()); int workId = Int32.Parse(hdfWorkId.Value.Trim()); string workType = hdfWorkType.Value; // ... fl_navigator2.aspx if (Request.QueryString["source_page"] == "fl_navigator2.aspx") { StoreNavigatorState(); ViewState["update"] = "no"; // ... Set initial tab if ((string)Session["dialogOpenedFll"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; fullLengthLiningTDS = new FullLengthLiningTDS(); FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS); fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId); FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS); fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId); FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS); fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId); FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS); fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId); } else { hdfActiveTab.Value = (string)Session["activeTabFll"]; // Restore datasets fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"]; } // ... Store dataset Session["fullLengthLiningTDS"] = fullLengthLiningTDS; } // ... fl_summary.aspx or fl_edit.aspx if ((Request.QueryString["source_page"] == "fl_summary.aspx") || (Request.QueryString["source_page"] == "fl_edit.aspx")) { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // ... Restore dataset fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"]; // ... Set initial tab if ((string)Session["dialogOpenedFll"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; } else { hdfActiveTab.Value = (string)Session["activeTabFll"]; } if (ViewState["update"].ToString().Trim() == "yes") { FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS); fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId); FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS); fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId); FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS); fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId); FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS); fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId); // ... Store dataset Session["fullLengthLiningTDS"] = fullLengthLiningTDS; } } // Prepare initial data lblMissingData.Visible = false; // Set initial tab int activeTab = Int32.Parse(hdfActiveTab.Value); tcFlDetails.ActiveTabIndex = activeTab; // ... for client int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString()); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadByCompaniesId(currentClientId, companyId); lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId); // ... for project ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(currentProjectId); string name = projectGateway.GetName(currentProjectId); if (name.Length > 23) name = name.Substring(0, 20) + "..."; lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section"; // ... Data for current full length lining work LoadFullLengthLiningData(currentProjectId, assetId, companyId); // Databind Page.DataBind(); // Especial load for Run details string runDetails = hdfRunDetails.Value; WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway(); workFullLengthLiningWetOutGateway.LoadByWorkId(workId, companyId); // ... Verify if work has cipp information to load run details if (workFullLengthLiningWetOutGateway.Table.Rows.Count > 0) { string[] runDetailsList = runDetails.Split('>'); for (int i = 0; i < runDetailsList.Length; i++) { cbxlSectionId.Items.FindByValue(runDetailsList[i]).Selected = true; cbxlInversionDataSectionId.Items.FindByValue(runDetailsList[i]).Selected = true; } } else { if (cbxlSectionId.Items.Count > 1) { cbxlSectionId.Items.FindByValue(runDetails).Selected = true; } } // SelectIndex for grids ((DropDownList)grdLaterals.FooterRow.FindControl("ddlNewMaterial")).SelectedIndex = 0; ((DropDownList)grdCatalysts.FooterRow.FindControl("ddlNameFooter")).SelectedIndex = 0; // For usmh, dsmh autocomplete string provinceId_ = "0"; if (hdfProvinceId.Value != "") provinceId_ = hdfProvinceId.Value; string countyId_ = "0"; if (hdfCountyId.Value != "") countyId_ = hdfCountyId.Value; string cityId_ = "0"; if (hdfCityId.Value != "") cityId_ = hdfCityId.Value; aceUsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value; aceDsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value; // Make Wetout tab visible if (ckbxWetOutDataIncludeWetOutInformation.Checked) { pnlVisibleInformation.Visible = true; upnlVisibleInformation.Update(); } else { pnlVisibleInformation.Visible = false; upnlVisibleInformation.Update(); } // Make inversion tab visible lblInversionDataInversionMissingData.Visible = false; uplInversionDataInversionMissingData.Update(); if (ckbxInversionDataIncludeInversionInformation.Checked) { // ... ... visible only if wet out information is provided. if (!ckbxWetOutDataIncludeWetOutInformation.Checked) { pnlInversionVisibleInformation.Visible = false; upnlInversionVisibleInformation.Update(); } else { pnlInversionVisibleInformation.Visible = true; upnlInversionVisibleInformation.Update(); } } else { pnlInversionVisibleInformation.Visible = false; upnlInversionVisibleInformation.Update(); } // Load Materials MaterialInformationGateway materialInformationGateway = new MaterialInformationGateway(materialInformationTDS); materialInformationGateway.LoadAllByAssetId(assetId, companyId); materialInformation = materialInformationTDS.MaterialInformation; Session["materialInformationTDS"] = materialInformationTDS; } } else { // Restore datasets fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"]; flatSectionJlTDSForFLL = (FlatSectionJlTDS)Session["flatSectionJlTDSForFLL"]; materialInformationTDS = (MaterialInformationTDS)Session["materialInformationTDS"]; materialInformation = materialInformationTDS.MaterialInformation; // Set initial tab int activeTab = Int32.Parse(hdfActiveTab.Value); tcFlDetails.ActiveTabIndex = activeTab; } }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); bool isFromTabClick = false; if (!IsPostBack) { if (!isFromTabClick) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_CWP_REHABASSESSMENT_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_REHABASSESSMENT_EDIT"]))) { 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_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in ra_edit.aspx"); } // Tag Page TagPage(); // Prepare initial data Session.Remove("raAddLateralsNewDummy"); Session.Remove("materialInformationTDS"); materialInformationTDS = new MaterialInformationTDS(); // If coming from int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString()); int assetId = Int32.Parse(hdfAssetId.Value.Trim()); int workId = Int32.Parse(hdfWorkId.Value.Trim()); int workIdFll = Int32.Parse(hdfWorkIdFll.Value.Trim()); string workType = hdfWorkType.Value; // ... ra_navigator2.aspx if (Request.QueryString["source_page"] == "ra_navigator2.aspx") { StoreNavigatorState(); ViewState["update"] = "no"; // ... Set initial tab if ((string)Session["dialogOpenedRa"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; rehabAssessmentTDS = new RehabAssessmentTDS(); RehabAssessmentSectionDetails rehabAssessmentSectionDetails = new RehabAssessmentSectionDetails(rehabAssessmentTDS); rehabAssessmentSectionDetails.LoadByWorkId(workId, companyId); RehabAssessmentWorkDetails rehabAssessmentWorkDetails = new RehabAssessmentWorkDetails(rehabAssessmentTDS); rehabAssessmentWorkDetails.LoadByWorkId(workId, companyId); RehabAssessmentLateralDetails rehabAssessmentLateralDetails = new RehabAssessmentLateralDetails(rehabAssessmentTDS); rehabAssessmentLateralDetails.LoadForEdit(workIdFll, assetId, companyId, currentProjectId); } else { hdfActiveTab.Value = (string)Session["activeTabRa"]; // Restore dataset rehabAssessmentTDS = (RehabAssessmentTDS)Session["rehabAssessmentTDS"]; } // Store dataset Session["rehabAssessmentTDS"] = rehabAssessmentTDS; } // ... ra_summary.aspx or ra_edit.aspx if ((Request.QueryString["source_page"] == "ra_summary.aspx") || (Request.QueryString["source_page"] == "ra_edit.aspx")) { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // ... Set initial tab if ((string)Session["dialogOpenedRa"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; } else { hdfActiveTab.Value = (string)Session["activeTabRa"]; } if (ViewState["update"].ToString().Trim() == "yes") { rehabAssessmentTDS = new RehabAssessmentTDS(); RehabAssessmentSectionDetails rehabAssessmentSectionDetails = new RehabAssessmentSectionDetails(rehabAssessmentTDS); rehabAssessmentSectionDetails.LoadByWorkId(workId, companyId); RehabAssessmentWorkDetails rehabAssessmentWorkDetails = new RehabAssessmentWorkDetails(rehabAssessmentTDS); rehabAssessmentWorkDetails.LoadByWorkId(workId, companyId); RehabAssessmentLateralDetails rehabAssessmentLateralDetails = new RehabAssessmentLateralDetails(rehabAssessmentTDS); rehabAssessmentLateralDetails.LoadForEdit(workIdFll, assetId, companyId, currentProjectId); // Store dataset Session["rehabAssessmentTDS"] = rehabAssessmentTDS; } // Restore dataset rehabAssessmentTDS = (RehabAssessmentTDS)Session["rehabAssessmentTDS"]; } // Prepare initial data lblMissingData.Visible = false; // Set initial tab int activeTab = Int32.Parse(hdfActiveTab.Value); tcRaDetails.ActiveTabIndex = activeTab; // ... for client int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString()); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadByCompaniesId(currentClientId, companyId); lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId); // ... for project ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(currentProjectId); string name = projectGateway.GetName(currentProjectId); if (name.Length > 23) name = name.Substring(0, 20) + "..."; lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section"; // ... Data for current work LoadRehabAssessmentData(currentProjectId, assetId, companyId); // Databind Page.DataBind(); ((DropDownList)grdLaterals.FooterRow.FindControl("ddlNewMaterial")).SelectedIndex = 0; // For usmh, dsmh autocomplete string provinceId_ = "0"; if (hdfProvinceId.Value != "") provinceId_ = hdfProvinceId.Value; string countyId_ = "0"; if (hdfCountyId.Value != "") countyId_ = hdfCountyId.Value; string cityId_ = "0"; if (hdfCityId.Value != "") cityId_ = hdfCityId.Value; aceUsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value; aceDsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value; // Load Materials MaterialInformationGateway materialInformationGateway = new MaterialInformationGateway(materialInformationTDS); materialInformationGateway.LoadAllByAssetId(assetId, companyId); materialInformation = materialInformationTDS.MaterialInformation; Session["materialInformationTDS"] = materialInformationTDS; } } else { // Restore datasets rehabAssessmentTDS = (RehabAssessmentTDS)Session["rehabAssessmentTDS"]; flatSectionJlTDSForRA = (FlatSectionJlTDS)Session["flatSectionJlTDSForRA"]; materialInformationTDS = (MaterialInformationTDS)Session["materialInformationTDS"]; materialInformation = materialInformationTDS.MaterialInformation; // Set initial tab int activeTab = Int32.Parse(hdfActiveTab.Value); tcRaDetails.ActiveTabIndex = activeTab; } }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_EDIT"])) || !(Convert.ToBoolean(Session["sgLFS_CWP_REHABASSESSMENT_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_REHABASSESSMENT_EDIT"]))) { 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["asset_id"] == null) || ((string)Request.QueryString["work_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in asset_sewer_material.aspx"); } // Tag Page hdfCompanyId.Value = Session["companyID"].ToString(); hdfAssetId.Value = Convert.ToString(Request.QueryString["asset_id"]); hdfWorkId.Value = Convert.ToString(Request.QueryString["work_id"]); hdfUpdate.Value = "yes"; Session.Remove("materialInformationNewDummy"); Session.Remove("materialInformation"); // If coming from // ... fl_edit.aspx or ra_edit.aspx if ((Request.QueryString["source_page"] == "fl_edit.aspx") || (Request.QueryString["source_page"] == "ra_edit.aspx")) { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // ... Load materials to edit materialInformationTDS = new MaterialInformationTDS(); // Get workId int assetId = Int32.Parse(hdfAssetId.Value.Trim()); int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); MaterialInformationGateway materialInformationGateway = new MaterialInformationGateway(materialInformationTDS); materialInformationGateway.LoadAllByAssetId(assetId, companyId); // ... Store datasets Session["materialInformationTDS"] = materialInformationTDS; Session["materialInformation"] = materialInformationTDS.MaterialInformation; } } else { // Restore datasets materialInformationTDS = (MaterialInformationTDS)Session["materialInformationTDS"]; materialInformation = materialInformationTDS.MaterialInformation; } }
/// <summary> /// Insert a material /// </summary> /// <param name="lateral_assetId">lateral_assetId</param> /// <param name="material">material</param> /// <param name="companyId">companyId</param> private void InsertMaterial(int lateral_assetId, string material, int companyId) { LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null); if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(lateral_assetId, material, companyId)) { MaterialInformationGateway materialInformationGateway = new MaterialInformationGateway(); materialInformationGateway.LoadAllByAssetId(lateral_assetId, companyId); AssetSewerMaterial assetSewerMaterial = new AssetSewerMaterial(materialInformationGateway.Data); assetSewerMaterial.InsertDirect(lateral_assetId, materialInformationGateway.Table.Rows.Count + 1, material, DateTime.Now, false, companyId); } }