// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP2 - SUMMARY // // //////////////////////////////////////////////////////////////////////// // STEP2 - SUMMARY - METHODS // private void StepSummaryIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Summary"; // Initialize summary AddManholeNew addManholeNew = new AddManholeNew(addManholeTDS); tbxSummary.Text = addManholeNew.GetSummary(); }
private void Save() { // save to database DB.Open(); DB.BeginTransaction(); try { Int64? country = null; if (hdfCountryId.Value != "0") country = Int64.Parse(hdfCountryId.Value); Int64? provinceId = null; if (hdfProvinceId.Value != "0") provinceId = Int64.Parse(hdfProvinceId.Value); Int64? countyId = null; if (hdfCountyId.Value != "0") countyId = Int64.Parse(hdfCountyId.Value); Int64? cityId = null; if (hdfCityId.Value != "0") cityId = Int64.Parse(hdfCityId.Value); int companyId = int.Parse(hdfCompanyId.Value); int projectId = int.Parse(ddlProject.SelectedValue); AddManholeNew model = new AddManholeNew(addManholeTDS); model.Save(country, provinceId, countyId, cityId, companyId, projectId); DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
protected void grdAddManholeNew_RowUpdating(object sender, GridViewUpdateEventArgs e) { // Update section Page.Validate("AddManholeUpdate"); if (Page.IsValid) { int companyId = Int32.Parse(hdfCompanyId.Value); int assetId = (int)e.Keys["AssetID"]; string mhId = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxMhIdEdit")).Text; string street = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxStreetEdit")).Text.Trim(); string latitude = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxLatitudeEdit")).Text.Trim(); string longitude = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxLongitudeEdit")).Text.Trim(); string shape = ((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlShapeEdit")).SelectedValue; string location = ((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlLocationEdit")).SelectedValue; int? conditionRating = null; if (Int32.Parse(((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlConditioningRatingEdit")).SelectedValue) == -1) { conditionRating = Int32.Parse(((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlConditioningRatingEdit")).SelectedValue); } int materialId = Int32.Parse(((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlMaterialEdit")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGateway = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGateway.LoadByMaterialId((int)materialId, companyId); string material = ""; if (assetSewerMHMaterialTypeGateway.Table.Rows.Count > 0) material = assetSewerMHMaterialTypeGateway.GetMaterialType((int)materialId); string topDiameter = ""; string topDepth = ""; string topFloor = ""; string topCeiling = ""; string topBenching = ""; string downDiameter = ""; string downDepth = ""; string downFloor = ""; string downCeiling = ""; string downBenching = ""; string rectangle1LongSide = ""; string rectangle1ShortSide = ""; string rectangle2LongSide = ""; string rectangle2ShortSide = ""; string topSurfaceArea = ""; string downSurfaceArea = ""; int? manholeRugs = null; string totalDepth = ""; string totalSufaceArea = ""; if (shape == "Round") { topDiameter = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataChimneyDiameterEdit")).Text.Trim(); topDepth = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataChimneyDepthEdit")).Text.Trim(); downDiameter = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataBarrelDiameterEdit")).Text.Trim(); downDepth = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataBarrelDepthEdit")).Text.Trim(); if (((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlRehabilitationDataRoundManholeRugsEdit")).SelectedValue != "-1") { manholeRugs = Int32.Parse(((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlRehabilitationDataRoundManholeRugsEdit")).SelectedValue); } } if (shape == "Rectangular") { rectangle1LongSide = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangle1LongSideEdit")).Text.Trim(); rectangle1ShortSide = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangle1ShortSideEdit")).Text.Trim(); topDepth = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangle1DepthEdit")).Text.Trim(); rectangle2LongSide = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangle2LongSideEdit")).Text.Trim(); rectangle2ShortSide = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangle2ShortSideEdit")).Text.Trim(); downDepth = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangle2DepthEdit")).Text.Trim(); if (((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlRehabilitationDataRectangularManholeRugsEdit")).SelectedValue != "-1") { manholeRugs = Int32.Parse(((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlRehabilitationDataRectangularManholeRugsEdit")).SelectedValue); } } if (shape == "Mixed") { topDiameter = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRoundDiameterEdit")).Text.Trim(); topDepth = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRoundDepthEdit")).Text.Trim(); rectangle2LongSide = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangleLongSideEdit")).Text.Trim(); rectangle2ShortSide = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangleShortSideEdit")).Text.Trim(); downDepth = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataRectangleDepthEdit")).Text.Trim(); if (((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlRehabilitationDataMixManholeRugsEdit")).SelectedValue != "-1") { manholeRugs = Int32.Parse(((DropDownList)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("ddlRehabilitationDataMixManholeRugsEdit")).SelectedValue); } } if (shape == "Other") { totalSufaceArea = ((TextBox)grdAddManholeNew.Rows[e.RowIndex].Cells[1].FindControl("tbxRehabilitationDataOtherStructureEdit")).Text.Trim(); } AddManholeNew model = new AddManholeNew(addManholeTDS); model.Update(assetId, longitude, latitude, street, shape, location, materialId, topDiameter, topDepth, topFloor, topCeiling, topBenching, downDiameter, downDepth, downFloor, downCeiling, downBenching, rectangle1LongSide, rectangle1ShortSide, rectangle2LongSide, rectangle2ShortSide, topSurfaceArea, downSurfaceArea, manholeRugs, totalDepth, totalSufaceArea, conditionRating, material); // Store dataset Session["addManholeTDS"] = addManholeTDS; Session["addManholeNew"] = addManholeTDS.AddManholeNew; } else { e.Cancel = true; } }
private void GrdAddManholeNewAdd() { if (ValidateManholeFooter()) { Page.Validate("AddManholeAdd"); if (Page.IsValid) { int companyId = Int32.Parse(hdfCompanyId.Value); string mhId = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxMhIdAdd")).Text.Trim(); string street = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxStreetAdd")).Text.Trim(); string latitude = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxLatitudeAdd")).Text.Trim(); string longitude = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxLongitudeAdd")).Text.Trim(); string shape = ((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlShapeAdd")).SelectedValue; string location = ((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlLocationAdd")).SelectedValue; int? conditionRating = null; if (((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlConditioningRatingAdd")).SelectedValue != "-1") { conditionRating = Int32.Parse(((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlConditioningRatingAdd")).SelectedValue); } int materialId = Int32.Parse(((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlMaterialAdd")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGateway = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGateway.LoadByMaterialId(materialId, companyId); string material = ""; if (assetSewerMHMaterialTypeGateway.Table.Rows.Count > 0) material = assetSewerMHMaterialTypeGateway.GetMaterialType(materialId); string topDiameter = ""; string topDepth = ""; string topFloor = ""; string topCeiling = ""; string topBenching = ""; string downDiameter = ""; string downDepth = ""; string downFloor = ""; string downCeiling = ""; string downBenching = ""; string rectangle1LongSide = ""; string rectangle1ShortSide = ""; string rectangle2LongSide = ""; string rectangle2ShortSide = ""; string topSurfaceArea = ""; string downSurfaceArea = ""; int? manholeRugs = null; string totalDepth = ""; string totalSufaceArea = ""; if (shape == "Round") { topDiameter = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataChimneyDiameterAdd")).Text.Trim(); topDepth = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataChimneyDepthAdd")).Text.Trim(); downDiameter = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataBarrelDiameterAdd")).Text.Trim(); downDepth = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataBarrelDepthAdd")).Text.Trim(); if (((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlRehabilitationDataRoundManholeRugsAdd")).SelectedValue != "-1") { manholeRugs = Int32.Parse(((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlRehabilitationDataRoundManholeRugsAdd")).SelectedValue); } } if (shape == "Rectangular") { rectangle1LongSide = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangle1LongSideAdd")).Text.Trim(); rectangle1ShortSide = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangle1ShortSideAdd")).Text.Trim(); topDepth = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangle1DepthAdd")).Text.Trim(); rectangle2LongSide = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangle2LongSideAdd")).Text.Trim(); rectangle2ShortSide = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangle2ShortSideAdd")).Text.Trim(); downDepth = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangle2DepthAdd")).Text.Trim(); if (((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlRehabilitationDataRectangularManholeRugsAdd")).SelectedValue != "-1") { manholeRugs = Int32.Parse(((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlRehabilitationDataRectangularManholeRugsAdd")).SelectedValue); } } if (shape == "Mixed") { topDiameter = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRoundDiameterAdd")).Text.Trim(); topDepth = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRoundDepthAdd")).Text.Trim(); rectangle2LongSide = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangleLongSideAdd")).Text.Trim(); rectangle2ShortSide = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangleShortSideAdd")).Text.Trim(); downDepth = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataRectangleDepthAdd")).Text.Trim(); if (((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlRehabilitationDataMixManholeRugsAdd")).SelectedValue != "-1") { manholeRugs = Int32.Parse(((DropDownList)grdAddManholeNew.FooterRow.FindControl("ddlRehabilitationDataMixManholeRugsAdd")).SelectedValue); } } if (shape == "Other") { totalSufaceArea = ((TextBox)grdAddManholeNew.FooterRow.FindControl("tbxRehabilitationDataOtherStructureAdd")).Text.Trim(); } AddManholeNew model = new AddManholeNew(addManholeTDS); model.Insert(mhId, longitude, latitude, street, shape, location, materialId, topDiameter, topDepth, topFloor, topCeiling, topBenching, downDiameter, downDepth, downFloor, downCeiling, downBenching, rectangle1LongSide, rectangle1ShortSide, rectangle2LongSide, rectangle2ShortSide, topSurfaceArea, downSurfaceArea, manholeRugs, totalDepth, totalSufaceArea, conditionRating, material, false, companyId); Session.Remove("addManholeNewDummy"); Session["addManholeTDS"] = addManholeTDS; Session["addManholeNew"] = addManholeTDS.AddManholeNew; grdAddManholeNew.DataBind(); grdAddManholeNew.PageIndex = grdAddManholeNew.PageCount - 1; } } }
protected void grdAddManholeNew_RowDeleting(object sender, GridViewDeleteEventArgs e) { // AddManholeNew Gridview, if the gridview is edition mode if (grdAddManholeNew.EditIndex >= 0) { grdAddManholeNew.UpdateRow(grdAddManholeNew.EditIndex, true); } //Delete int assetId = (int)e.Keys["AssetID"]; int companyId = Int32.Parse(hdfCompanyId.Value); // Delete catalysts AddManholeNew model = new AddManholeNew(addManholeTDS); model.Delete(assetId, companyId); // Store dataset Session["addManholeTDS"] = addManholeTDS; grdAddManholeNew.DataBind(); }