// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_RESOURCES_MATERIALS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_RESOURCES_MATERIALS_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["material_state"] == null) || ((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["material_id"] == null) || ((string)Request.QueryString["active_tab"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in materials_state.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfMaterialId.Value = Request.QueryString["material_id"]; hdfActiveTab.Value = Request.QueryString["active_tab"].ToString(); // Prepare initial data // ... for material title int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int materialId = Int32.Parse(hdfMaterialId.Value); MaterialsGateway materialsGateway = new MaterialsGateway(); materialsGateway.LoadByMaterialId(materialId, companyId); lblTitleMaterial.Text = "Material: " + materialsGateway.GetDescription(materialId); // If coming from materials_summary.aspx if ((string)Request.QueryString["source_page"] == "materials_summary.aspx") { // Store Navigator State and Update control StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // Get project record materialsInformationTDS = (MaterialsInformationTDS)Session["materialsInformationTDS"]; MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGateway = new MaterialsInformationBasicInformationGateway(materialsInformationTDS); materialsInformationBasicInformationGateway.LoadByMaterialId(materialId, companyId); // Store datasets Session["materialsInformationTDS"] = materialsInformationTDS; } } else { // Restore dataset materialsInformationTDS = (MaterialsInformationTDS)Session["materialsInformationTDS"]; } }
protected void Page_PreRender(object sender, EventArgs e) { // Set active toolbar mForm6 master = (mForm6)this.Master; master.ActiveToolbar = "Resources"; // Format Description if (hdfProcess.Value == "Full Length Lining") { pnlJunctionLiner.Visible = false; pnlPointRepairs.Visible = false; pnlFullLengthLining.Visible = true; // make extra rows not visible extraRow1.Visible = false; extraRow2.Visible = false; extraRow3.Visible = false; extraRow4.Visible = false; extraRow5.Visible = false; extraRow6.Visible = false; extraRow7.Visible = false; extraRow8.Visible = false; extraRow9.Visible = false; extraRow10.Visible = false; extraRow11.Visible = false; extraRow12.Visible = false; } if (hdfProcess.Value == "Point Repairs") { pnlJunctionLiner.Visible = false; pnlPointRepairs.Visible = true; pnlFullLengthLining.Visible = false; // make extra rows not visible extraRow1.Visible = false; extraRow2.Visible = false; extraRow3.Visible = false; extraRow4.Visible = false; extraRow5.Visible = false; extraRow6.Visible = false; extraRow7.Visible = false; extraRow8.Visible = false; extraRow9.Visible = false; extraRow10.Visible = false; extraRow11.Visible = false; extraRow12.Visible = false; } if (hdfProcess.Value == "Junction Lining") { pnlJunctionLiner.Visible = true; pnlPointRepairs.Visible = false; pnlFullLengthLining.Visible = false; // make extra rows not visible extraRow1.Visible = true; extraRow2.Visible = true; extraRow3.Visible = true; extraRow4.Visible = true; extraRow5.Visible = true; extraRow6.Visible = true; extraRow7.Visible = true; extraRow8.Visible = true; extraRow9.Visible = true; extraRow10.Visible = true; extraRow11.Visible = true; extraRow12.Visible = true; // Load correct radiobutton for new options int materialId = Int32.Parse(hdfCurrentMaterialId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGatewayForLoad = new MaterialsInformationBasicInformationGateway(materialsInformationTDS); materialsInformationBasicInformationGatewayForLoad.LoadByMaterialId(materialId, companyId); string jlDescription = materialsInformationBasicInformationGatewayForLoad.GetDescription(materialId); if (jlDescription == "Lateral / Misc Supplies") { rbtnMiscSupplies.Checked = true; rbtnCleanoutMaterial.Checked = false; rbtnBackfillCleanout.Checked = false; rbtnRestorationCrowleCap.Checked = false; rbtnOther.Checked = false; tbxJLSize.Text = ""; } else { if (jlDescription == "Lateral / Cleanout Material") { rbtnMiscSupplies.Checked = false; rbtnCleanoutMaterial.Checked = true; rbtnBackfillCleanout.Checked = false; rbtnRestorationCrowleCap.Checked = false; rbtnOther.Checked = false; tbxJLSize.Text = ""; } else { if (jlDescription == "Lateral / Backfill - Cleanout") { rbtnMiscSupplies.Checked = false; rbtnCleanoutMaterial.Checked = false; rbtnBackfillCleanout.Checked = true; rbtnRestorationCrowleCap.Checked = false; rbtnOther.Checked = false; tbxJLSize.Text = ""; } else { if (jlDescription == "Lateral / Restoration & Crowle Cap") { rbtnMiscSupplies.Checked = false; rbtnCleanoutMaterial.Checked = false; rbtnBackfillCleanout.Checked = false; rbtnRestorationCrowleCap.Checked = true; rbtnOther.Checked = false; tbxJLSize.Text = ""; } else { rbtnMiscSupplies.Checked = false; rbtnCleanoutMaterial.Checked = false; rbtnBackfillCleanout.Checked = false; rbtnRestorationCrowleCap.Checked = false; rbtnOther.Checked = true; tbxJLSize.Text = materialsInformationBasicInformationGatewayForLoad.GetSize(materialId); } } } } } }
private void LoadBasicData(int materialId) { MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGateway = new MaterialsInformationBasicInformationGateway(materialsInformationTDS); if (materialsInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load material basic data hdfProcess.Value = materialsInformationBasicInformationGateway.GetType(materialId); tbxProcess.Text = materialsInformationBasicInformationGateway.GetType(materialId); tbxState.Text = materialsInformationBasicInformationGateway.GetState(materialId); tbxDescription.Text = materialsInformationBasicInformationGateway.GetDescription(materialId); if (hdfProcess.Value == "Full Length Lining") { ddlThickness.SelectedValue = materialsInformationBasicInformationGateway.GetThickness(materialId); tbxSize.Text = materialsInformationBasicInformationGateway.GetSize(materialId); } if (hdfProcess.Value == "Point Repairs") { ddlPrSize.SelectedValue = materialsInformationBasicInformationGateway.GetSize(materialId); ddlPrLength.SelectedValue = materialsInformationBasicInformationGateway.GetLength(materialId); } if (hdfProcess.Value == "Junction Lining") { string jlDescription = materialsInformationBasicInformationGateway.GetDescription(materialId); if (jlDescription == "Lateral / Misc Supplies") { rbtnMiscSupplies.Checked = true; } else { if (jlDescription == "Lateral / Cleanout Material") { rbtnCleanoutMaterial.Checked = true; } else { if (jlDescription == "Lateral / Backfill - Cleanout") { rbtnBackfillCleanout.Checked = true; } else { tbxJLSize.Text = materialsInformationBasicInformationGateway.GetSize(materialId); } } } } } }
private void LoadBasicData(int materialId) { MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGateway = new MaterialsInformationBasicInformationGateway(materialsInformationTDS); if (materialsInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load material basic data tbxDescription.Text = materialsInformationBasicInformationGateway.GetDescription(materialId); tbxProcess.Text = materialsInformationBasicInformationGateway.GetType(materialId); hdfProcess.Value = tbxProcess.Text; tbxSize.Text = materialsInformationBasicInformationGateway.GetSize(materialId); tbxState.Text = materialsInformationBasicInformationGateway.GetState(materialId); if (tbxProcess.Text == "Point Repairs") { tbxThicknessLength.Text = materialsInformationBasicInformationGateway.GetLength(materialId); lblThicknessLength.Text = "Length"; } else { if (tbxProcess.Text == "Full Length Lining") { tbxThicknessLength.Text = materialsInformationBasicInformationGateway.GetThickness(materialId); lblThicknessLength.Text = "Thickness"; } } } }
/// <summary> /// Save /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { MaterialsInformationTDS materialsInformationChanges = (MaterialsInformationTDS)Data.GetChanges(); if (materialsInformationChanges.BasicInformation.Rows.Count > 0) { MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGateway = new MaterialsInformationBasicInformationGateway(materialsInformationChanges); // Update services foreach (MaterialsInformationTDS.BasicInformationRow basicInformationRow in (MaterialsInformationTDS.BasicInformationDataTable)materialsInformationChanges.BasicInformation) { // Unchanged values int materialId = basicInformationRow.MaterialID; bool deleted = basicInformationRow.Deleted; // Original values string originalDescription = materialsInformationBasicInformationGateway.GetDescriptionOriginal(materialId); string originalSize = materialsInformationBasicInformationGateway.GetSizeOriginal(materialId); string originalLength = materialsInformationBasicInformationGateway.GetLengthOriginal(materialId); string originalThickness = materialsInformationBasicInformationGateway.GetThicknessOriginal(materialId); string originalType = materialsInformationBasicInformationGateway.GetTypeOriginal(materialId); string originalState = materialsInformationBasicInformationGateway.GetStateOriginal(materialId); // New variables string newDescription = materialsInformationBasicInformationGateway.GetDescription(materialId); string newSize = materialsInformationBasicInformationGateway.GetSize(materialId); string newLength = materialsInformationBasicInformationGateway.GetLength(materialId); string newThickness = materialsInformationBasicInformationGateway.GetThickness(materialId); string newType = materialsInformationBasicInformationGateway.GetType(materialId); string newState = materialsInformationBasicInformationGateway.GetState(materialId); // ... Update Materials materials = new Materials(null); materials.UpdateDirect(materialId, originalDescription, originalSize, originalLength, originalThickness, originalType, originalState, deleted, companyId, materialId, newDescription, newSize, newLength, newThickness, newType, newState, deleted, companyId); } } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// LoadByMaterialId /// </summary> /// <param name="materialId">materialId</param> /// <param name="companyId">companyId</param> public void LoadByMaterialId(int materialId, int companyId) { MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGateway = new MaterialsInformationBasicInformationGateway(Data); materialsInformationBasicInformationGateway.LoadByMaterialId(materialId, companyId); }
private void UpdateState() { int materialId = Int32.Parse(hdfMaterialId.Value); MaterialsInformationBasicInformationGateway materialsInformationBasicInformationGateway = new MaterialsInformationBasicInformationGateway(materialsInformationTDS); // General Data string description = materialsInformationBasicInformationGateway.GetDescription(materialId); string size = materialsInformationBasicInformationGateway.GetSize(materialId); string length = materialsInformationBasicInformationGateway.GetLength(materialId); string thickness = materialsInformationBasicInformationGateway.GetThickness(materialId); string type = materialsInformationBasicInformationGateway.GetType(materialId); int companyId = Int32.Parse(hdfCompanyId.Value); // ... Get new values string newState = null; switch ((string)Request.QueryString["material_state"]) { case "Available": newState = "Not Available"; break; case "Not Available": newState = "Available"; break; } // Update service data MaterialsInformationBasicInformation materialsInformationBasicInformation = new MaterialsInformationBasicInformation(materialsInformationTDS); materialsInformationBasicInformation.Update(materialId, description, size, length, thickness, type, newState, false, companyId); }