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 UpdateDatabase() { try { TeamProjectTime2Gateway teamProjectTime2Gateway = new TeamProjectTime2Gateway(teamProjectTime2TDSToSave); teamProjectTime2Gateway.Update(projectTime2TDS); teamProjectTime2TDSToSave.AcceptChanges(); teamProjectTime2TDS.AcceptChanges(); projectTime2TDS.AcceptChanges(); Session["teamProjectTime2TDS"] = teamProjectTime2TDS; } catch (Exception ex) { string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } DB.Open(); DB.BeginTransaction(); try { if (ddlTypeOfWork.SelectedValue == "MH Rehab") { int companyId = Int32.Parse(hdfCompanyId.Value); // Get ids & location int projectId = Int32.Parse(ddlProject.SelectedValue); 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); manholeRehabilitationTDS = new ManholeRehabilitationTDS(); ManholeRehabilitationWorkDetails manholeRehabilitationWorkDetails = new ManholeRehabilitationWorkDetails(manholeRehabilitationTDS); ManholeRehabilitationWorkDetailsGateway manholeRehabilitationWorkDetailsGateway = new ManholeRehabilitationWorkDetailsGateway(manholeRehabilitationTDS); switch (ddlFunction.SelectedValue) { case "Prep": foreach (GridViewRow row in grdManholesRehabPrep.Rows) { bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; DateTime? prepDate = Convert.ToDateTime(((Label)row.FindControl("lblPrepDate")).Text); if (selected) { int assetId = Convert.ToInt32(grdManholesRehabPrep.DataKeys[row.RowIndex].Values["AssetID"].ToString()); int workId = 0; workId = GetWorkId(Int32.Parse(ddlProject.SelectedValue), assetId, "Manhole Rehabilitation", companyId); manholeRehabilitationWorkDetails.LoadByWorkIdAssetId(workId, assetId, Int32.Parse(hdfCompanyId.Value)); if (manholeRehabilitationWorkDetailsGateway.Table.Rows.Count > 0) { int? batchId = manholeRehabilitationWorkDetailsGateway.GetBatchID(workId); manholeRehabilitationWorkDetails.Update(workId, prepDate, manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId), batchId, manholeRehabilitationWorkDetailsGateway.GetDate(workId).Value, companyId); } else { manholeRehabilitationWorkDetails.Update(workId, prepDate, null, null, DateTime.Now, companyId); } manholeRehabilitationWorkDetails.Save2(countryId, provinceId, countyId, cityId, projectId, assetId, companyId, true); } } break; case "Spray": foreach (GridViewRow row in grdManholesRehabSpray.Rows) { bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; DateTime? sprayDate = Convert.ToDateTime(((Label)row.FindControl("lblSprayDate")).Text); if (selected) { int assetId = Convert.ToInt32(grdManholesRehabSpray.DataKeys[row.RowIndex].Values["AssetID"].ToString()); int workId = 0; workId = GetWorkId(Int32.Parse(ddlProject.SelectedValue), assetId, "Manhole Rehabilitation", companyId); manholeRehabilitationWorkDetails.LoadByWorkIdAssetId(workId, assetId, Int32.Parse(hdfCompanyId.Value)); if (manholeRehabilitationWorkDetailsGateway.Table.Rows.Count > 0) { int? batchId = manholeRehabilitationWorkDetailsGateway.GetBatchID(workId); manholeRehabilitationWorkDetails.Update(workId, manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId), sprayDate, batchId, manholeRehabilitationWorkDetailsGateway.GetDate(workId).Value, companyId); } else { manholeRehabilitationWorkDetails.Update(workId, null, sprayDate, null, DateTime.Now, companyId); } manholeRehabilitationWorkDetails.Save2(countryId, provinceId, countyId, cityId, projectId, assetId, companyId, true); } } break; } DB.CommitTransaction(); // Store datasets manholeRehabilitationTDS.AcceptChanges(); } else { if (ddlTypeOfWork.SelectedValue == "Full Length") { fullLengthLiningTDS = new FullLengthLiningTDS(); AssetSewerSectionGateway aass = new AssetSewerSectionGateway(); FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS); FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway(fullLengthLiningTDS); int assetId = 0; int workId = 0; // Get ids & location int projectId = Int32.Parse(ddlProject.SelectedValue); 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); int companyId = Int32.Parse(hdfCompanyId.Value); switch (ddlFunction.SelectedValue) { case "Install": foreach (GridViewRow row in grdSectionsInstall.Rows) { bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; DateTime? installDate = Convert.ToDateTime(((Label)row.FindControl("lblInstallDate")).Text); if (selected) { if (installDate != tkrdpDate_.SelectedDate.Value) { installDate = tkrdpDate_.SelectedDate.Value; } string sectionId = grdSectionsInstall.DataKeys[row.RowIndex].Values["SectionID"].ToString(); aass.LoadBySectionId(sectionId, companyId); assetId = aass.GetAssetID(sectionId); workId = GetWorkId(Int32.Parse(ddlProject.SelectedValue), assetId, "Full Length Lining", companyId); fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, Int32.Parse(hdfCompanyId.Value)); fullLengthLiningWorkDetails.Update(workId, fullLengthLiningWorkDetailsGateway.GetP1Date(workId), fullLengthLiningWorkDetailsGateway.GetP1Completed(workId), installDate, fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workId)); fullLengthLiningWorkDetails.Save(countryId, provinceId, countyId, cityId, projectId, assetId, companyId, false, false); } } break; case "Prep & Measure": foreach (GridViewRow row in grdSections.Rows) { bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; bool completed = ((CheckBox)row.FindControl("cbxCompleted")).Checked; DateTime? prepDate = Convert.ToDateTime(((Label)row.FindControl("lblPrepDate")).Text); if (selected) { if (completed) { if (prepDate != tkrdpDate_.SelectedDate.Value) { prepDate = tkrdpDate_.SelectedDate.Value; } } else { prepDate = null; } string sectionId = grdSections.DataKeys[row.RowIndex].Values["SectionID"].ToString(); aass.LoadBySectionId(sectionId, companyId); assetId = aass.GetAssetID(sectionId); workId = GetWorkId(Int32.Parse(ddlProject.SelectedValue), assetId, "Full Length Lining", companyId); fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, Int32.Parse(hdfCompanyId.Value)); fullLengthLiningWorkDetails.Update(workId, prepDate, completed, fullLengthLiningWorkDetailsGateway.GetInstallDate(workId), fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workId)); fullLengthLiningWorkDetails.Save(countryId, provinceId, countyId, cityId, projectId, assetId, companyId, false, false); } } break; case "Reinstate & Post Video": FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS); FullLengthLiningLateralDetailsGateway fullLengthLiningLateralDetailsGateway = new FullLengthLiningLateralDetailsGateway(fullLengthLiningTDS); foreach (GridViewRow row in grdSectionsReinstatePostVideo.Rows) { bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; bool completed = ((CheckBox)row.FindControl("cbxCompleted")).Checked; DateTime? postVideo = Convert.ToDateTime(((Label)row.FindControl("lblPostVideo")).Text); string sectionId = grdSectionsReinstatePostVideo.DataKeys[row.RowIndex].Values["SectionID"].ToString(); aass.LoadBySectionId(sectionId, companyId); assetId = aass.GetAssetID(sectionId); workId = GetWorkId(Int32.Parse(ddlProject.SelectedValue), assetId, "Full Length Lining", companyId); if (selected) { if (completed) { if (postVideo != tkrdpDate_.SelectedDate.Value) { postVideo = tkrdpDate_.SelectedDate.Value; } } else { postVideo = null; } fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, Int32.Parse(hdfCompanyId.Value)); fullLengthLiningWorkDetails.Update(workId, fullLengthLiningWorkDetailsGateway.GetP1Date(workId), fullLengthLiningWorkDetailsGateway.GetP1Completed(workId), fullLengthLiningWorkDetailsGateway.GetInstallDate(workId), postVideo); fullLengthLiningWorkDetails.Save(countryId, provinceId, countyId, cityId, projectId, assetId, companyId, false, false); } } foreach (GridViewRow row in grdLaterals.Rows) { string sectionId = grdLaterals.DataKeys[row.RowIndex].Values["SectionID"].ToString(); int assetIdLateral = Convert.ToInt32(((Label)row.FindControl("lblAssetIDLateral")).Text); bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; DateTime? opened = null; if (((CheckBox)row.FindControl("cbxOpened")).Checked) opened = tkrdpDate_.SelectedDate; DateTime? brushed = null; if (((CheckBox)row.FindControl("cbxBrushed")).Checked) brushed = tkrdpDate_.SelectedDate; if (selected) { aass.LoadBySectionId(sectionId, companyId); assetId = aass.GetAssetID(sectionId); workId = GetWorkId(Int32.Parse(ddlProject.SelectedValue), assetId, "Full Length Lining", companyId); fullLengthLiningLateralDetails.SaveFll(workId, assetIdLateral, companyId, opened, brushed); } } break; } DB.CommitTransaction(); // Store datasets fullLengthLiningTDS.AcceptChanges(); } } } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }