// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_ADMIN"]))) { 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)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in mr_batch_add.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfUpdate.Value = "no"; Session.Remove("mrBatchVerification"); Session.Remove("mrBatchVerificationDummy"); // Load information mrBatchVerificationTDS = new MrBatchVerificationTDS(); int companyId = Int32.Parse(hdfCompanyId.Value); MrBatchVerification mrBatchVerificationForLastRow = new MrBatchVerification(); mrBatchVerificationForLastRow.LoadLastBatch(companyId); if (mrBatchVerificationForLastRow.Table.Rows.Count > 0) { MrBatchVerificationGateway mrBatchVerificationGatewayForLastRow = new MrBatchVerificationGateway(mrBatchVerificationForLastRow.Data); WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); hdfBatchId.Value = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString(); int batchId = Int32.Parse(hdfBatchId.Value); DateTime date = mrBatchVerificationGatewayForLastRow.GetDate(batchId); hdfBatchDate.Value = date.Month.ToString() + "/" + date.Day.ToString() + "/" + date.Year.ToString(); hdfBatchDescription.Value = mrBatchVerificationGatewayForLastRow.GetDescription(batchId); } // ... Store datasets Session["mrBatchVerificationTDS"] = mrBatchVerificationTDS; Session["mrBatchVerification"] = mrBatchVerificationTDS.BatchValidation; // StepIn wizardBatch.ActiveStepIndex = 0; StepNewBatchIn(); } else { // Restore datasets mrBatchVerificationTDS = (MrBatchVerificationTDS)Session["mrBatchVerificationTDS"]; // Store Session["mrBatchVerification"] = mrBatchVerificationTDS.BatchValidation; } }
/// <summary> /// Save all batch to database (direct) /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { MrBatchVerificationTDS flBatchValidationChanges = (MrBatchVerificationTDS)Data.GetChanges(); if (flBatchValidationChanges != null) { if (flBatchValidationChanges.BatchValidation.Rows.Count > 0) { MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(flBatchValidationChanges); foreach (MrBatchVerificationTDS.BatchValidationRow row in (MrBatchVerificationTDS.BatchValidationDataTable)flBatchValidationChanges.BatchValidation) { // Insert new catalysts if ((!row.Deleted) && (!row.InDatabase)) { WorkManholeRehabilitationBatch workManholeRehabilitationBatch = new WorkManholeRehabilitationBatch(null); workManholeRehabilitationBatch.InsertDirect(row.BatchID, row.Description, row.Date, row.Deleted, row.COMPANY_ID); } //Update catalysts if ((!row.Deleted) && (row.InDatabase)) { int batchId = row.BatchID; bool originalDeleted = false; int originalCompanyId = companyId; //original values string originalDescription = mrBatchVerificationGateway.GetDescriptionOriginal(batchId); DateTime originalDate = mrBatchVerificationGateway.GetDateOriginal(batchId); // new values string newDescription = mrBatchVerificationGateway.GetDescription(batchId); DateTime newDate = mrBatchVerificationGateway.GetDate(batchId); WorkManholeRehabilitationBatch workManholeRehabilitationBatch = new WorkManholeRehabilitationBatch(null); workManholeRehabilitationBatch.UpdateDirect(batchId, originalDescription, originalDate, originalDeleted, originalCompanyId, batchId, newDescription, newDate, originalDeleted, originalCompanyId); } // Deleted catalysts if ((row.Deleted) && (row.InDatabase)) { WorkManholeRehabilitationBatch workManholeRehabilitationBatch = new WorkManholeRehabilitationBatch(null); workManholeRehabilitationBatch.DeleteDirect(row.BatchID, row.COMPANY_ID); } } } } }
protected void grdNewBatch_RowDataBound(object sender, GridViewRowEventArgs e) { // For dates at normal row if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate)))) { int batchId = Int32.Parse(((Label)e.Row.FindControl("lblBatchId")).Text); if (batchId > 0) { MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(mrBatchVerificationTDS); DateTime date = mrBatchVerificationGateway.GetDate(batchId); ((Label)e.Row.FindControl("lblDate")).Text = date.Month.ToString() + "/" + date.Day.ToString() + "/" + date.Year.ToString(); } } // For edit dates if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))) { int batchId = Int32.Parse(((Label)e.Row.FindControl("lblBatchIdEdit")).Text); if (batchId > 0) { MrBatchVerificationGateway MrBatchVerificationGateway = new MrBatchVerificationGateway(mrBatchVerificationTDS); DateTime date = MrBatchVerificationGateway.GetDate(batchId); ((RadDatePicker)e.Row.FindControl("tkrdpDateEdit")).SelectedDate = date; } } }
/// <summary> /// LoadByBatchId /// </summary> /// <param name="batchId">batchId</param> /// <param name="companyId">companyId</param> public void LoadByBatchId(int batchId,int companyId) { MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(Data); mrBatchVerificationGateway.LoadByBatchId(batchId, companyId); }
/// <summary> /// LoadLastBatch /// </summary> /// <param name="companyId">companyId</param> public void LoadLastBatch(int companyId) { MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(Data); mrBatchVerificationGateway.LoadLastBatch(companyId); }
/// <summary> /// SaveMHRehabWork /// </summary> /// <param name="projectId">projectId</param> /// <param name="mh_assetId">mh_assetId</param> /// <param name="companyId">companyId</param> private void SaveMHRehabWork(int projectId, int mh_assetId, int companyId) { MrBatchVerificationGateway mrBatchVerificationForLastBatch = new MrBatchVerificationGateway(); mrBatchVerificationForLastBatch.LoadLastBatch(companyId); int? batchId = null; if (mrBatchVerificationForLastBatch.Table.Rows.Count > 0) { WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); batchId = workManholeRehabilitationBatchGateway.GetLastId(companyId); } WorkManholeRehabilitation workManholeRehabilitation = new WorkManholeRehabilitation(null); workManholeRehabilitation.InsertDirectEmptyWorks(projectId, mh_assetId, null, null, batchId, false, companyId); }
/// <summary> /// Update /// </summary> /// <param name="workId">workId</param> /// <param name="preppedDate">preppedDate</param> /// <param name="sprayedDate">sprayedDate</param> /// <param name="batchId">batchId</param> /// <param name="date">date</param> /// <param name="companyId">companyId</param> public void Update(int workId, DateTime? preppedDate, DateTime? sprayedDate, int? batchId, DateTime date, int companyId) { WorkManholeRehabilitationGateway workManholeRehabilitationGatewayForReview = new WorkManholeRehabilitationGateway(); workManholeRehabilitationGatewayForReview.LoadByWorkId(workId, companyId); if (workManholeRehabilitationGatewayForReview.Table.Rows.Count > 0) { // Update work ManholeRehabilitationTDS.WorkDetailsRow row = GetRow(workId); if (preppedDate.HasValue) row.PreppedDate = (DateTime)preppedDate; else row.SetPreppedDateNull(); if (sprayedDate.HasValue) row.SprayedDate = (DateTime)sprayedDate; else row.SetSprayedDateNull(); row.Date = date; row.BatchID = (int)batchId; } else { // ... Insert work ManholeRehabilitationTDS.WorkDetailsRow lfsManholeRehabilitationRow = ((ManholeRehabilitationTDS.WorkDetailsDataTable)Table).NewWorkDetailsRow(); workId = GetNewId(); lfsManholeRehabilitationRow.WorkID = workId; if (preppedDate.HasValue) lfsManholeRehabilitationRow.PreppedDate = (DateTime)preppedDate; else lfsManholeRehabilitationRow.SetPreppedDateNull(); if (sprayedDate.HasValue) lfsManholeRehabilitationRow.SprayedDate = (DateTime)sprayedDate; else lfsManholeRehabilitationRow.SetSprayedDateNull(); lfsManholeRehabilitationRow.BatchID = 0; MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(); mrBatchVerificationGateway.LoadAll(companyId); if (mrBatchVerificationGateway.Table.Rows.Count > 0) { WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); lfsManholeRehabilitationRow.BatchID = workManholeRehabilitationBatchGateway.GetLastId(companyId); } else { lfsManholeRehabilitationRow.SetBatchIDNull(); } lfsManholeRehabilitationRow.Date = (DateTime)date; lfsManholeRehabilitationRow.Deleted = false; lfsManholeRehabilitationRow.COMPANY_ID = companyId; ((ManholeRehabilitationTDS.WorkDetailsDataTable)Table).AddWorkDetailsRow(lfsManholeRehabilitationRow); } }
private void Save() { // Validate data bool validData = true; validData = ValidatePage(); if (validData) { // Save data int companyId = Int32.Parse(hdfCompanyId.Value); int assetId = Int32.Parse(hdfAssetId.Value); int workId = Int32.Parse(hdfWorkId.Value); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString()); // Get Manhole information // ... ManholeRehabilitationManholeDetails data string newAddress = ""; if (tbxStreet.Text != "") newAddress = tbxStreet.Text.Trim(); string newLatitude = ""; if (tbxLatitude.Text != "") newLatitude = tbxLatitude.Text.Trim(); string newLongitude = ""; if (tbxLongitude.Text != "") newLongitude = tbxLongitude.Text.Trim(); string newShape = ""; if (ddlShape.SelectedValue != "") newShape = ddlShape.SelectedValue; int? newConditionRating = null; if (ddlConditioningRating.SelectedValue != "-1") newConditionRating = int.Parse(ddlConditioningRating.SelectedValue); int? newMaterialId = null; if (ddlMaterial.SelectedValue != "-1") newMaterialId = int.Parse(ddlMaterial.SelectedValue); string newMaterialDescription = ""; if (ddlMaterial.SelectedValue != "") newMaterialDescription = ddlMaterial.Text; string newLocation = ""; if (ddlLocation.SelectedValue != "") newLocation = ddlLocation.SelectedValue; string newTopDiameter = ""; string newTopDepth = ""; string newTopFloor = ""; string newTopCeiling = ""; string newTopBenching = ""; string newDownDiameter = ""; string newDownDepth = ""; string newDownFloor = ""; string newDownCeiling = ""; string newDownBenching = ""; string newRectangle1LongSide = ""; string newRectangle1ShortSide = ""; string newRectangle2LongSide = ""; string newRectangle2ShortSide = ""; string newTopSurfaceArea = ""; string newDownSurfaceArea = ""; int? newManholeRugs = null; string newTotalDepth = ""; string newTotalSurfaceArea = ""; // ... Structure Details if (newShape == "Round") { if (tbxRehabilitationDataChimneyDiameter.Text != "") newTopDiameter = tbxRehabilitationDataChimneyDiameter.Text.Trim(); if (tbxRehabilitationDataChimneyDepth.Text != "") newTopDepth = tbxRehabilitationDataChimneyDepth.Text.Trim(); if (tbxRehabilitationDataChimneyFloor.Text != "") newTopFloor = tbxRehabilitationDataChimneyFloor.Text.Trim(); if (tbxRehabilitationDataChimneyCeiling.Text != "") newTopCeiling = tbxRehabilitationDataChimneyCeiling.Text.Trim(); if (tbxRehabilitationDataChimneyBenching.Text != "") newTopBenching = tbxRehabilitationDataChimneyBenching.Text.Trim(); if (tbxRehabilitationDataChimneySurfaceArea.Text != "") newTopSurfaceArea = tbxRehabilitationDataChimneySurfaceArea.Text.Trim(); if (tbxRehabilitationDataBarrelDiameter.Text != "") newDownDiameter = tbxRehabilitationDataBarrelDiameter.Text.Trim(); if (tbxRehabilitationDataBarrelDepth.Text != "") newDownDepth = tbxRehabilitationDataBarrelDepth.Text.Trim(); if (tbxRehabilitationDataBarrelFloor.Text != "") newDownFloor = tbxRehabilitationDataBarrelFloor.Text.Trim(); if (tbxRehabilitationDataBarrelCeiling.Text != "") newDownCeiling = tbxRehabilitationDataBarrelCeiling.Text.Trim(); if (tbxRehabilitationDataBarrelBenching.Text != "") newDownBenching = tbxRehabilitationDataBarrelBenching.Text.Trim(); if (tbxRehabilitationDataBarrelSurfaceArea.Text !="") newDownSurfaceArea = tbxRehabilitationDataBarrelSurfaceArea.Text.Trim(); if (ddlRehabilitationDataRoundManholeRugs.SelectedValue != "-1") newManholeRugs = int.Parse( ddlRehabilitationDataRoundManholeRugs.SelectedValue); if (tbxRehabilitationDataRoundTotalDepth.Text != "") newTotalDepth = tbxRehabilitationDataRoundTotalDepth.Text.Trim(); if (tbxRehabilitationDataRoundTotalSurfaceArea.Text !="") newTotalSurfaceArea = tbxRehabilitationDataRoundTotalSurfaceArea.Text.Trim(); } if (newShape == "Rectangular") { if (tbxRehabilitationDataRectangle1LongSide.Text != "") newRectangle1LongSide = tbxRehabilitationDataRectangle1LongSide.Text.Trim(); if (tbxRehabilitationDataRectangle1ShortSide.Text != "") newRectangle1ShortSide = tbxRehabilitationDataRectangle1ShortSide.Text.Trim(); if (tbxRehabilitationDataRectangle1Depth.Text !="") newTopDepth = tbxRehabilitationDataRectangle1Depth.Text.Trim(); if (tbxRehabilitationDataRectangle1Floor.Text !="") newTopFloor = tbxRehabilitationDataRectangle1Floor.Text.Trim(); if (tbxRehabilitationDataRectangle1Ceiling.Text !="") newTopCeiling = tbxRehabilitationDataRectangle1Ceiling.Text.Trim(); if (tbxRehabilitationDataRectangle1Benching.Text !="")newTopBenching = tbxRehabilitationDataRectangle1Benching.Text.Trim(); if (tbxRehabilitationDataRectangle1SurfaceArea.Text != "") newTopSurfaceArea = tbxRehabilitationDataRectangle1SurfaceArea.Text.Trim(); if (tbxRehabilitationDataRectangle2LongSide.Text != "") newRectangle2LongSide = tbxRehabilitationDataRectangle2LongSide.Text.Trim(); if (tbxRehabilitationDataRectangle2ShortSide.Text != "") newRectangle2ShortSide = tbxRehabilitationDataRectangle2ShortSide.Text.Trim(); if (tbxRehabilitationDataRectangle2Depth.Text !="") newDownDepth = tbxRehabilitationDataRectangle2Depth.Text.Trim(); if (tbxRehabilitationDataRectangle2Floor.Text !="") newDownFloor = tbxRehabilitationDataRectangle2Floor.Text.Trim(); if (tbxRehabilitationDataRectangle2Ceiling.Text !="") newDownCeiling = tbxRehabilitationDataRectangle2Ceiling.Text.Trim(); if (tbxRehabilitationDataRectangle2Benching.Text != "") newDownBenching = tbxRehabilitationDataRectangle2Benching.Text.Trim(); if (tbxRehabilitationDataRectangle2SurfaceArea.Text != "") newDownSurfaceArea = tbxRehabilitationDataRectangle2SurfaceArea.Text.Trim(); if (ddlRehabilitationDataRectangularManholeRugs.SelectedValue != "-1") newManholeRugs = int.Parse( ddlRehabilitationDataRectangularManholeRugs.SelectedValue); if (tbxRehabilitationDataRectangularTotalDepth.Text != "") newTotalDepth = tbxRehabilitationDataRectangularTotalDepth.Text.Trim(); if (tbxRehabilitationDataRectangularTotalSurfaceArea.Text !="") newTotalSurfaceArea = tbxRehabilitationDataRectangularTotalSurfaceArea.Text.Trim(); } if (newShape == "Mixed") { if (tbxRehabilitationDataRoundDiameter.Text != "") newTopDiameter = tbxRehabilitationDataRoundDiameter.Text.Trim(); if (tbxRehabilitationDataRoundDepth.Text != "") newTopDepth = tbxRehabilitationDataRoundDepth.Text.Trim(); if (tbxRehabilitationDataRoundFloor.Text != "") newTopFloor = tbxRehabilitationDataRoundFloor.Text.Trim(); if (tbxRehabilitationDataRoundCeiling.Text != "") newTopCeiling = tbxRehabilitationDataRoundCeiling.Text.Trim(); if (tbxRehabilitationDataRoundBenching.Text != "") newTopBenching = tbxRehabilitationDataRoundBenching.Text.Trim(); if (tbxRehabilitationDataRoundSurfaceArea.Text != "") newTopSurfaceArea = tbxRehabilitationDataRoundSurfaceArea.Text.Trim(); if (tbxRehabilitationDataRectangleLongSide.Text != "") newRectangle2LongSide = tbxRehabilitationDataRectangleLongSide.Text.Trim(); if (tbxRehabilitationDataRectangleShortSide.Text != "") newRectangle2ShortSide = tbxRehabilitationDataRectangleShortSide.Text.Trim(); if (tbxRehabilitationDataRectangleDepth.Text != "") newDownDepth = tbxRehabilitationDataRectangleDepth.Text.Trim(); if (tbxRehabilitationDataRectangleFloor.Text != "") newDownFloor = tbxRehabilitationDataRectangleFloor.Text.Trim(); if (tbxRehabilitationDataRectangleCeiling.Text != "") newDownCeiling = tbxRehabilitationDataRectangleCeiling.Text.Trim(); if (tbxRehabilitationDataRectangleBenching.Text != "") newDownBenching = tbxRehabilitationDataRectangleBenching.Text.Trim(); if (tbxRehabilitationDataRectangleSufaceArea.Text != "") newDownSurfaceArea = tbxRehabilitationDataRectangleSufaceArea.Text.Trim(); if (ddlRehabilitationDataMixManholeRugs.SelectedValue != "-1") newManholeRugs = int.Parse(ddlRehabilitationDataMixManholeRugs.SelectedValue); if (tbxRehabilitationDataMixedTotalDepth.Text != "") newTotalDepth = tbxRehabilitationDataMixedTotalDepth.Text.Trim(); if (tbxRehabilitationDataMixedTotalSurfaceArea.Text != "") newTotalSurfaceArea = tbxRehabilitationDataMixedTotalSurfaceArea.Text.Trim(); } if (newShape == "Other") { if (tbxRehabilitationDataOtherStructure.Text !="") newTotalSurfaceArea = tbxRehabilitationDataOtherStructure.Text.Trim(); } // Update manhole details ManholeRehabilitationManholeDetails manholeRehabilitationManholeDetails = new ManholeRehabilitationManholeDetails(manholeRehabilitationTDS); manholeRehabilitationManholeDetails.Update(assetId, newLongitude, newLatitude, newAddress, newShape, newLocation, newMaterialId, newTopDiameter, newTopDepth, newTopFloor, newTopCeiling, newTopBenching, newDownDiameter, newDownDepth, newDownFloor, newDownCeiling, newDownBenching, newRectangle1LongSide, newRectangle1ShortSide, newRectangle2LongSide, newRectangle2ShortSide, newTopSurfaceArea, newDownSurfaceArea, newManholeRugs, newTotalDepth, newTotalSurfaceArea, newConditionRating, newMaterialDescription); // Get manhole work inforamtion DateTime? newPreppedDate = null; if (tkrdpRehabilitationPreppedDate.SelectedDate.HasValue) newPreppedDate = (DateTime)tkrdpRehabilitationPreppedDate.SelectedDate; DateTime? newSprayedDate = null; if (tkrdpRehabilitationSprayedDate.SelectedDate.HasValue) newSprayedDate = (DateTime)tkrdpRehabilitationSprayedDate.SelectedDate; int newBatchId = Int32.Parse(ddlRehabilitationBatchDate.SelectedValue);//TODO MH MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(); mrBatchVerificationGateway.LoadByBatchId(newBatchId, companyId); DateTime newBatchDate = mrBatchVerificationGateway.GetDate(newBatchId); hdfBatchId.Value = newBatchId.ToString(); // ... Update work details ManholeRehabilitationWorkDetails manholeRehabilitationWorkDetails = new ManholeRehabilitationWorkDetails(manholeRehabilitationTDS); manholeRehabilitationWorkDetails.Update(workId, newPreppedDate, newSprayedDate, newBatchId , newBatchDate, companyId); // Store datasets Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS; // Update database UpdateDatabase(); ViewState["update"] = "yes"; // Redirect string url = ""; if (Request.QueryString["source_page"] == "mr_navigator2.aspx") { url = "./mr_navigator2.aspx?source_page=mr_edit.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + "&in_project=" + hdfInProject.Value + GetNavigatorState() + "&update=yes"; } if (Request.QueryString["source_page"] == "mr_summary.aspx") { string activeTab = hdfActiveTab.Value; url = "./mr_summary.aspx?source_page=mr_edit.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + "&asset_id=" + hdfAssetId.Value + "&in_project=" + hdfInProject.Value + "&active_tab=" + activeTab + GetNavigatorState() + "&update=yes"; } Response.Redirect(url); } }
private void Save2() { //Save changes without validate // Save data int companyId = Int32.Parse(hdfCompanyId.Value); int assetId = Int32.Parse(hdfAssetId.Value); int workId = Int32.Parse(hdfWorkId.Value); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString()); // Get Manhole information // ... ManholeRehabilitationManholeDetails data string newAddress = ""; if (tbxStreet.Text != "") newAddress = tbxStreet.Text.Trim(); string newLatitude = ""; if (tbxLatitude.Text != "") newLatitude = tbxLatitude.Text.Trim(); string newLongitude = ""; if (tbxLongitude.Text != "") newLongitude = tbxLongitude.Text.Trim(); string newShape = ""; if (ddlShape.SelectedValue != "") newShape = ddlShape.SelectedValue; int? newConditionRating = null; if (ddlConditioningRating.SelectedValue != "-1") newConditionRating = int.Parse(ddlConditioningRating.SelectedValue); int? newMaterialId = null; if (ddlMaterial.SelectedValue != "-1") newMaterialId = int.Parse(ddlMaterial.SelectedValue); string newMaterialDescription = ""; if (ddlMaterial.Text != "") newMaterialDescription = ddlMaterial.Text; string newLocation = ""; if (ddlLocation.SelectedValue != "") newLocation = ddlLocation.SelectedValue; string newTopDiameter = ""; string newTopDepth = ""; string newTopFloor = ""; string newTopCeiling = ""; string newTopBenching = ""; string newDownDiameter = ""; string newDownDepth = ""; string newDownFloor = ""; string newDownCeiling = ""; string newDownBenching = ""; string newRectangle1LongSide = ""; string newRectangle1ShortSide = ""; string newRectangle2LongSide = ""; string newRectangle2ShortSide = ""; string newTopSurfaceArea = ""; string newDownSurfaceArea = ""; int? newManholeRugs = null; string newTotalDepth = ""; string newTotalSurfaceArea = ""; // ... Structure Details if (newShape == "Round") { if (tbxRehabilitationDataChimneyDiameter.Text != "") newTopDiameter = tbxRehabilitationDataChimneyDiameter.Text.Trim(); if (tbxRehabilitationDataChimneyDepth.Text != "") newTopDepth = tbxRehabilitationDataChimneyDepth.Text.Trim(); if (tbxRehabilitationDataChimneyFloor.Text != "") newTopFloor = tbxRehabilitationDataChimneyFloor.Text.Trim(); if (tbxRehabilitationDataChimneyCeiling.Text != "") newTopCeiling = tbxRehabilitationDataChimneyCeiling.Text.Trim(); if (tbxRehabilitationDataChimneyBenching.Text != "") newTopBenching = tbxRehabilitationDataChimneyBenching.Text.Trim(); if (tbxRehabilitationDataChimneySurfaceArea.Text != "") newTopSurfaceArea = tbxRehabilitationDataChimneySurfaceArea.Text.Trim(); if (tbxRehabilitationDataBarrelDiameter.Text != "") newDownDiameter = tbxRehabilitationDataBarrelDiameter.Text.Trim(); if (tbxRehabilitationDataBarrelDepth.Text != "") newDownDepth = tbxRehabilitationDataBarrelDepth.Text.Trim(); if (tbxRehabilitationDataBarrelFloor.Text != "") newDownFloor = tbxRehabilitationDataBarrelFloor.Text.Trim(); if (tbxRehabilitationDataBarrelCeiling.Text != "") newDownCeiling = tbxRehabilitationDataBarrelCeiling.Text.Trim(); if (tbxRehabilitationDataBarrelBenching.Text != "") newDownBenching = tbxRehabilitationDataBarrelBenching.Text.Trim(); if (tbxRehabilitationDataBarrelSurfaceArea.Text != "") newDownSurfaceArea = tbxRehabilitationDataBarrelSurfaceArea.Text.Trim(); if (ddlRehabilitationDataRoundManholeRugs.SelectedValue != "-1") newManholeRugs = int.Parse(ddlRehabilitationDataRoundManholeRugs.SelectedValue); if (tbxRehabilitationDataRoundTotalDepth.Text != "") newTotalDepth = tbxRehabilitationDataRoundTotalDepth.Text.Trim(); if (tbxRehabilitationDataRoundTotalSurfaceArea.Text != "") newTotalSurfaceArea = tbxRehabilitationDataRoundTotalSurfaceArea.Text.Trim(); } if (newShape == "Rectangular") { if (tbxRehabilitationDataRectangle1LongSide.Text != "") newRectangle1LongSide = tbxRehabilitationDataRectangle1LongSide.Text.Trim(); if (tbxRehabilitationDataRectangle1ShortSide.Text != "") newRectangle1ShortSide = tbxRehabilitationDataRectangle1ShortSide.Text.Trim(); if (tbxRehabilitationDataRectangle1Depth.Text != "") newTopDepth = tbxRehabilitationDataRectangle1Depth.Text.Trim(); if (tbxRehabilitationDataRectangle1Floor.Text != "") newTopFloor = tbxRehabilitationDataRectangle1Floor.Text.Trim(); if (tbxRehabilitationDataRectangle1Ceiling.Text != "") newTopCeiling = tbxRehabilitationDataRectangle1Ceiling.Text.Trim(); if (tbxRehabilitationDataRectangle1Benching.Text != "") newTopBenching = tbxRehabilitationDataRectangle1Benching.Text.Trim(); if (tbxRehabilitationDataRectangle1SurfaceArea.Text != "") newTopSurfaceArea = tbxRehabilitationDataRectangle1SurfaceArea.Text.Trim(); if (tbxRehabilitationDataRectangle2LongSide.Text != "") newRectangle2LongSide = tbxRehabilitationDataRectangle2LongSide.Text.Trim(); if (tbxRehabilitationDataRectangle2ShortSide.Text != "") newRectangle2ShortSide = tbxRehabilitationDataRectangle2ShortSide.Text.Trim(); if (tbxRehabilitationDataRectangle2Depth.Text != "") newDownDepth = tbxRehabilitationDataRectangle2Depth.Text.Trim(); if (tbxRehabilitationDataRectangle2Floor.Text != "") newDownFloor = tbxRehabilitationDataRectangle2Floor.Text.Trim(); if (tbxRehabilitationDataRectangle2Ceiling.Text != "") newDownCeiling = tbxRehabilitationDataRectangle2Ceiling.Text.Trim(); if (tbxRehabilitationDataRectangle2Benching.Text != "") newDownBenching = tbxRehabilitationDataRectangle2Benching.Text.Trim(); if (tbxRehabilitationDataRectangle2SurfaceArea.Text != "") newDownSurfaceArea = tbxRehabilitationDataRectangle2SurfaceArea.Text.Trim(); if (ddlRehabilitationDataRectangularManholeRugs.SelectedValue != "-1") newManholeRugs = int.Parse(ddlRehabilitationDataRectangularManholeRugs.SelectedValue); if (tbxRehabilitationDataRectangularTotalDepth.Text != "") newTotalDepth = tbxRehabilitationDataRectangularTotalDepth.Text.Trim(); if (tbxRehabilitationDataRectangularTotalSurfaceArea.Text != "") newTotalSurfaceArea = tbxRehabilitationDataRectangularTotalSurfaceArea.Text.Trim(); } if (newShape == "Mixed") { if (tbxRehabilitationDataRoundDiameter.Text != "") newTopDiameter = tbxRehabilitationDataRoundDiameter.Text.Trim(); if (tbxRehabilitationDataRoundDepth.Text != "") newTopDepth = tbxRehabilitationDataRoundDepth.Text.Trim(); if (tbxRehabilitationDataRoundFloor.Text != "") newTopFloor = tbxRehabilitationDataRoundFloor.Text.Trim(); if (tbxRehabilitationDataRoundCeiling.Text != "") newTopCeiling = tbxRehabilitationDataRoundCeiling.Text.Trim(); if (tbxRehabilitationDataRoundBenching.Text != "") newTopBenching = tbxRehabilitationDataRoundBenching.Text.Trim(); if (tbxRehabilitationDataRoundSurfaceArea.Text != "") newTopSurfaceArea = tbxRehabilitationDataRoundSurfaceArea.Text.Trim(); if (tbxRehabilitationDataRectangleLongSide.Text != "") newRectangle2LongSide = tbxRehabilitationDataRectangleLongSide.Text.Trim(); if (tbxRehabilitationDataRectangleShortSide.Text != "") newRectangle2ShortSide = tbxRehabilitationDataRectangleShortSide.Text.Trim(); if (tbxRehabilitationDataRectangleDepth.Text != "") newDownDepth = tbxRehabilitationDataRectangleDepth.Text.Trim(); if (tbxRehabilitationDataRectangleFloor.Text != "") newDownFloor = tbxRehabilitationDataRectangleFloor.Text.Trim(); if (tbxRehabilitationDataRectangleCeiling.Text != "") newDownCeiling = tbxRehabilitationDataRectangleCeiling.Text.Trim(); if (tbxRehabilitationDataRectangleBenching.Text != "") newDownBenching = tbxRehabilitationDataRectangleBenching.Text.Trim(); if (tbxRehabilitationDataRectangleSufaceArea.Text != "") newDownSurfaceArea = tbxRehabilitationDataRectangleSufaceArea.Text.Trim(); if (ddlRehabilitationDataMixManholeRugs.SelectedValue != "-1") newManholeRugs = int.Parse(ddlRehabilitationDataRectangularManholeRugs.SelectedValue); if (tbxRehabilitationDataRectangularTotalDepth.Text != "") newTotalDepth = tbxRehabilitationDataRectangularTotalDepth.Text.Trim(); if (tbxRehabilitationDataRectangularTotalSurfaceArea.Text != "") newTotalSurfaceArea = tbxRehabilitationDataRectangularTotalSurfaceArea.Text.Trim(); } if (newShape == "Other") { if (tbxRehabilitationDataOtherStructure.Text != "") newTotalSurfaceArea = tbxRehabilitationDataOtherStructure.Text.Trim(); } // Update manhole details ManholeRehabilitationManholeDetails manholeRehabilitationManholeDetails = new ManholeRehabilitationManholeDetails(manholeRehabilitationTDS); manholeRehabilitationManholeDetails.Update(assetId, newLongitude, newLatitude, newAddress, newShape, newLocation, newMaterialId, newTopDiameter, newTopDepth, newTopFloor, newTopCeiling, newTopBenching, newDownDiameter, newDownDepth, newDownFloor, newDownCeiling, newDownBenching, newRectangle1LongSide, newRectangle1ShortSide, newRectangle2LongSide, newRectangle2ShortSide, newTopSurfaceArea, newDownSurfaceArea, newManholeRugs, newTotalDepth, newTotalSurfaceArea, newConditionRating, newMaterialDescription); // Get manhole work inforamtion DateTime? newPreppedDate = null; if (tkrdpRehabilitationPreppedDate.SelectedDate.HasValue) newPreppedDate = (DateTime)tkrdpRehabilitationPreppedDate.SelectedDate; DateTime? newSprayedDate = null; if (tkrdpRehabilitationSprayedDate.SelectedDate.HasValue) newSprayedDate = (DateTime)tkrdpRehabilitationSprayedDate.SelectedDate; int newBatchId = Int32.Parse(ddlRehabilitationBatchDate.SelectedValue);///TODO MH MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(); mrBatchVerificationGateway.LoadByBatchId(newBatchId, companyId); DateTime newBatchDate = mrBatchVerificationGateway.GetDate(newBatchId); hdfBatchId.Value = newBatchId.ToString(); // ... Update work details ManholeRehabilitationWorkDetails manholeRehabilitationWorkDetails = new ManholeRehabilitationWorkDetails(manholeRehabilitationTDS); manholeRehabilitationWorkDetails.Update(workId, newPreppedDate, newSprayedDate, newBatchId, newBatchDate, companyId); // Store datasets Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS; ViewState["update"] = "no"; }
private void LoadWorkData(int workId, int assetId) { int companyId = Int32.Parse(hdfCompanyId.Value); if (workId != 0) { ManholeRehabilitationWorkDetailsGateway manholeRehabilitationWorkDetailsGateway = new ManholeRehabilitationWorkDetailsGateway(manholeRehabilitationTDS); if (manholeRehabilitationWorkDetailsGateway.Table.Rows.Count > 0) { if (manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId).HasValue) { DateTime preppedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId); tkrdpRehabilitationPreppedDate.SelectedDate = DateTime.Parse(preppedDate.Month.ToString() + "/" + preppedDate.Day.ToString() + "/" + preppedDate.Year.ToString()); } if (manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId).HasValue) { DateTime sprayedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId); tkrdpRehabilitationSprayedDate.SelectedDate = DateTime.Parse(sprayedDate.Month.ToString() + "/" + sprayedDate.Day.ToString() + "/" + sprayedDate.Year.ToString()); } if (manholeRehabilitationWorkDetailsGateway.GetDate(workId).HasValue) { //Load saved batch int batchId = (manholeRehabilitationWorkDetailsGateway.GetBatchID(workId)); ddlRehabilitationBatchDate.SelectedValue = batchId.ToString(); hdfExistBatchId.Value = "True"; hdfBatchId.Value = batchId.ToString(); } else { ddlRehabilitationBatchDate.SelectedValue = "0"; hdfExistBatchId.Value = "False"; } // Show Comments tbxCommentsDataComments.Text = manholeRehabilitationWorkDetailsGateway.GetComments(workId); // ... ... Store datasets Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS; } } // Load last batch MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(); mrBatchVerificationGateway.LoadAll(companyId); if (mrBatchVerificationGateway.Table.Rows.Count > 0) { WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); hdfBatchId.Value = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString(); int batchId = Int32.Parse(hdfBatchId.Value); mrBatchVerificationGateway.LoadByBatchId(batchId, companyId); DateTime batchDate = mrBatchVerificationGateway.GetDate(batchId); tbxLastRehabilitationBatchDate.Text = batchDate.Month.ToString() + "/" + batchDate.Day.ToString() + "/" + batchDate.Year.ToString(); lblBatchDateRequired.Visible = false; // ... ... Store datasets Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS; } else { lblBatchDateRequired.Visible = true; } }
protected void tkrdpRehabilitationSprayedDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) { if (hdfExistBatchId.Value == "False") { if (tkrdpRehabilitationSprayedDate.SelectedDate.HasValue) { int companyId = Int32.Parse(hdfCompanyId.Value); MrBatchVerificationGateway mrBatchVerificationForLastBatch = new MrBatchVerificationGateway(); mrBatchVerificationForLastBatch.LoadLastBatch(companyId); if (mrBatchVerificationForLastBatch.Table.Rows.Count > 0) { WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); ddlRehabilitationBatchDate.SelectedValue = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString(); } } else { ddlRehabilitationBatchDate.SelectedValue = "0"; } } }
protected void ddlRehabilitationBatchDate_SelectedIndexChanged(object sender, EventArgs e) { // Get last batch id int companyId = Int32.Parse(hdfCompanyId.Value); int lastBatchId = 0; MrBatchVerificationGateway mrBatchVerificationForLastBatch = new MrBatchVerificationGateway(); mrBatchVerificationForLastBatch.LoadLastBatch(companyId); if (mrBatchVerificationForLastBatch.Table.Rows.Count > 0) { WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); lastBatchId = workManholeRehabilitationBatchGateway.GetLastId(companyId); } lblNotLastBatch.Visible = false; if (ddlRehabilitationBatchDate.SelectedValue != lastBatchId.ToString()) { lblNotLastBatch.Visible = true; } }
// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP1 - BEGIN // // //////////////////////////////////////////////////////////////////////// // STEP - BEGIN - AUXILIAR EVENTS // protected void StartBatch_OnCheckedChanged(object sender, EventArgs e) { if (rbtnUseLastBatch.Checked) { int companyId = Int32.Parse(hdfCompanyId.Value); MrBatchVerification mrBatchVerificationForLastRow = new MrBatchVerification(mrBatchVerificationTDS); mrBatchVerificationForLastRow.LoadLastBatch(companyId); if (mrBatchVerificationForLastRow.Table.Rows.Count > 0) { MrBatchVerificationGateway mrBatchVerificationGatewayForLastRow = new MrBatchVerificationGateway(mrBatchVerificationForLastRow.Data); WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); hdfBatchId.Value = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString(); int batchId = Int32.Parse(hdfBatchId.Value); DateTime date = mrBatchVerificationGatewayForLastRow.GetDate(batchId); hdfBatchDate.Value = date.Month.ToString() + "/" + date.Day.ToString() + "/" + date.Year.ToString(); hdfBatchDescription.Value = mrBatchVerificationGatewayForLastRow.GetDescription(batchId); // Show messages at wizard lblBatchIdWarning.Visible = false; lblBatchLast.Visible = true; lblBatchLast.Text = "Last Batch used: " + hdfBatchDate.Value + " " + hdfBatchDescription.Value; } else { lblBatchIdWarning.Visible = true; lblBatchLast.Visible = false; } } if (rbtnUseNewBatch.Checked) { lblBatchIdWarning.Visible = false; lblBatchLast.Visible = false; } }
private void LoadWorkData(int workId, int assetId) { int companyId = Int32.Parse(hdfCompanyId.Value); if (workId != 0) { ManholeRehabilitationWorkDetailsGateway manholeRehabilitationWorkDetailsGateway = new ManholeRehabilitationWorkDetailsGateway(manholeRehabilitationTDS); if (manholeRehabilitationWorkDetailsGateway.Table.Rows.Count > 0) { tbxRehabilitationPreppedDate.Text = ""; if (manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId).HasValue) { DateTime preppedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId); tbxRehabilitationPreppedDate.Text = preppedDate.Month.ToString() + "/" + preppedDate.Day.ToString() + "/" + preppedDate.Year.ToString(); } tbxRehabilitationSprayedDate.Text = ""; if (manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId).HasValue) { DateTime sprayedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId); tbxRehabilitationSprayedDate.Text = sprayedDate.Month.ToString() + "/" + sprayedDate.Day.ToString() + "/" + sprayedDate.Year.ToString(); } tbxRehabilitationBatchDate.Text = ""; if (manholeRehabilitationWorkDetailsGateway.GetDate(workId).HasValue) { try { DateTime batchDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetDate(workId); tbxRehabilitationBatchDate.Text = batchDate.Month.ToString() + "/" + batchDate.Day.ToString() + "/" + batchDate.Year.ToString(); hdfBatchId.Value = manholeRehabilitationWorkDetailsGateway.GetBatchID(workId).ToString(); } catch { } } // Show Comments tbxCommentsDataComments.Text = manholeRehabilitationWorkDetailsGateway.GetComments(workId); // ... ... Store datasets Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS; } } else { // Load last batch MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(); mrBatchVerificationGateway.LoadAll(companyId); if (mrBatchVerificationGateway.Table.Rows.Count > 0) { WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); hdfBatchId.Value = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString(); int batchId = Int32.Parse(hdfBatchId.Value); mrBatchVerificationGateway.LoadByBatchId(batchId, companyId); DateTime batchDate = mrBatchVerificationGateway.GetDate(batchId); tbxRehabilitationBatchDate.Text = batchDate.Month.ToString() + "/" + batchDate.Day.ToString() + "/" + batchDate.Year.ToString(); // ... ... Store datasets Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS; } } }