private bool ValidateProjectAddSectionsFooter() { string street = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxStreetAdd")).Text; string usmh = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhAdd")).Text; string dsmh = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhAdd")).Text; string usmhStreet = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhStreetAdd")).Text.Trim(); string usmhLatitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhLatitudeAdd")).Text.Trim(); string usmhLongitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhLongitudeAdd")).Text.Trim(); string usmhShape = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhShapeAdd")).SelectedValue; string usmhLocation = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhLocationAdd")).SelectedValue; int? usmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhConditionRatingAdd")).SelectedValue != "-1") { usmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhConditionRatingAdd")).SelectedValue); } int? usmhMaterialId = null; string usmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhMaterialAdd")).SelectedValue != "-1") { usmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhMaterialAdd")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForUsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForUsmh.LoadByMaterialId((int)usmhMaterialId, Int32.Parse(hdfCompanyId.Value)); usmhMaterial = assetSewerMHMaterialTypeGatewayForUsmh.GetMaterialType((int)usmhMaterialId); } string dsmhStreet = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhStreetAdd")).Text.Trim(); string dsmhLatitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhLatitudeAdd")).Text.Trim(); string dsmhLongitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhLongitudeAdd")).Text.Trim(); string dsmhShape = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhShapeAdd")).SelectedValue; string dsmhLocation = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhLocationAdd")).SelectedValue; int? dsmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhConditionRatingAdd")).SelectedValue != "-1") { dsmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhConditionRatingAdd")).SelectedValue); } int? dsmhMaterialId = null; string dsmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhMaterialAdd")).SelectedValue != "-1") { dsmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhMaterialAdd")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForDsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForDsmh.LoadByMaterialId((int)dsmhMaterialId, Int32.Parse(hdfCompanyId.Value)); dsmhMaterial = assetSewerMHMaterialTypeGatewayForDsmh.GetMaterialType((int)dsmhMaterialId); } if ((street != "") || (usmh != "") || (dsmh != "") || (usmhStreet != "") || (usmhLatitude != "") || (usmhLongitude != "") || (usmhShape != "") || (usmhLocation != "") || (usmhConditionRating != null) || (usmhMaterial != "") || (dsmhStreet != "") || (dsmhLatitude != "") || (dsmhLongitude != "") || (dsmhShape != "") || (dsmhLocation != "") || (dsmhConditionRating != null) || (dsmhMaterial != "")) { return true; } return false; }
protected void grdProjectAddSectionsNew_RowUpdating(object sender, GridViewUpdateEventArgs e) { // Update section Page.Validate("AddSectionsUpdate"); if (Page.IsValid) { int id = (int)e.Keys["ID"]; int companyId = Int32.Parse(hdfCompanyId.Value); string sectionId = ((Label)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[0].FindControl("lblSectionIdEdit")).Text; string street = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxStreetEdit")).Text; string usmh = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxUsmhEdit")).Text; string dsmh = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxDsmhEdit")).Text; string mapSize = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxMapSizeEdit")).Text; string mapLength = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxMapLengthEdit")).Text; string clientId = ""; if (((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxClientIdEdit")).Text.Trim() != "") { clientId = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxClientIdEdit")).Text; } string sectionMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("ddlSectionMaterialEdit")).SelectedValue != "-1") { sectionMaterial = ((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("ddlSectionMaterialEdit")).SelectedValue; } bool cbxRA = ((CheckBox)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("cbxRehabAssessmentWorkEdit")).Checked; bool cbxFLL = ((CheckBox)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("cbxFullLengthLiningWorkEdit")).Checked; bool cbxPR = ((CheckBox)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("cbxPointRepairsWorkEdit")).Checked; bool cbxJL = ((CheckBox)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("cbxJunctionLiningWorkEdit")).Checked; bool cbxMHRehabUsmh = ((CheckBox)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("cbxMHRehabUsmhEdit")).Checked; bool cbxMHRehabDsmh = ((CheckBox)grdProjectAddSectionsNew.Rows[e.RowIndex].FindControl("cbxMHRehabDsmhEdit")).Checked; string usmhStreet = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxUsmhStreetEdit")).Text.Trim(); string usmhLatitude = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxUsmhLatitudeEdit")).Text.Trim(); string usmhLongitude = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxUsmhLongitudeEdit")).Text.Trim(); string usmhShape = ((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlUsmhShapeEdit")).SelectedValue; string usmhLocation = ((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlUsmhLocationEdit")).SelectedValue; int? usmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlUsmhConditionRatingEdit")).SelectedValue != "-1") { usmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlUsmhConditionRatingEdit")).SelectedValue); } int? usmhMaterialId = null; string usmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlUsmhMaterialEdit")).SelectedValue != "-1") { usmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlUsmhMaterialEdit")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForUsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForUsmh.LoadByMaterialId((int)usmhMaterialId, companyId); usmhMaterial = assetSewerMHMaterialTypeGatewayForUsmh.GetMaterialType((int)usmhMaterialId); } string dsmhStreet = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxDsmhStreetEdit")).Text.Trim(); string dsmhLatitude = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxDsmhLatitudeEdit")).Text.Trim(); string dsmhLongitude = ((TextBox)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("tbxDsmhLongitudeEdit")).Text.Trim(); string dsmhShape = ((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlDsmhShapeEdit")).SelectedValue; string dsmhLocation = ((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlDsmhLocationEdit")).SelectedValue; int? dsmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlDsmhConditionRatingEdit")).SelectedValue != "-1") { dsmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlDsmhConditionRatingEdit")).SelectedValue); } int? dsmhMaterialId = null; string dsmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlDsmhMaterialEdit")).SelectedValue != "-1") { dsmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.Rows[e.RowIndex].Cells[1].FindControl("ddlDsmhMaterialEdit")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForDsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForDsmh.LoadByMaterialId((int)dsmhMaterialId, companyId); dsmhMaterial = assetSewerMHMaterialTypeGatewayForDsmh.GetMaterialType((int)dsmhMaterialId); } // ... get structure data string usmhTopDiameter = ""; string usmhTopDepth = ""; string usmhDownDiameter = ""; string usmhDownDepth = ""; int? usmhManholeRugs = null; string usmhRectangle1LongSide = ""; string usmhRectangle1ShortSide = ""; string usmhRectangle2LongSide = ""; string usmhRectangle2ShortSide = ""; string usmhTotalSurfaceArea = ""; string dsmhTopDiameter = ""; string dsmhTopDepth = ""; string dsmhDownDiameter = ""; string dsmhDownDepth = ""; int? dsmhManholeRugs = null; string dsmhRectangle1LongSide = ""; string dsmhRectangle1ShortSide = ""; string dsmhRectangle2LongSide = ""; string dsmhRectangle2ShortSide = ""; string dsmhTotalSurfaceArea = ""; // Update datasets ProjectAddSectionsTDS dataSet = new ProjectAddSectionsTDS(); dataSet.ProjectAddSectionsNew.Merge(projectAddSectionsNew, true); ProjectAddSectionsNew model = new ProjectAddSectionsNew(dataSet); // Update model.Update(id, sectionId, street, usmh, dsmh, cbxJL, cbxRA, cbxFLL, cbxPR, false, sectionId, mapSize, mapLength, usmhStreet, usmhLatitude, usmhLongitude, usmhShape, usmhLocation, usmhConditionRating, usmhMaterialId, usmhMaterial, usmhTopDiameter, usmhTopDepth, usmhDownDiameter, usmhDownDepth, usmhManholeRugs, usmhRectangle1LongSide, usmhRectangle1ShortSide, usmhRectangle2LongSide, usmhRectangle2ShortSide, usmhTotalSurfaceArea, dsmhStreet, dsmhLatitude, dsmhLongitude, dsmhShape, dsmhLocation, dsmhConditionRating, dsmhMaterialId, dsmhMaterial, dsmhTopDiameter, dsmhTopDepth, dsmhDownDiameter, dsmhDownDepth, dsmhManholeRugs, dsmhRectangle1LongSide, dsmhRectangle1ShortSide, dsmhRectangle2LongSide, dsmhRectangle2ShortSide, dsmhTotalSurfaceArea, sectionMaterial, clientId, cbxMHRehabUsmh, cbxMHRehabDsmh); Session["projectAddSectionsNew"] = dataSet.ProjectAddSectionsNew; projectAddSectionsNew = dataSet.ProjectAddSectionsNew; } else { e.Cancel = true; } }
private void GrdProjectAddSectionsNewAdd() { if (ValidateProjectAddSectionsFooter()) { Page.Validate("AddSectionsAdd"); if (Page.IsValid) { // Get values int companyId = Int32.Parse(hdfCompanyId.Value); string street = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxStreetAdd")).Text; string usmh = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhAdd")).Text; string dsmh = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhAdd")).Text; string mapSize = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxMapSizeAdd")).Text; string mapLength = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxMapLengthAdd")).Text; string clientId = ""; if (((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxClientIdAdd")).Text.Trim() != "") { clientId = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxClientIdAdd")).Text; } string sectionMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlSectionMaterialAdd")).SelectedValue != "-1") { sectionMaterial = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlSectionMaterialAdd")).SelectedValue; } bool cbxRA = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxRehabAssessmentWorkAdd")).Checked; bool cbxFLL = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxFullLengthLiningWorkAdd")).Checked; bool cbxPR = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxPointRepairsWorkAdd")).Checked; bool cbxJL = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxJunctionLiningWorkAdd")).Checked; bool cbxMHRehabUsmh = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxMHRehabUsmhAdd")).Checked; bool cbxMHRehabDsmh = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxMHRehabDsmhAdd")).Checked; string usmhStreet = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhStreetAdd")).Text.Trim(); string usmhLatitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhLatitudeAdd")).Text.Trim(); string usmhLongitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhLongitudeAdd")).Text.Trim(); string usmhShape = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhShapeAdd")).SelectedValue; string usmhLocation = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhLocationAdd")).SelectedValue; int? usmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhConditionRatingAdd")).SelectedValue != "-1") { usmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhConditionRatingAdd")).SelectedValue); } int? usmhMaterialId = null; string usmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhMaterialAdd")).SelectedValue != "-1") { usmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhMaterialAdd")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForUsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForUsmh.LoadByMaterialId((int)usmhMaterialId, companyId); usmhMaterial = assetSewerMHMaterialTypeGatewayForUsmh.GetMaterialType((int)usmhMaterialId); } string dsmhStreet = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhStreetAdd")).Text.Trim(); string dsmhLatitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhLatitudeAdd")).Text.Trim(); string dsmhLongitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhLongitudeAdd")).Text.Trim(); string dsmhShape = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhShapeAdd")).SelectedValue; string dsmhLocation = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhLocationAdd")).SelectedValue; int? dsmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhConditionRatingAdd")).SelectedValue != "-1") { dsmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhConditionRatingAdd")).SelectedValue); } int? dsmhMaterialId = null; string dsmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhMaterialAdd")).SelectedValue != "-1") { dsmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhMaterialAdd")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForDsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForDsmh.LoadByMaterialId((int)dsmhMaterialId, companyId); dsmhMaterial = assetSewerMHMaterialTypeGatewayForDsmh.GetMaterialType((int)dsmhMaterialId); } // ... get structure data string usmhTopDiameter = ""; string usmhTopDepth = ""; string usmhDownDiameter = ""; string usmhDownDepth = ""; int? usmhManholeRugs = null; string usmhRectangle1LongSide = ""; string usmhRectangle1ShortSide = ""; string usmhRectangle2LongSide = ""; string usmhRectangle2ShortSide = ""; string usmhTotalSurfaceArea = ""; string dsmhTopDiameter = ""; string dsmhTopDepth = ""; string dsmhDownDiameter = ""; string dsmhDownDepth = ""; int? dsmhManholeRugs = null; string dsmhRectangle1LongSide = ""; string dsmhRectangle1ShortSide = ""; string dsmhRectangle2LongSide = ""; string dsmhRectangle2ShortSide = ""; string dsmhTotalSurfaceArea = ""; // Update datasets ProjectAddSectionsTDS dataSet = new ProjectAddSectionsTDS(); dataSet.ProjectAddSectionsNew.Merge(projectAddSectionsNew, true); ProjectAddSectionsNew model = new ProjectAddSectionsNew(dataSet); int sectionId = model.Table.Rows.Count + 1; // Insert section model.Insert(sectionId.ToString(), street, usmh, dsmh, cbxRA, cbxFLL, cbxPR, cbxJL, false, sectionId.ToString(), mapSize, mapLength, usmhStreet, usmhLatitude, usmhLongitude, usmhShape, usmhLocation, usmhConditionRating, usmhMaterialId, usmhMaterial, usmhTopDiameter, usmhTopDepth, usmhDownDiameter, usmhDownDepth, usmhManholeRugs, usmhRectangle1LongSide, usmhRectangle1ShortSide, usmhRectangle2LongSide, usmhRectangle2ShortSide, usmhTotalSurfaceArea, dsmhStreet, dsmhLatitude, dsmhLongitude, dsmhShape, dsmhLocation, dsmhConditionRating, dsmhMaterialId, dsmhMaterial, dsmhTopDiameter, dsmhTopDepth, dsmhDownDiameter, dsmhDownDepth, dsmhManholeRugs, dsmhRectangle1LongSide, dsmhRectangle1ShortSide, dsmhRectangle2LongSide, dsmhRectangle2ShortSide, dsmhTotalSurfaceArea, sectionMaterial, clientId, cbxMHRehabUsmh, cbxMHRehabDsmh); // Store data Session.Remove("projectAddSectionsNewDummy"); Session["projectAddSectionsNew"] = dataSet.ProjectAddSectionsNew; grdProjectAddSectionsNew.DataBind(); grdProjectAddSectionsNew.PageIndex = grdProjectAddSectionsNew.PageCount - 1; } } }
private bool StepNewSectionsNext() { // Update dataset ProjectAddSectionsTDS dataSet = new ProjectAddSectionsTDS(); dataSet.ProjectAddSectionsNew.Merge(projectAddSectionsNew, true); ProjectAddSectionsNew model = new ProjectAddSectionsNew(dataSet); // Conditions Gridview, if the gridview is edition mode if (grdProjectAddSectionsNew.EditIndex >= 0) { grdProjectAddSectionsNew.UpdateRow(grdProjectAddSectionsNew.EditIndex, false); } if (ValidateProjectAddSectionsFooter()) { Page.Validate("AddSectionsAdd"); if (!Page.IsValid) { return false; } else { bool cbxRA = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxRehabAssessmentWorkAdd")).Checked; bool cbxFLL = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxFullLengthLiningWorkAdd")).Checked; bool cbxPR = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxPointRepairsWorkAdd")).Checked; bool cbxJL = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxJunctionLiningWorkAdd")).Checked; bool cbxMHRehabUsmh = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxMHRehabUsmhAdd")).Checked; bool cbxMHRehabDsmh = ((CheckBox)grdProjectAddSectionsNew.FooterRow.FindControl("cbxMHRehabDsmhAdd")).Checked; if (cbxRA || cbxFLL || cbxJL || cbxPR) { // Get values int companyId = Int32.Parse(hdfCompanyId.Value); string street = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxStreetAdd")).Text; string usmh = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhAdd")).Text; string dsmh = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhAdd")).Text; string mapSize = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxMapSizeAdd")).Text; string mapLength = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxMapLengthAdd")).Text; string clientId = ""; if (((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxClientIdAdd")).Text.Trim() != "") { clientId = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxClientIdAdd")).Text; } string sectionMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlSectionMaterialAdd")).SelectedValue != "-1") { sectionMaterial = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlSectionMaterialAdd")).SelectedValue; } string usmhStreet = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhStreetAdd")).Text.Trim(); string usmhLatitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhLatitudeAdd")).Text.Trim(); string usmhLongitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxUsmhLongitudeAdd")).Text.Trim(); string usmhShape = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhShapeAdd")).SelectedValue; string usmhLocation = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhLocationAdd")).SelectedValue; int? usmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhConditionRatingAdd")).SelectedValue != "-1") { usmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhConditionRatingAdd")).SelectedValue); } int? usmhMaterialId = null; string usmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhMaterialAdd")).SelectedValue != "-1") { usmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlUsmhMaterialAdd")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForUsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForUsmh.LoadByMaterialId((int)usmhMaterialId, companyId); usmhMaterial = assetSewerMHMaterialTypeGatewayForUsmh.GetMaterialType((int)usmhMaterialId); } string dsmhStreet = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhStreetAdd")).Text.Trim(); string dsmhLatitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhLatitudeAdd")).Text.Trim(); string dsmhLongitude = ((TextBox)grdProjectAddSectionsNew.FooterRow.FindControl("tbxDsmhLongitudeAdd")).Text.Trim(); string dsmhShape = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhShapeAdd")).SelectedValue; string dsmhLocation = ((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhLocationAdd")).SelectedValue; int? dsmhConditionRating = null; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhConditionRatingAdd")).SelectedValue != "-1") { dsmhConditionRating = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhConditionRatingAdd")).SelectedValue); } int? dsmhMaterialId = null; string dsmhMaterial = ""; if (((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhMaterialAdd")).SelectedValue != "-1") { dsmhMaterialId = Int32.Parse(((DropDownList)grdProjectAddSectionsNew.FooterRow.FindControl("ddlDsmhMaterialAdd")).SelectedValue); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGatewayForDsmh = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGatewayForDsmh.LoadByMaterialId((int)dsmhMaterialId, companyId); dsmhMaterial = assetSewerMHMaterialTypeGatewayForDsmh.GetMaterialType((int)dsmhMaterialId); } // ... get structure data string usmhTopDiameter = ""; string usmhTopDepth = ""; string usmhDownDiameter = ""; string usmhDownDepth = ""; int? usmhManholeRugs = null; string usmhRectangle1LongSide = ""; string usmhRectangle1ShortSide = ""; string usmhRectangle2LongSide = ""; string usmhRectangle2ShortSide = ""; string usmhTotalSurfaceArea = ""; string dsmhTopDiameter = ""; string dsmhTopDepth = ""; string dsmhDownDiameter = ""; string dsmhDownDepth = ""; int? dsmhManholeRugs = null; string dsmhRectangle1LongSide = ""; string dsmhRectangle1ShortSide = ""; string dsmhRectangle2LongSide = ""; string dsmhRectangle2ShortSide = ""; string dsmhTotalSurfaceArea = ""; int sectionId = model.Table.Rows.Count + 1; // Insert section if ((street != "") || (usmh != "") || (dsmh != "") || (mapSize != "") || (mapLength != "")) { model.Insert(sectionId.ToString(), street, usmh, dsmh, cbxRA, cbxFLL, cbxPR, cbxJL, false, sectionId.ToString(), mapSize, mapLength, usmhStreet, usmhLatitude, usmhLongitude, usmhShape, usmhLocation, usmhConditionRating, usmhMaterialId, usmhMaterial, usmhTopDiameter, usmhTopDepth, usmhDownDiameter, usmhDownDepth, usmhManholeRugs, usmhRectangle1LongSide, usmhRectangle1ShortSide, usmhRectangle2LongSide, usmhRectangle2ShortSide, usmhTotalSurfaceArea, dsmhStreet, dsmhLatitude, dsmhLongitude, dsmhShape, dsmhLocation, dsmhConditionRating, dsmhMaterialId, dsmhMaterial, dsmhTopDiameter, dsmhTopDepth, dsmhDownDiameter, dsmhDownDepth, dsmhManholeRugs, dsmhRectangle1LongSide, dsmhRectangle1ShortSide, dsmhRectangle2LongSide, dsmhRectangle2ShortSide, dsmhTotalSurfaceArea, sectionMaterial, clientId, cbxMHRehabUsmh, cbxMHRehabDsmh); } } else { return false; } } } // create dataset for temp dataSet.ProjectAddSectionsTemp.Merge(projectAddSectionsTemp, true); // process new sections ProjectAddSectionsTemp modelTemp = new ProjectAddSectionsTemp(dataSet); modelTemp.ProcessNew(); // get changes projectAddSectionsNew.Rows.Clear(); projectAddSectionsTemp.Rows.Clear(); projectAddSectionsTemp.Merge(modelTemp.Table); // store tables Session.Remove("projectAddSectionsNewDummy"); Session["projectAddSectionsNew"] = projectAddSectionsNew; Session["projectAddSectionsTemp"] = projectAddSectionsTemp; return true; }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// LoadByWorkId /// </summary> /// <param name="materialId">materialId</param> /// <param name="companyId">companyId</param> public void LoadByWorkIdAssetId(int materialId, int companyId) { AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGateway = new AssetSewerMHMaterialTypeGateway(Data); assetSewerMHMaterialTypeGateway.LoadByMaterialId(materialId, companyId); }
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_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; } }
protected void grdAddManholeNew_RowDataBound(object sender, GridViewRowEventArgs e) { // Edit controls if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))) { int companyId = Int32.Parse(hdfCompanyId.Value); int assetId = Int32.Parse(((Label)e.Row.FindControl("lblAssetID")).Text); AddManholeNewGateway addManholeNewGatewayForGrid = new AddManholeNewGateway(addManholeTDS); if (addManholeNewGatewayForGrid.Table.Rows.Count > 0) { ((DropDownList)e.Row.FindControl("ddlShapeEdit")).SelectedValue = addManholeNewGatewayForGrid.GetManholeShape(assetId); ((DropDownList)e.Row.FindControl("ddlLocationEdit")).SelectedValue = addManholeNewGatewayForGrid.GetLocation(assetId); ((DropDownList)e.Row.FindControl("ddlMaterialEdit")).SelectedValue = addManholeNewGatewayForGrid.GetMaterialID(assetId).ToString(); ((DropDownList)e.Row.FindControl("ddlRehabilitationDataRoundManholeRugsEdit")).SelectedValue = addManholeNewGatewayForGrid.GetManholeRugs(assetId).ToString(); ((DropDownList)e.Row.FindControl("ddlRehabilitationDataRectangularManholeRugsEdit")).SelectedValue = addManholeNewGatewayForGrid.GetManholeRugs(assetId).ToString(); ((DropDownList)e.Row.FindControl("ddlRehabilitationDataMixManholeRugsEdit")).SelectedValue = addManholeNewGatewayForGrid.GetManholeRugs(assetId).ToString(); if (addManholeNewGatewayForGrid.GetConditionRating(assetId).HasValue) { ((DropDownList)e.Row.FindControl("ddlConditioningRatingEdit")).SelectedValue = addManholeNewGatewayForGrid.GetConditionRating(assetId).ToString(); } else { ((DropDownList)e.Row.FindControl("ddlConditioningRatingEdit")).SelectedValue = "-1"; } } switch (addManholeNewGatewayForGrid.GetManholeShape(assetId)) { case "Round": ((Panel)e.Row.FindControl("pnlInformationRoundMHEdit")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationRectangularMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHEdit")).Visible = false; break; case "Rectangular": ((Panel)e.Row.FindControl("pnlInformationRoundMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHEdit")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationMixedMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHEdit")).Visible = false; break; case "Mixed": ((Panel)e.Row.FindControl("pnlInformationRoundMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHEdit")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationOtherMHEdit")).Visible = false; break; case "Other": ((Panel)e.Row.FindControl("pnlInformationRoundMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHEdit")).Visible = true; break; default: ((Panel)e.Row.FindControl("pnlInformationRoundMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHEdit")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHEdit")).Visible = false; break; }; } // Normal rows if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate)))) { int companyId = Int32.Parse(hdfCompanyId.Value); int assetId = Int32.Parse(((Label)e.Row.FindControl("lblAssetID")).Text); AddManholeNewGateway addManholeNewGatewayForGrid = new AddManholeNewGateway(addManholeTDS); if (addManholeNewGatewayForGrid.Table.Rows.Count > 0) { ((TextBox)e.Row.FindControl("tbxShape")).Text = addManholeNewGatewayForGrid.GetManholeShape(assetId); ((TextBox)e.Row.FindControl("tbxLocation")).Text = addManholeNewGatewayForGrid.GetLocation(assetId); if (addManholeNewGatewayForGrid.GetConditionRating(assetId).HasValue) { ((TextBox)e.Row.FindControl("tbxConditionRating")).Text = addManholeNewGatewayForGrid.GetConditionRating(assetId).ToString(); } else { ((TextBox)e.Row.FindControl("tbxConditionRating")).Text = ""; } int? materialId = addManholeNewGatewayForGrid.GetMaterialID(assetId); ((TextBox)e.Row.FindControl("tbxMaterial")).Text = ""; if (materialId.HasValue) { AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGateway = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGateway.LoadByMaterialId((int)materialId, companyId); string materialDescription = assetSewerMHMaterialTypeGateway.GetMaterialType((int)materialId); ((TextBox)e.Row.FindControl("tbxMaterial")).Text = materialDescription; } } switch (((TextBox)e.Row.FindControl("tbxShape")).Text) { case "Round": ((Panel)e.Row.FindControl("pnlInformationRoundMH")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationRectangularMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMH")).Visible = false; break; case "Rectangular": ((Panel)e.Row.FindControl("pnlInformationRoundMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMH")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationMixedMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMH")).Visible = false; break; case "Mixed": ((Panel)e.Row.FindControl("pnlInformationRoundMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMH")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationOtherMH")).Visible = false; break; case "Other": ((Panel)e.Row.FindControl("pnlInformationRoundMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMH")).Visible = true; break; default: ((Panel)e.Row.FindControl("pnlInformationRoundMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMH")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMH")).Visible = false; break; }; } // Footer rows if (e.Row.RowType == DataControlRowType.Footer) { switch (((DropDownList)e.Row.FindControl("ddlShapeAdd")).SelectedValue) { case "Round": ((Panel)e.Row.FindControl("pnlInformationRoundMHAdd")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationRectangularMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHAdd")).Visible = false; break; case "Rectangular": ((Panel)e.Row.FindControl("pnlInformationRoundMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHAdd")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationMixedMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHAdd")).Visible = false; break; case "Mixed": ((Panel)e.Row.FindControl("pnlInformationRoundMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHAdd")).Visible = true; ((Panel)e.Row.FindControl("pnlInformationOtherMHAdd")).Visible = false; break; case "Other": ((Panel)e.Row.FindControl("pnlInformationRoundMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHAdd")).Visible = true; break; default: ((Panel)e.Row.FindControl("pnlInformationRoundMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationRectangularMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationMixedMHAdd")).Visible = false; ((Panel)e.Row.FindControl("pnlInformationOtherMHAdd")).Visible = false; break; }; //int companyId = Int32.Parse(hdfCompanyId.Value); //string lastShape = ""; //// ... load last shape used at the grid //foreach (GridViewRow row in grdAddManholeNew.Rows) //{ // lastShape = ((TextBox)row.FindControl("tbxShape")).Text; //} //if (lastShape != "") //{ // ((DropDownList)e.Row.FindControl("ddlShapeAdd")).SelectedValue = lastShape; //} //else //{ // ((DropDownList)e.Row.FindControl("ddlShapeAdd")).SelectedIndex = 0; //} } }
private void LoadManholeGeneralDetailDate(int assetId, ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway) { // Load Manhole Details for header tbxManholeNumber.Text = manholeRehabilitationManholeDetailsGateway.GetMHID(assetId); tbxStreet.Text = manholeRehabilitationManholeDetailsGateway.GetAddress(assetId); tbxLongitude.Text = manholeRehabilitationManholeDetailsGateway.GetLongitude(assetId); tbxLatitude.Text = manholeRehabilitationManholeDetailsGateway.GetLatitud(assetId); tbxShape.Text = manholeRehabilitationManholeDetailsGateway.GetManholeShape(assetId); if (manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId).HasValue) { int companyId = Int32.Parse(hdfCompanyId.Value); int? materialId = manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId); AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGateway = new AssetSewerMHMaterialTypeGateway(); assetSewerMHMaterialTypeGateway.LoadByMaterialId((int)materialId, companyId); tbxMaterial.Text = assetSewerMHMaterialTypeGateway.GetMaterialType((int)materialId); } else { tbxMaterial.Text = ""; } tbxLocation.Text = manholeRehabilitationManholeDetailsGateway.GetLocation(assetId); tbxConditioningRating.Text = ""; if (manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId).HasValue) { tbxConditioningRating.Text = manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId).ToString(); } }