private void UpdateDatabase() { // Get ids & location int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim()); ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); Int64 countryId = projectGateway.GetCountryID(projectId); Int64? provinceId = null; if (projectGateway.GetProvinceID(projectId).HasValue) provinceId = (Int64)projectGateway.GetProvinceID(projectId); Int64? countyId = null; if (projectGateway.GetCountyID(projectId).HasValue) countyId = (Int64)projectGateway.GetCountyID(projectId); Int64? cityId = null; if (projectGateway.GetCityID(projectId).HasValue) cityId = (Int64)projectGateway.GetCityID(projectId); string workType = hdfWorkType.Value.Trim(); int companyId = Int32.Parse(hdfCompanyId.Value); int workId = Int32.Parse(hdfWorkId.Value); int sectionAssetId = Int32.Parse(hdfAssetId.Value); bool isNewMeasuredFromDsmh = false; FullLengthLiningLateralDetails flLateralDetails = new FullLengthLiningLateralDetails(); flLateralDetails.LoadForEdit(workId, sectionAssetId, companyId, projectId); if (flLateralDetails.Table.Rows.Count == 0) { if (ddlM1DataMeasuredFromMh.SelectedValue == "DSMH") { isNewMeasuredFromDsmh = true; FullLengthLiningLateralDetails fllLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS); fllLateralDetails.ModifyLateralId(); } } DB.Open(); DB.BeginTransaction(); try { // Save lateral details // Save lateral details bool roboticPrepCompleted = ckbxPrepDataRoboticPrepCompleted.Checked; DateTime? roboticPrepCompletedCompleted = null; if (tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.HasValue) roboticPrepCompletedCompleted = tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.Value; FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS); fullLengthLiningLateralDetails.Save(workId, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, tbxVideoLength.Text.Trim(), companyId, isNewMeasuredFromDsmh, roboticPrepCompleted, roboticPrepCompletedCompleted); // Save catalyst details string newRunDetails = ""; foreach (ListItem lst in cbxlSectionId.Items) { if (lst.Selected) { newRunDetails = newRunDetails + lst.Value + ">"; } } newRunDetails = newRunDetails.Substring(0, newRunDetails.Length - 1); FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS); fullLengthLiningWetOutCatalystsDetails.Save(companyId, newRunDetails, projectId); // Save section details FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS); fullLengthLiningSectionDetails.Save(countryId, provinceId, countyId, cityId, projectId, companyId); // Save work details FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS); fullLengthLiningWorkDetails.Save(countryId, provinceId, countyId, cityId, projectId, sectionAssetId, companyId, ckbxWetOutDataIncludeWetOutInformation.Checked, ckbxInversionDataIncludeInversionInformation.Checked); // Save material details string newMaterial = ddlM1DataMaterial.SelectedValue; if (ddlM1DataMaterial.SelectedIndex > 0) { LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null); if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(sectionAssetId, newMaterial, companyId)) { MaterialInformation materialInformation = new MaterialInformation(materialInformationTDS); materialInformation.Save(companyId); } } DB.CommitTransaction(); // Store datasets fullLengthLiningTDS.AcceptChanges(); Session["fullLengthLiningTDS"] = fullLengthLiningTDS; materialInformationTDS.AcceptChanges(); Session["materialInformationTDS"] = materialInformationTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void Save2() { //Save changes without validate // Laterals Gridview // ... If the gridview is edition mode if (grdLaterals.EditIndex >= 0) { grdLaterals.UpdateRow(grdLaterals.EditIndex, true); } // Save Lateral data GrdFLAddLateralsNewAdd(); // Catalysts Gridview if (ckbxWetOutDataIncludeWetOutInformation.Checked) { // ... If the gridview is edition mode if (grdCatalysts.EditIndex >= 0) { grdCatalysts.UpdateRow(grdCatalysts.EditIndex, true); } // Save Lateral data GrdCatalystsAdd(); } // 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 Section Details // ... FullLengthLiningSectionDetails data string newStreet = ""; if (tbxStreet.Text != "") newStreet = tbxStreet.Text.Trim(); string newUsmh = ""; if (tbxUSMH.Text != "") newUsmh = tbxUSMH.Text.Trim(); string newDsmh = ""; if (tbxDSMH.Text != "") newDsmh = tbxDSMH.Text.Trim(); string newMapSize = ""; if (tbxMapSize.Text != "") newMapSize = tbxMapSize.Text.Trim(); string newSize = ""; if (tbxConfirmedSize.Text != "") newSize = tbxConfirmedSize.Text.Trim(); string newThickness = ""; if (ddlThickness.SelectedValue != "") newThickness = ddlThickness.SelectedValue; string newMapLength = ""; if (tbxMapLength.Text != "") newMapLength = tbxMapLength.Text.Trim(); string newSteelTapeThroughSewer = ""; string newLength = ""; if (tbxM1DataSteelTapeThroughSewer.Text != "") { newSteelTapeThroughSewer = tbxM1DataSteelTapeThroughSewer.Text.Trim(); newLength = tbxM1DataSteelTapeThroughSewer.Text.Trim(); } int? newLaterals = null; if (tbxLaterals.Text != "") newLaterals = Int32.Parse(tbxLaterals.Text.Trim()); int? newLiveLaterals = null; if (tbxLiveLaterals.Text != "") newLiveLaterals = Int32.Parse(tbxLiveLaterals.Text.Trim()); // Get m1 data // ... assetSewerSection data string newUsmhDepth = ""; if ((tbxM1DataUsmhDepth.Text != "") && (tbxUSMH.Text != "")) newUsmhDepth = tbxM1DataUsmhDepth.Text.Trim(); string newDsmhDepth = ""; if ((tbxM1DataDsmhDepth.Text != "") && (tbxDSMH.Text != "")) newDsmhDepth = tbxM1DataDsmhDepth.Text.Trim(); // ... lfsAssetSewerSection data string newUsmhMouth12 = ""; if ((tbxM1DataUsmhMouth12.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth12 = tbxM1DataUsmhMouth12.Text.Trim(); string newUsmhMouth1 = ""; if ((tbxM1DataUsmhMouth1.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth1 = tbxM1DataUsmhMouth1.Text.Trim(); string newUsmhMouth2 = ""; if ((tbxM1DataUsmhMouth2.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth2 = tbxM1DataUsmhMouth2.Text.Trim(); string newUsmhMouth3 = ""; if ((tbxM1DataUsmhMouth3.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth3 = tbxM1DataUsmhMouth3.Text.Trim(); string newUsmhMouth4 = ""; if ((tbxM1DataUsmhMouth4.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth4 = tbxM1DataUsmhMouth4.Text.Trim(); string newUsmhMouth5 = ""; if ((tbxM1DataUsmhMouth5.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth5 = tbxM1DataUsmhMouth5.Text.Trim(); string newDsmhMouth12 = ""; if ((tbxM1DataDsmhMouth12.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth12 = tbxM1DataDsmhMouth12.Text.Trim(); string newDsmhMouth1 = ""; if ((tbxM1DataDsmhMouth1.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth1 = tbxM1DataDsmhMouth1.Text.Trim(); string newDsmhMouth2 = ""; if ((tbxM1DataDsmhMouth2.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth2 = tbxM1DataDsmhMouth2.Text.Trim(); string newDsmhMouth3 = ""; if ((tbxM1DataDsmhMouth3.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth3 = tbxM1DataDsmhMouth3.Text.Trim(); string newDsmhMouth4 = ""; if ((tbxM1DataDsmhMouth4.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth4 = tbxM1DataDsmhMouth4.Text.Trim(); string newDsmhMouth5 = ""; if ((tbxM1DataDsmhMouth5.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth5 = tbxM1DataDsmhMouth5.Text.Trim(); string newGeneralSubArea = ""; if (tbxGeneralSubArea.Text != "") newGeneralSubArea = tbxGeneralSubArea.Text.Trim(); // ... assetSewerMH data string newUsmhAddress = ""; if (tbxM1DataUsmhAddress.Text != "") newUsmhAddress = tbxM1DataUsmhAddress.Text.Trim(); string newDsmhAddress = ""; if (tbxM1DataDsmhAddress.Text != "") newDsmhAddress = tbxM1DataDsmhAddress.Text.Trim(); // Update section details FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS); fullLengthLiningSectionDetails.Update(workId, assetId, newStreet, newMapSize, newSize, newMapLength, newLength, newLaterals, newLiveLaterals, newUsmhDepth, newDsmhDepth, newSteelTapeThroughSewer, newUsmhMouth12, newUsmhMouth1, newUsmhMouth2, newUsmhMouth3, newUsmhMouth4, newUsmhMouth5, newDsmhMouth12, newDsmhMouth1, newDsmhMouth2, newDsmhMouth3, newDsmhMouth4, newDsmhMouth5, newUsmh, newDsmh, newUsmhAddress, newDsmhAddress, newGeneralSubArea, newThickness); // Get generalData // ... Ra new data DateTime? newPreFlushDate = null; if (tkrdpGeneralPreFlushDate.Visible == true) { if (tkrdpGeneralPreFlushDate.SelectedDate.HasValue) { newPreFlushDate = tkrdpGeneralPreFlushDate.SelectedDate.Value; } } else { if (tkrdpGeneralPreFlushDateReadOnly.SelectedDate.HasValue) { newPreFlushDate = tkrdpGeneralPreFlushDateReadOnly.SelectedDate.Value; } } DateTime? newPreVideoDate = null; if (tkrdpGeneralPreVideoDate.Visible == true) { if (tkrdpGeneralPreVideoDate.SelectedDate.HasValue) { newPreVideoDate = tkrdpGeneralPreVideoDate.SelectedDate.Value; } } else { if (tkrdpGeneralPreVideoDateReadOnly.SelectedDate.HasValue) { newPreVideoDate = tkrdpGeneralPreVideoDateReadOnly.SelectedDate.Value; ; } } // ... FullLengthLining data string newGeneralClientId = ""; if (tbxGeneralClientId.Text != "") newGeneralClientId = tbxGeneralClientId.Text.Trim(); DateTime? newGeneralProposedLiningDate = null; if (tkrdpGeneralProposedLiningDate.SelectedDate.HasValue) newGeneralProposedLiningDate = tkrdpGeneralProposedLiningDate.SelectedDate.Value; DateTime? newGeneralDeadlineLiningDate = null; if (tkrdpGeneralDeadlineLiningDate.SelectedDate.HasValue) newGeneralDeadlineLiningDate = tkrdpGeneralDeadlineLiningDate.SelectedDate.Value; DateTime? newGeneralP1Date = null; if (tkrdpPrepDataP1Date.SelectedDate.HasValue) newGeneralP1Date = tkrdpPrepDataP1Date.SelectedDate.Value; DateTime? newGeneralM1Date = null; if (tkrdpM1DataM1Date.SelectedDate.HasValue) newGeneralM1Date = tkrdpM1DataM1Date.SelectedDate.Value; DateTime? newGeneralM2Date = null; if (tkrdpM2DataM2Date.SelectedDate.HasValue) newGeneralM2Date = tkrdpM2DataM2Date.SelectedDate.Value; DateTime? newGeneralInstallDate = null; if (tkrdpInstallDataInstallDate.SelectedDate.HasValue) newGeneralInstallDate = tkrdpInstallDataInstallDate.SelectedDate.Value; DateTime? newGeneralFinalVideo = null; if (tkrdpInstallDataFinalVideoDate.SelectedDate.HasValue) newGeneralFinalVideo = tkrdpInstallDataFinalVideoDate.SelectedDate.Value; bool newGeneralIssueIdentified = ckbxGeneralIssueIdentified.Checked; bool newGeneralLfsIssue = ckbxGeneralLfsIssue.Checked; bool newGeneralClientIssue = ckbxGeneralClientIssue.Checked; bool newGeneralSalesIssue = ckbxGeneralSalesIssue.Checked; bool newGeneralIssueGivenToClient = ckbxGeneralIssueGivenToClient.Checked; bool newGeneralIssueResolved = ckbxGeneralIssueResolved.Checked; bool newGeneralIssueInvestigation = ckbxGeneralIssueInvestigation.Checked; int? newPrepDataCXIsRemoved = null; if (tbxPrepDataCXIsRemoved.Text != "") newPrepDataCXIsRemoved = Int32.Parse(tbxPrepDataCXIsRemoved.Text.Trim()); bool newRoboticPrepCompleted = ckbxPrepDataRoboticPrepCompleted.Checked; DateTime? newRoboticPrepCompletedDate = null; if (tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.HasValue) newRoboticPrepCompletedDate = tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.Value; bool newP1Completed = ckbxPrepDataP1Completed.Checked; // ... WorkFullLengthLiningM1 data string newMeasurementsTakenBy = ""; if (tbxM1DataMeasurementsTakenBy.Text != "") newMeasurementsTakenBy = tbxM1DataMeasurementsTakenBy.Text.Trim(); string newMaterial = ddlM1DataMaterial.SelectedValue; string newTrafficControl = ddlM1DataTrafficControl.SelectedValue; string newSiteDetails = ""; if (ddlM1DataSiteDetails.SelectedValue != "(Select)") newSiteDetails = ddlM1DataSiteDetails.SelectedValue; bool newPipeSizeChange = ckbxM1DataPipeSizeChange.Checked; bool newStandardByPass = ckbxM1DataStandardBypass.Checked; string newStandardBypassComments = ""; if (tbxM1DataStandardBypassComments.Text != "") newStandardBypassComments = tbxM1DataStandardBypassComments.Text.Trim(); string newTrafficControlDetails = ""; if (tbxM1DataTrafficControlDetails.Text != "") newTrafficControlDetails = tbxM1DataTrafficControlDetails.Text.Trim(); string newMeasurementType = ddlM1DataMeasurementType.SelectedValue; string newMeasuredFromMh = null; if (tbxM1DataMeasuredFromMh.Visible) newMeasuredFromMh = tbxM1DataMeasuredFromMh.Text; else newMeasuredFromMh = ddlM1DataMeasuredFromMh.SelectedValue; string newVideoDoneFromMh = ""; if (tbxM1DataVideoDoneFromMh.Visible) newVideoDoneFromMh = tbxM1DataVideoDoneFromMh.Text; else newVideoDoneFromMh = ddlM1DataVideoDoneFromMh.SelectedValue; string newVideoDoneToMh = ""; if (tbxM1DataVideoDoneToMh.Visible) newVideoDoneToMh = tbxM1DataVideoDoneToMh.Text; else newVideoDoneToMh = ddlM1DataVideoDoneToMh.SelectedValue; string newAccessType = ""; if (ddlM1DataAccessType.SelectedValue != "(Select)") newAccessType = ddlM1DataAccessType.SelectedValue; // ... ... For header values string newVideoLength = tbxVideoLength.Text.Trim(); // ... WorkFullLengthLiningM2 data string newMeasurementTakenByM2 = tbxM2DataMeasurementsTakenBy.Text.Trim(); bool newDropPipe = ckbxM2DataDropPipe.Checked; string newDropPipeInvertDepth = tbxM2DataDropPipeInvertdepth.Text.Trim(); int? newCappedLaterals = null; if (tbxM2DataCappedLaterals.Text != "") newCappedLaterals = Int32.Parse(tbxM2DataCappedLaterals.Text.Trim()); string newLineWidthId = ""; if (tbxM2DataLineWidthId.Text != "") newLineWidthId = tbxM2DataLineWidthId.Text.Trim(); string newHydrantAddress = ""; if (tbxM2DataHydrantAddress.Text != "") newHydrantAddress = tbxM2DataHydrantAddress.Text.Trim(); string newHydroWireWithin10FtOfInversionMH = ddlM2DataHydroWireWithin10FtOfInversionMh.SelectedValue.Trim(); string newDistanceToInversionMH = ""; if (tbxM2DataDistanceToInversionMH.Text != "") newDistanceToInversionMH = tbxM2DataDistanceToInversionMH.Text.Trim(); string newSurfaceGrade = ""; if (ddlM2DataSurfaceGrade.SelectedValue != "(Select)") newSurfaceGrade = ddlM2DataSurfaceGrade.SelectedValue; bool newHydroPulley = cbxM2DataHydroPulley.Checked; bool newFridgeCart = cbxM2DataFridgeCart.Checked; bool newTwoPump = cbxM2DataTwoPump.Checked; bool newSixBypass = cbxM2DataSixBypass.Checked; bool newScaffolding = cbxM2DataScaffolding.Checked; bool newWinchExtension = cbxM2DataWinchExtension.Checked; bool newExtraGenerator = cbxM2DataExtraGenerator.Checked; bool newGreyCableExtension = cbxM2DataGreyCableExtension.Checked; bool newEasementMats = cbxM2DataEasementMats.Checked; bool newRampsRequired = cbxM2DataRampsRequired.Checked; bool newCameraSkid = cbxM2DataCameraSkid.Checked; // ... Update work details FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS); // ... ... If it doen's have wet out information and inversion information if ((!ckbxWetOutDataIncludeWetOutInformation.Checked) && (!ckbxInversionDataIncludeInversionInformation.Checked)) { fullLengthLiningWorkDetails.Update(workId, newGeneralClientId, newGeneralProposedLiningDate, newGeneralDeadlineLiningDate, newGeneralP1Date, newGeneralM1Date, newGeneralM2Date, newGeneralInstallDate, newGeneralFinalVideo, newGeneralIssueIdentified, newGeneralLfsIssue, newGeneralClientIssue, newGeneralSalesIssue, newGeneralIssueGivenToClient, newGeneralIssueResolved, newGeneralIssueInvestigation, newPrepDataCXIsRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementsTakenBy, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardByPass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasuredFromMh, newVideoDoneFromMh, newVideoDoneToMh, newMeasurementTakenByM2, newDropPipe, newDropPipeInvertDepth, newCappedLaterals, newLineWidthId, newHydrantAddress, newHydroWireWithin10FtOfInversionMH, newDistanceToInversionMH, newSurfaceGrade, newHydroPulley, newFridgeCart, newTwoPump, newSixBypass, newScaffolding, newWinchExtension, newExtraGenerator, newGreyCableExtension, newEasementMats, newRampsRequired, newVideoLength, newPreFlushDate, newPreVideoDate, newCameraSkid, newAccessType, newP1Completed); } else { // Wet out data string newLinerTuber = ""; int newResinId = 0; decimal newExcessResin = 0; string newPoundsDrums = ""; decimal newDrumDiameter = 0; decimal newHoistMaximumHeight = 0; decimal newHoistMinimumHeight = 0; decimal newDownDropTubeLenght = 0; decimal newPumpHeightAboveGround = 0; int newTubeResinToFeltFactor = 0; DateTime newDateOfSheet = DateTime.Now; int newEmployeeID = 0; string newRunDetails = ""; string newRunDetails2 = ""; DateTime newWetOutDate = DateTime.Now; DateTime? newInstallDate = null; string newInversionThickness = ""; Distance lengthToLine = new Distance("0"); decimal newLengthToLine = 0; decimal newPlusExtra = 0; decimal newForTurnOffset = 0; decimal newLengthToWetOut = 0; decimal newTubeMaxColdHead = 0; decimal newTubeMaxColdHeadPsi = 0; decimal newTubeMaxHotHead = 0; decimal newTubeMaxHotHeadPsi = 0; decimal newTubeIdealHead = 0; decimal newTubeIdealHeadPsi = 0; decimal newNetResinForTube = 0; decimal newNetResinForTubeUsgals = 0; string newNetResinForTubeDrumsIns = ""; decimal newNetResinForTubeLbsFt = 0; decimal newNetResinForTubeUsgFt = 0; int newExtraResinForMix = 0; decimal newExtraLbsForMix = 0; decimal newTotalMixQuantity = 0; decimal newTotalMixQuantityUsgals = 0; string newTotalMixQuantityDrumsIns = ""; string newInversionType = ""; decimal newDepthOfInversionMH = 0; decimal newTubeForColumn = 0; decimal newTubeForStartDry = 0; decimal newTotalTube = 0; string newDropTubeConnects = ""; decimal newAllowsHeadTo = 0; decimal newRollerGap = 0; decimal newHeightNeeded = 0; string newAvailable = ""; string newHoistHeight = ""; string newCommentsCipp = ""; string newResinLabel = ""; string newDrumContainsLabel = ""; string newLinerTubeLabel = ""; string newForLbDrumsLabel = ""; string newNetResinLabel = ""; string newCatalystLabel = ""; if (ckbxWetOutDataIncludeWetOutInformation.Checked) { // .... ... Wet Out Sheet newLinerTuber = ddlWetOutDataLinerTube.SelectedValue; newResinId = Int32.Parse(ddlWetOutDataResins.SelectedValue); newExcessResin = decimal.Round(decimal.Parse(tbxWetOutDataExcessResin.Text), 1); newPoundsDrums = ddlWetOutDataPoundsDrums.SelectedValue; newDrumDiameter = decimal.Round(decimal.Parse(tbxWetOutDataDrumDiameter.Text), 1); newHoistMaximumHeight = decimal.Round(decimal.Parse(tbxWetOutDataHoistMaximumHeight.Text), 0); newHoistMinimumHeight = decimal.Round(decimal.Parse(tbxWetOutDataHoistMinimumHeight.Text), 0); newDownDropTubeLenght = decimal.Round(decimal.Parse(tbxWetOutDataDownDropTubeLength.Text), 0); newPumpHeightAboveGround = decimal.Round(decimal.Parse(tbxWetOutDataPumpHeightAboveGround.Text), 2); newTubeResinToFeltFactor = Int32.Parse(tbxWetOutDataTubeResinToFeltFactor.Text); newDateOfSheet = DateTime.Parse(tbxWetOutDataDateOfSheet.Text); newEmployeeID = Int32.Parse(ddlWetOutDataMadeBy.SelectedValue); foreach (ListItem lst in cbxlSectionId.Items) { if (lst.Selected) { newRunDetails = newRunDetails + lst.Value + ">"; } } newRunDetails = newRunDetails.Substring(0, newRunDetails.Length - 1); newRunDetails2 = ddlWetOutDataRunDetails2.SelectedValue; newWetOutDate = (DateTime)tkrdpWetOutDataWetOutDate.SelectedDate; if (tkrdpInstallDataInstallDate.SelectedDate.ToString() != "") { newInstallDate = (DateTime)tkrdpInstallDataInstallDate.SelectedDate; } newInversionThickness = ddlThickness.SelectedValue; lengthToLine = new Distance(tbxWetOutDataLengthToLine.Text); newLengthToLine = decimal.Round(decimal.Parse(lengthToLine.ToStringInEng3()), 1); newPlusExtra = decimal.Round(decimal.Parse(tbxWetOutDataPlusExtra.Text), 0); newForTurnOffset = decimal.Round(decimal.Parse(tbxWetOutDataForTurnOffset.Text), 0); newLengthToWetOut = decimal.Round(decimal.Parse(tbxWetOutDataLengthtToWetOut.Text), 1); newTubeMaxColdHead = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxColdHead.Text), 1); newTubeMaxColdHeadPsi = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxColdHeadPSI.Text), 1); newTubeMaxHotHead = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxHotHead.Text), 1); newTubeMaxHotHeadPsi = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxHotHeadPSI.Text), 1); newTubeIdealHead = decimal.Round(decimal.Parse(tbxWetOutDataTubeIdealHead.Text), 1); newTubeIdealHeadPsi = decimal.Round(decimal.Parse(tbxWetOutDataTubeIdealHeadPSI.Text), 1); newNetResinForTube = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTube.Text), 0); newNetResinForTubeUsgals = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTubeUsgals.Text), 1); newNetResinForTubeDrumsIns = tbxWetOutDataNetResinForTubeDrumsIns.Text; newNetResinForTubeLbsFt = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTubeLbsFt.Text), 2); newNetResinForTubeUsgFt = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTubeUsgFt.Text), 3); newExtraResinForMix = Int32.Parse(tbxWetOutDataExtraResinForMix.Text); newExtraLbsForMix = decimal.Round(decimal.Parse(tbxWetOutDataExtraLbsForMix.Text), 2); newTotalMixQuantity = decimal.Round(decimal.Parse(tbxWetOutDataTotalMixQuantity.Text), 0); newTotalMixQuantityUsgals = decimal.Round(decimal.Parse(tbxWetOutDataTotalMixQuantityUsgals.Text), 1); newTotalMixQuantityDrumsIns = tbxWetOutDataTotalMixQuantityDrumsIns.Text; newInversionType = ddlWetOutDataInversionType.SelectedValue; newDepthOfInversionMH = decimal.Round(decimal.Parse(tbxWetOutDataDepthOfInversionMH.Text), 0); newTubeForColumn = decimal.Round(decimal.Parse(tbxWetOutDataTubeForColumn.Text), 0); newTubeForStartDry = decimal.Round(decimal.Parse(tbxWetOutDataTubeForStartDry.Text), 0); newTotalTube = decimal.Round(decimal.Parse(tbxWetOutDataTotalTube.Text), 1); newDropTubeConnects = tbxWetOutDataDropTubeConnects.Text; newAllowsHeadTo = decimal.Round(decimal.Parse(tbxWetOutDataAllowsHeadTo.Text), 0); newRollerGap = decimal.Round(decimal.Parse(tbxWetOutDataRollerGap.Text), 0); newHeightNeeded = decimal.Round(decimal.Parse(tbxWetOutDataHeightNeeded.Text), 0); newAvailable = tbxWetOutDataAvailable.Text; newHoistHeight = tbxWetOutDataHoistHeight.Text; newCommentsCipp = tbxWetOutDataNotes.Text; newResinLabel = lblWetOutDataResinGray.Text; newDrumContainsLabel = lblWetOutDataDrumContainsGray.Text; newLinerTubeLabel = lblWetOutDataLinerTubeGray.Text; newForLbDrumsLabel = lblWetOutDataLbDrumsGrey.Text; newNetResinLabel = lblWetOutDataNetResinGrey.Text; newCatalystLabel = lblWetOutDataCatalystGrey.Text; } // Inversion data string newInversionComment = ""; string newPipeType = ""; string newPipeCondition = ""; string newGroundMoisture = ""; decimal newBoilerSize = 0; decimal newPumpTotalCapacity = 0; decimal newLayFlatSize = 0; decimal newLayFlatQuantityTotal = 0; decimal newWaterStartTemp = 0; decimal newTemp1 = 0; decimal newHoldAtT1 = 0; decimal newTempT2 = 0; decimal newCookAtT2 = 0; decimal newCoolDownFor = 0; decimal newCoolToTemp = 0; decimal newDropInPipeRun = 0; decimal newPipeSlopOf = 0; decimal newF45F120 = 0; decimal newHold = 0; decimal newF120F185 = 0; decimal newCookTime = 0; decimal newCoolTime = 0; decimal newAproxTotal = 0; decimal newWaterChangesPerHour = 0; decimal newReturnWaterVelocity = 0; decimal newLayflatBackPressure = 0; decimal newPumpLiftAtIdealHead = 0; decimal newWaterToFillLinerColumn = 0; decimal newWaterPerFit = 0; string newInstallationResults = ""; string newInversionLinerTubeLabel = ""; string newHeadsIdealLabel = ""; string newPumpingAndCirculationLabel = ""; if ((ckbxInversionDataIncludeInversionInformation.Checked) && (ckbxWetOutDataIncludeWetOutInformation.Checked)) { // .... ... Inversion data newInversionComment = tbxInversionDataCommentsEdit.Text; newPipeType = ddlInversionDataInversionPipeType.SelectedValue; newPipeCondition = ddlInversionDataPipeCondition.SelectedValue; newGroundMoisture = ddlInversionDataGroundMoisture.SelectedValue; newBoilerSize = decimal.Round(decimal.Parse(tbxInversionDataBoilerSize.Text), 0); newPumpTotalCapacity = decimal.Round(decimal.Parse(tbxInversionDataPumpsTotalCapacity.Text), 0); newLayFlatSize = decimal.Round(decimal.Parse(tbxInversionDataLayflatSize.Text), 0); newLayFlatQuantityTotal = decimal.Round(decimal.Parse(tbxInversionDataLayflatQuantityTotal.Text), 0); newWaterStartTemp = decimal.Round(decimal.Parse(tbxInversionDataWaterStartTempTs.Text), 0); newTemp1 = decimal.Round(decimal.Parse(tbxInversionDataTempT1.Text), 0); newHoldAtT1 = decimal.Round(decimal.Parse(tbxInversionDataHoldAtT1For.Text), 1); newTempT2 = decimal.Round(decimal.Parse(tbxInversionDataTempT2.Text), 0); newCookAtT2 = decimal.Round(decimal.Parse(tbxInversionDataCookAtT2For.Text), 0); newCoolDownFor = decimal.Round(decimal.Parse(tbxInversionDataCoolDownFor.Text), 0); newCoolToTemp = decimal.Round(decimal.Parse(tbxInversionDataCoolToTemp.Text), 0); newDropInPipeRun = decimal.Round(decimal.Parse(tbxInversionDataDropInPipeRun.Text), 1); newPipeSlopOf = decimal.Round(decimal.Parse(tbxInversionDataPipeSlopeOf.Text), 2); newF45F120 = decimal.Round(decimal.Parse(tbxInversionData45F120F.Text), 1); newHold = decimal.Round(decimal.Parse(tbxInversionDataHold.Text), 1); newF120F185 = decimal.Round(decimal.Parse(tbxInversionData120F185F.Text), 1); newCookTime = decimal.Round(decimal.Parse(tbxInversionDataCookTime.Text), 1); newCoolTime = decimal.Round(decimal.Parse(tbxInversionDataCoolTime.Text), 1); newAproxTotal = decimal.Round(decimal.Parse(tbxInversionDataAproxTotal.Text), 1); newWaterChangesPerHour = decimal.Round(decimal.Parse(tbxInversionDataWaterChangesPerHour.Text), 2); newReturnWaterVelocity = decimal.Round(decimal.Parse(tbxInversionDataReturnWaterVelocity.Text), 2); newLayflatBackPressure = decimal.Round(decimal.Parse(tbxInversionDataLayflatBackPressure.Text), 1); newPumpLiftAtIdealHead = decimal.Round(decimal.Parse(tbxInversionDataPumpLiftAtIdealHead.Text), 1); newWaterToFillLinerColumn = decimal.Round(decimal.Parse(tbxInversionDataWaterToFillLinerColumn.Text), 0); newWaterPerFit = decimal.Round(decimal.Parse(tbxInversionDataWaterPerFit.Text), 2); newInstallationResults = tbxInversionDataNotesAndInstallationResults.Text; newInversionLinerTubeLabel = lblInversionDataLinerInfoGrey.Text; newHeadsIdealLabel = lblInversionDataHeadsGrey.Text; newPumpingAndCirculationLabel = lblInversionDataPumpingCirculationSubtitle.Text; } // ... Update fullLengthLiningWorkDetails.UpdateWithWetOutInformation(workId, newGeneralClientId, newGeneralProposedLiningDate, newGeneralDeadlineLiningDate, newGeneralP1Date, newGeneralM1Date, newGeneralM2Date, newGeneralInstallDate, newGeneralFinalVideo, newGeneralIssueIdentified, newGeneralLfsIssue, newGeneralClientIssue, newGeneralSalesIssue, newGeneralIssueGivenToClient, newGeneralIssueResolved, newGeneralIssueInvestigation, newPrepDataCXIsRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementsTakenBy, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardByPass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasuredFromMh, newVideoDoneFromMh, newVideoDoneToMh, newMeasurementTakenByM2, newDropPipe, newDropPipeInvertDepth, newCappedLaterals, newLineWidthId, newHydrantAddress, newHydroWireWithin10FtOfInversionMH, newDistanceToInversionMH, newSurfaceGrade, newHydroPulley, newFridgeCart, newTwoPump, newSixBypass, newScaffolding, newWinchExtension, newExtraGenerator, newGreyCableExtension, newEasementMats, newRampsRequired, newVideoLength, newPreFlushDate, newPreVideoDate, newCameraSkid, newLinerTuber, newResinId, newExcessResin, newPoundsDrums, newDrumDiameter, newHoistMaximumHeight, newHoistMinimumHeight, newDownDropTubeLenght, newPumpHeightAboveGround, newTubeResinToFeltFactor, newDateOfSheet, newEmployeeID, newRunDetails, newRunDetails2, newWetOutDate, newInstallDate, newInversionThickness, newLengthToLine, newPlusExtra, newForTurnOffset, newLengthToWetOut, newTubeMaxColdHead, newTubeMaxColdHeadPsi, newTubeMaxHotHead, newTubeMaxHotHeadPsi, newTubeIdealHead, newTubeIdealHeadPsi, newNetResinForTube, newNetResinForTubeUsgals, newNetResinForTubeDrumsIns, newNetResinForTubeLbsFt, newNetResinForTubeUsgFt, newExtraResinForMix, newExtraLbsForMix, newTotalMixQuantity, newTotalMixQuantityUsgals, newTotalMixQuantityDrumsIns, newInversionType, newDepthOfInversionMH, newTubeForColumn, newTubeForStartDry, newTotalTube, newDropTubeConnects, newAllowsHeadTo, newRollerGap, newHeightNeeded, newAvailable, newHoistHeight, newCommentsCipp, newResinLabel, newDrumContainsLabel, newLinerTubeLabel, newForLbDrumsLabel, newNetResinLabel, newCatalystLabel, newInversionComment, newPipeType, newPipeCondition, newGroundMoisture, newBoilerSize, newPumpTotalCapacity, newLayFlatSize, newLayFlatQuantityTotal, newWaterStartTemp, newTemp1, newHoldAtT1, newTempT2, newCookAtT2, newCoolDownFor, newCoolToTemp, newDropInPipeRun, newPipeSlopOf, newF45F120, newHold, newF120F185, newCookTime, newCoolTime, newAproxTotal, newWaterChangesPerHour, newReturnWaterVelocity, newLayflatBackPressure, newPumpLiftAtIdealHead, newWaterToFillLinerColumn, newWaterPerFit, newInstallationResults, newInversionLinerTubeLabel, newHeadsIdealLabel, newPumpingAndCirculationLabel, newAccessType, newP1Completed); } if (ddlM1DataMaterial.SelectedIndex > 0) { LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null); if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(assetId, newMaterial, companyId)) { MaterialInformation model = new MaterialInformation(materialInformationTDS); model.Insert(assetId, newMaterial, DateTime.Now, false, companyId, false); } } // Store datasets Session["fullLengthLiningTDS"] = fullLengthLiningTDS; Session["materialInformationTDS"] = materialInformationTDS; ViewState["update"] = "no"; }
private void Save2() { // Save Lateral data GrdRaAddLateralsNewAdd(); // Save data int companyId = Int32.Parse(hdfCompanyId.Value); int assetId = Int32.Parse(hdfAssetId.Value); int workId = Int32.Parse(hdfWorkId.Value); int workIdFll = Int32.Parse(hdfWorkIdFll.Value); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString()); // Get Section Details // ... RehabAssessmentSectionDetails data string newStreet = ""; if (tbxStreet.Text != "") newStreet = tbxStreet.Text.Trim(); string newUsmh = ""; if (tbxUSMH.Text != "") newUsmh = tbxUSMH.Text.Trim(); string newDsmh = ""; if (tbxDSMH.Text != "") newDsmh = tbxDSMH.Text.Trim(); string newMapSize = ""; if (tbxMapSize.Text != "") newMapSize = tbxMapSize.Text.Trim(); string newSize = ""; if (tbxConfirmedSize.Text != "") newSize = tbxConfirmedSize.Text.Trim(); string newThickness = ""; if (ddlThickness.SelectedValue != "") newThickness = ddlThickness.SelectedValue; string newMapLength = ""; if (tbxMapLength.Text != "") newMapLength = tbxMapLength.Text.Trim(); string newSteelTapeThroughSewer = ""; string newLength = ""; if (tbxM1DataSteelTapeThroughSewer.Text != "") { newSteelTapeThroughSewer = tbxM1DataSteelTapeThroughSewer.Text.Trim(); newLength = tbxM1DataSteelTapeThroughSewer.Text.Trim(); } int? newLaterals = null; if (tbxLaterals.Text != "") newLaterals = Int32.Parse(tbxLaterals.Text.Trim()); int? newLiveLaterals = null; if (tbxLiveLaterals.Text != "") newLiveLaterals = Int32.Parse(tbxLiveLaterals.Text.Trim()); // Get m1 data // ... assetSewerSection data string newUsmhDepth = ""; if ((tbxM1DataUsmhDepth.Text != "") && (tbxUSMH.Text != "")) newUsmhDepth = tbxM1DataUsmhDepth.Text.Trim(); string newDsmhDepth = ""; if ((tbxM1DataDsmhDepth.Text != "") && (tbxDSMH.Text != "")) newDsmhDepth = tbxM1DataDsmhDepth.Text.Trim(); // ... lfsAssetSewerSection data string newUsmhMouth12 = ""; if ((tbxM1DataUsmhMouth12.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth12 = tbxM1DataUsmhMouth12.Text.Trim(); string newUsmhMouth1 = ""; if ((tbxM1DataUsmhMouth1.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth1 = tbxM1DataUsmhMouth1.Text.Trim(); string newUsmhMouth2 = ""; if ((tbxM1DataUsmhMouth2.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth2 = tbxM1DataUsmhMouth2.Text.Trim(); string newUsmhMouth3 = ""; if ((tbxM1DataUsmhMouth3.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth3 = tbxM1DataUsmhMouth3.Text.Trim(); string newUsmhMouth4 = ""; if ((tbxM1DataUsmhMouth4.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth4 = tbxM1DataUsmhMouth4.Text.Trim(); string newUsmhMouth5 = ""; if ((tbxM1DataUsmhMouth5.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth5 = tbxM1DataUsmhMouth5.Text.Trim(); string newDsmhMouth12 = ""; if ((tbxM1DataDsmhMouth12.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth12 = tbxM1DataDsmhMouth12.Text.Trim(); string newDsmhMouth1 = ""; if ((tbxM1DataDsmhMouth1.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth1 = tbxM1DataDsmhMouth1.Text.Trim(); string newDsmhMouth2 = ""; if ((tbxM1DataDsmhMouth2.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth2 = tbxM1DataDsmhMouth2.Text.Trim(); string newDsmhMouth3 = ""; if ((tbxM1DataDsmhMouth3.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth3 = tbxM1DataDsmhMouth3.Text.Trim(); string newDsmhMouth4 = ""; if ((tbxM1DataDsmhMouth4.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth4 = tbxM1DataDsmhMouth4.Text.Trim(); string newDsmhMouth5 = ""; if ((tbxM1DataDsmhMouth5.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth5 = tbxM1DataDsmhMouth5.Text.Trim(); string newGeneralSubArea = ""; if (tbxGeneralSubArea.Text != "") newGeneralSubArea = tbxGeneralSubArea.Text.Trim(); // ... assetSewerMH Data string newUsmhAddress = ""; if (tbxM1DataUsmhAddress.Text != "") newUsmhAddress = tbxM1DataUsmhAddress.Text.Trim(); string newDsmhAddress = ""; if (tbxM1DataDsmhAddress.Text != "") newDsmhAddress = tbxM1DataDsmhAddress.Text.Trim(); // Update section details RehabAssessmentSectionDetails rehabAssessmentSectionDetails = new RehabAssessmentSectionDetails(rehabAssessmentTDS); rehabAssessmentSectionDetails.Update(workId, assetId, newStreet, newMapSize, newSize, newMapLength, newLength, newLaterals, newLiveLaterals, newUsmhDepth, newDsmhDepth, newSteelTapeThroughSewer, newUsmhMouth12, newUsmhMouth1, newUsmhMouth2, newUsmhMouth3, newUsmhMouth4, newUsmhMouth5, newDsmhMouth12, newDsmhMouth1, newDsmhMouth2, newDsmhMouth3, newDsmhMouth4, newDsmhMouth5, newUsmh, newDsmh, newUsmhAddress, newDsmhAddress, newGeneralSubArea, newThickness); // Get generalData // ... FullLengthLining Data string newGeneralClientId = ""; if (tbxGeneralClientId.Text != "") newGeneralClientId = tbxGeneralClientId.Text.Trim(); // ... Rehab Assessment Data DateTime? newPreFlushDate = null; if (tkrdpGeneralPreFlushDate.SelectedDate.HasValue) newPreFlushDate = tkrdpGeneralPreFlushDate.SelectedDate.Value; DateTime? newPreVideoDate = null; if (tkrdpGeneralPreVideoDate.SelectedDate.HasValue) newPreVideoDate = tkrdpGeneralPreVideoDate.SelectedDate.Value; // ... Prep Data int? newPrepDataCXIsRemoved = null; if (tbxPrepDataCXIsRemoved.Text != "") newPrepDataCXIsRemoved = Int32.Parse(tbxPrepDataCXIsRemoved.Text.Trim()); DateTime? newPrepDataP1Date = null; if (tkrdpPrepDataP1Date.SelectedDate.HasValue) newPrepDataP1Date = tkrdpPrepDataP1Date.SelectedDate.Value; bool newRoboticPrepCompleted = ckbxPrepDataRoboticPrepCompleted.Checked; DateTime? newRoboticPrepCompletedDate = null; if (tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.HasValue) newRoboticPrepCompletedDate = tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.Value; bool newP1Completed = ckbxPrepDataP1Completed.Checked; // ... M1 Data DateTime? newM1Date = null; if (tkrdpM1DataM1Date.SelectedDate.HasValue) newM1Date = tkrdpM1DataM1Date.SelectedDate.Value; string newMeasurementsTakenBy = ""; if (tbxM1DataMeasurementsTakenBy.Text != "") newMeasurementsTakenBy = tbxM1DataMeasurementsTakenBy.Text.Trim(); string newTrafficControl = ddlM1DataTrafficControl.SelectedValue; string newSiteDetails = ""; if (ddlM1DataSiteDetails.SelectedValue != "(Select)") newSiteDetails = ddlM1DataSiteDetails.SelectedValue; bool newPipeSizeChange = ckbxM1DataPipeSizeChange.Checked; bool newStandardByPass = ckbxM1DataStandardBypass.Checked; string newStandardBypassComments = ""; if (tbxM1DataStandardBypassComments.Text != "") newStandardBypassComments = tbxM1DataStandardBypassComments.Text.Trim(); string newTrafficControlDetails = ""; if (tbxM1DataTrafficControlDetails.Text != "") newTrafficControlDetails = tbxM1DataTrafficControlDetails.Text.Trim(); string newMaterial = ddlM1DataMaterial.SelectedValue; string newMeasurementType = ddlM1DataMeasurementType.SelectedValue; string newMeasuredFromMh = ""; if (tbxM1DataMeasuredFromMh.Visible) newMeasuredFromMh = tbxM1DataMeasuredFromMh.Text; else newMeasuredFromMh = ddlM1DataMeasuredFromMh.SelectedValue; string newVideoDoneFromMh = ""; if (tbxM1DataVideoDoneFromMh.Visible) newVideoDoneFromMh = tbxM1DataVideoDoneFromMh.Text; else newVideoDoneFromMh = ddlM1DataVideoDoneFromMh.SelectedValue; string newVideoDoneToMh = ""; if (tbxM1DataVideoDoneToMh.Visible) newVideoDoneToMh = tbxM1DataVideoDoneToMh.Text; else newVideoDoneToMh = ddlM1DataVideoDoneToMh.SelectedValue; string newAccessType = ""; if (ddlM1DataAccessType.SelectedValue != "(Select)") newAccessType = ddlM1DataAccessType.SelectedValue; // ... M2 Data (Video Length) string newVideoDistanceM2 = tbxVideoLength.Text.Trim(); // ... Update work details RehabAssessmentWorkDetails rehabAssessmentWorkDetails = new RehabAssessmentWorkDetails(rehabAssessmentTDS); rehabAssessmentWorkDetails.Update(workId, workIdFll, newGeneralClientId, newPrepDataP1Date, newM1Date, newPrepDataCXIsRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementsTakenBy, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardByPass, newStandardBypassComments, newTrafficControlDetails, newMaterial, newMeasurementType, newMeasuredFromMh, newVideoDoneFromMh, newVideoDoneToMh, newVideoDistanceM2, newPreVideoDate, newPreFlushDate, newAccessType, newP1Completed); if (ddlM1DataMaterial.SelectedIndex > 0) { LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null); if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(assetId, newMaterial, companyId)) { MaterialInformation model = new MaterialInformation(materialInformationTDS); model.Insert(assetId, newMaterial, DateTime.Now, false, companyId, false); } } // Store datasets Session["rehabAssessmentTDS"] = rehabAssessmentTDS; Session["materialInformationTDS"] = materialInformationTDS; ViewState["update"] = "no"; }
private void UpdateDatabase() { // Get ids & location int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim()); ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); Int64 countryId = projectGateway.GetCountryID(projectId); Int64? provinceId = null; if (projectGateway.GetProvinceID(projectId).HasValue) provinceId = (Int64)projectGateway.GetProvinceID(projectId); Int64? countyId = null; if (projectGateway.GetCountyID(projectId).HasValue) countyId = (Int64)projectGateway.GetCountyID(projectId); Int64? cityId = null; if (projectGateway.GetCityID(projectId).HasValue) cityId = (Int64)projectGateway.GetCityID(projectId); string workType = hdfWorkType.Value.Trim(); int companyId = Int32.Parse(hdfCompanyId.Value); int workId = Int32.Parse(hdfWorkId.Value); int workIdFll = Int32.Parse(hdfWorkIdFll.Value); int sectionAssetId = Int32.Parse(hdfAssetId.Value); bool isNewMeasuredFromDsmh = false; RehabAssessmentLateralDetails raLateralDetails = new RehabAssessmentLateralDetails(); raLateralDetails.LoadForEdit(workIdFll, sectionAssetId, companyId, projectId); if (raLateralDetails.Table.Rows.Count == 0) { if (ddlM1DataMeasuredFromMh.SelectedValue == "DSMH") { isNewMeasuredFromDsmh = true; RehabAssessmentLateralDetails raaLateralDetails = new RehabAssessmentLateralDetails(rehabAssessmentTDS); raaLateralDetails.ModifyLateralId(); } } DB.Open(); DB.BeginTransaction(); try { // Save lateral details bool roboticPrepCompleted = ckbxPrepDataRoboticPrepCompleted.Checked; DateTime? roboticPrepCompletedCompleted = null; if (tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.HasValue) roboticPrepCompletedCompleted = tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.Value; RehabAssessmentLateralDetails rehabAssessmentLateralDetails = new RehabAssessmentLateralDetails(rehabAssessmentTDS); rehabAssessmentLateralDetails.Save(workIdFll, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, tbxVideoLength.Text.Trim(), companyId, isNewMeasuredFromDsmh, roboticPrepCompleted, roboticPrepCompletedCompleted); // Save section details RehabAssessmentSectionDetails rehabAssessmentSectionDetails = new RehabAssessmentSectionDetails(rehabAssessmentTDS); rehabAssessmentSectionDetails.Save(countryId, provinceId, countyId, cityId, projectId, companyId); // Save work details RehabAssessmentWorkDetails rehabAssessmentWorkDetails = new RehabAssessmentWorkDetails(rehabAssessmentTDS); rehabAssessmentWorkDetails.Save(countryId, provinceId, countyId, cityId, projectId, companyId, sectionAssetId); // Save material details string newMaterial = ddlM1DataMaterial.SelectedValue; if (ddlM1DataMaterial.SelectedIndex > 0) { LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null); if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(sectionAssetId, newMaterial, companyId)) { MaterialInformation materialInformation = new MaterialInformation(materialInformationTDS); materialInformation.Save(companyId); } } DB.CommitTransaction(); // Store datasets rehabAssessmentTDS.AcceptChanges(); Session["rehabAssessmentTDS"] = rehabAssessmentTDS; materialInformationTDS.AcceptChanges(); Session["materialInformationTDS"] = materialInformationTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
/// <summary> /// Insert a material /// </summary> /// <param name="lateral_assetId">lateral_assetId</param> /// <param name="material">material</param> /// <param name="companyId">companyId</param> private void InsertMaterial(int lateral_assetId, string material, int companyId) { LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null); if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(lateral_assetId, material, companyId)) { MaterialInformationGateway materialInformationGateway = new MaterialInformationGateway(); materialInformationGateway.LoadAllByAssetId(lateral_assetId, companyId); AssetSewerMaterial assetSewerMaterial = new AssetSewerMaterial(materialInformationGateway.Data); assetSewerMaterial.InsertDirect(lateral_assetId, materialInformationGateway.Table.Rows.Count + 1, material, DateTime.Now, false, companyId); } }