//COMPANY_ID /// <summary> /// Delete /// </summary> /// <param name="projectId">projectId</param> /// <param name="sectionId">sectionId</param> /// <param name="companyId">companyId</param> public void Delete(int projectId, int assetId, int companyId) { WorkRehabAssessmentGateway workRehabAssessmentGateway = new WorkRehabAssessmentGateway(); WorkRehabAssessment workRehabAssessment = new WorkRehabAssessment(workRehabAssessmentGateway.Data); WorkFullLengthLiningGateway workFullLengthLiningGateway = new WorkFullLengthLiningGateway(); WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(workFullLengthLiningGateway.Data); WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway(); WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(workJunctionLiningSectionGateway.Data); int workIdRA = GetWorkId(projectId, assetId, "Rehab Assessment", companyId); if (workIdRA != 0) workRehabAssessment.DeleteDirect(workIdRA, companyId); int workIdFL = GetWorkId(projectId, assetId, "Full Length Lining", companyId); if (workIdFL != 0) workFullLengthLining.DeleteDirect(workIdFL, companyId); int workIdJL = GetWorkId(projectId, assetId, "Junction Lining Section", companyId); if (workIdJL != 0) workJunctionLiningSection.DeleteDirect(workIdJL, companyId); LfsAssetSewerSectionGateway lfsAssetSewerSectionGateway = new LfsAssetSewerSectionGateway(); lfsAssetSewerSectionGateway.LoadByAssetId(assetId, companyId); LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(lfsAssetSewerSectionGateway.Data); // Update lfs asset lfsAssetSewerSection.DeleteDirect(assetId, companyId); }
/// <summary> /// UpdateSection /// <param name="sectionWorkId">sectionWorkId</param> /// <param name="lateralWorkId">lateralWorkId</param> /// <param name="companyId">companyId</param> public void UpdateSection(int sectionWorkId, int lateralWorkId, int companyId) { // load section WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway(); workJunctionLiningSectionGateway.LoadByWorkId(sectionWorkId, companyId); // get old values of section int numLats = workJunctionLiningSectionGateway.GetNumLats(sectionWorkId); int notLinedYet = workJunctionLiningSectionGateway.GetNotLinedYet(sectionWorkId); bool allMeasured = workJunctionLiningSectionGateway.GetAllMeasured(sectionWorkId); bool deleted = workJunctionLiningSectionGateway.GetDeleted(sectionWorkId); string issueWithLaterals = workJunctionLiningSectionGateway.GetIssueWithLaterals(sectionWorkId); int notMeasuredYet = workJunctionLiningSectionGateway.GetNotMeasuredYet(sectionWorkId); int notDeliveredYet = workJunctionLiningSectionGateway.GetNotDeliveredYet(sectionWorkId); string trafficControl = workJunctionLiningSectionGateway.GetTrafficControl(sectionWorkId); string trafficControlDetails = workJunctionLiningSectionGateway.GetTrafficControlDetails(sectionWorkId); bool standardBypass = workJunctionLiningSectionGateway.GetStandardBypass(sectionWorkId); string standardBypassComments = workJunctionLiningSectionGateway.GetStandardBypassComments(sectionWorkId); int availableToLine = workJunctionLiningSectionGateway.GetAvailableToLine(sectionWorkId); // get new values of section int newNumLats = 0; int newNotLinedYet = 0; bool newAllMeasured = true; int newNotMeasuredYet = 0; int newNotDeliveredYet = 0; string newIssueWithLaterals = "No"; int newAvailableToLine = 0; int totDelivered = 0; int totInstalled = 0; // load laterals WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); workJunctionLiningLateralGateway.LoadBySectionWorkId(sectionWorkId, companyId); foreach (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALRow row in (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALDataTable)workJunctionLiningLateralGateway.Table) { if (!row.Deleted) { // ... With no outofscope issue if (!row.OutOfScope) { newNumLats++; if (row.IsLinerInstalledNull()) newNotLinedYet++; if (row.IsMeasuredNull()) newAllMeasured = false; if (row.IsMeasuredNull()) newNotMeasuredYet++; if (row.IsDeliveredNull()) newNotDeliveredYet++; if (!row.IsDeliveredNull()) totDelivered++; if (!row.IsLinerInstalledNull()) totInstalled++; } } } if (newNumLats == 0) newAllMeasured = false; if (newNumLats > 0) { newAvailableToLine = totDelivered - totInstalled; // lining plan JlLiningPlanGateway jlLiningPlanGateway = new JlLiningPlanGateway(); if (jlLiningPlanGateway.IsLateralsIssueNo(sectionWorkId)) { newIssueWithLaterals = "No"; } else { if (jlLiningPlanGateway.IsLateralsIssueOutOfScope(sectionWorkId)) { newIssueWithLaterals = "Out Of Scope"; } else { if (jlLiningPlanGateway.IsLateralsIssueYesOutOfScope(sectionWorkId)) { newIssueWithLaterals = "Yes, Out Of Scope"; } else { if (jlLiningPlanGateway.IsLateralsIssueYes(sectionWorkId)) { newIssueWithLaterals = "Yes"; } } } } } // Update Work Juntion Lining Section WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.UpdateDirect(sectionWorkId, numLats, notLinedYet, allMeasured, deleted, issueWithLaterals, notMeasuredYet, notDeliveredYet, companyId, trafficControl, trafficControlDetails, standardBypass, standardBypassComments, availableToLine, newNumLats, newNotLinedYet, newAllMeasured, newIssueWithLaterals, newNotMeasuredYet, newNotDeliveredYet, trafficControl, trafficControlDetails, standardBypass, standardBypassComments, newAvailableToLine); }
/// <summary> /// Save /// </summary> /// <param name="countryId">countryId</param> /// <param name="provinceId">provinceId</param> /// <param name="countyId">countyId</param> /// <param name="cityId">cityId</param> /// <param name="projectId">projectId</param> /// <param name="sectionAssetId">sectionAssetId</param> /// <param name="companyId">companyId</param> /// <param name="includeWetOutInformation">includeWetOutInformation</param> /// <param name="includeInversionInformation">includeInversionInformation</param> public void Save(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int sectionAssetId, int companyId, bool includeWetOutInformation, bool includeInversionInformation) { FullLengthLiningTDS fullLengthLiningChanges = (FullLengthLiningTDS)Data.GetChanges(); if (fullLengthLiningChanges.WorkDetails.Rows.Count > 0) { FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway(fullLengthLiningChanges); // Update sections foreach (FullLengthLiningTDS.WorkDetailsRow row in (FullLengthLiningTDS.WorkDetailsDataTable)fullLengthLiningChanges.WorkDetails) { // Unchanged values int workId = row.WorkID; // Original values string originalClientId = fullLengthLiningWorkDetailsGateway.GetClientIdOriginal(workId); DateTime? originalProposedLiningDate = fullLengthLiningWorkDetailsGateway.GetProposedLiningDateOriginal(workId); DateTime? originalDeadlineLiningDate = fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDateOriginal(workId); DateTime? originalP1Date = fullLengthLiningWorkDetailsGateway.GetP1DateOriginal(workId); DateTime? originalM1Date = fullLengthLiningWorkDetailsGateway.GetM1DateOriginal(workId); DateTime? originalM2Date = fullLengthLiningWorkDetailsGateway.GetM2DateOriginal(workId); DateTime? originalInstallDate = fullLengthLiningWorkDetailsGateway.GetInstallDateOriginal(workId); DateTime? originalFinalVideoDate = fullLengthLiningWorkDetailsGateway.GetFinalVideoDateOriginal(workId); bool originalIssueIdentified = fullLengthLiningWorkDetailsGateway.GetIssueIdentifiedOriginal(workId); bool originalIssueLFS = fullLengthLiningWorkDetailsGateway.GetIssueLFSOriginal(workId); bool originalIssueClient = fullLengthLiningWorkDetailsGateway.GetIssueClientOriginal(workId); bool originalIssueSales = fullLengthLiningWorkDetailsGateway.GetIssueSalesOriginal(workId); bool originalIssueGivenToClient = fullLengthLiningWorkDetailsGateway.GetIssueGivenToClientOriginal(workId); bool originalIssueResolved = fullLengthLiningWorkDetailsGateway.GetIssueResolvedOriginal(workId); bool originalIssueInvestigation = fullLengthLiningWorkDetailsGateway.GetIssueInvestigationOriginal(workId); int? originalCxisRemoved = fullLengthLiningWorkDetailsGateway.GetCxisRemovedOriginal(workId); bool originalRoboticPrepCompleted = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedOriginal(workId); DateTime? originalRoboticPrepCompletedDate = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDateOriginal(workId); DateTime? originalPreFlushDate = fullLengthLiningWorkDetailsGateway.GetPreFlushDateOriginal(workId); DateTime? originalPreVideoDate = fullLengthLiningWorkDetailsGateway.GetPreVideoDateOriginal(workId); int originalRaWorkId = fullLengthLiningWorkDetailsGateway.GetRaWorkIdOriginal(workId); bool originalP1Completed = fullLengthLiningWorkDetailsGateway.GetP1CompletedOriginal(workId); // M1 data string originalMeasurementTakenBy = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByOriginal(workId); string originalMaterial = fullLengthLiningWorkDetailsGateway.GetMaterialOriginal(workId); string originalTrafficControl = fullLengthLiningWorkDetailsGateway.GetTrafficControlOriginal(workId); string originalSiteDetails = fullLengthLiningWorkDetailsGateway.GetSiteDetailsOriginal(workId); bool originalPipeSizeChange = fullLengthLiningWorkDetailsGateway.GetPipeSizeChangeOriginal(workId); bool originalStandardBypass = fullLengthLiningWorkDetailsGateway.GetStandardBypassOriginal(workId); string originalStandardBypassComments = fullLengthLiningWorkDetailsGateway.GetStandardBypassCommentsOriginal(workId); string originalTrafficControlDetails = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetailsOriginal(workId); string originalMeasurementType = fullLengthLiningWorkDetailsGateway.GetMeasurementTypeOriginal(workId); string originalMeasurementFromMh = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMhOriginal(workId); string originalVideoDoneFromMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMhOriginal(workId); string originalVideoDoneToMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMhOriginal(workId); string originalAccessType = fullLengthLiningWorkDetailsGateway.GetAccessTypeOriginal(workId); // M2 data string originalMeasurementTakenByM2 = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2Original(workId); bool originalDropPipe = fullLengthLiningWorkDetailsGateway.GetDropPipeOriginal(workId); string originalDropPipeInvertDepth = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepthOriginal(workId); int? originalCappedLaterals = fullLengthLiningWorkDetailsGateway.GetCappedLateralsOriginal(workId); string originalLineWithId = fullLengthLiningWorkDetailsGateway.GetLineWithIdOriginal(workId); string originalHydrantAddress = fullLengthLiningWorkDetailsGateway.GetHydrantAddressOriginal(workId); string originalHydroWireWithin10FtOfInversionMH = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMHOriginal(workId); string originalDistanceToInversionMh = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMhOriginal(workId); string originalSurfaceGrade = fullLengthLiningWorkDetailsGateway.GetSurfaceGradeOriginal(workId); bool originalHydroPulley = fullLengthLiningWorkDetailsGateway.GetHydroPulleyOriginal(workId); bool originalFridgeCart = fullLengthLiningWorkDetailsGateway.GetFridgeCartOriginal(workId); bool originalTwoPump = fullLengthLiningWorkDetailsGateway.GetTwoPumpOriginal(workId); bool originalSixBypass = fullLengthLiningWorkDetailsGateway.GetSixBypassOriginal(workId); bool originalScaffolding = fullLengthLiningWorkDetailsGateway.GetScaffoldingOriginal(workId); bool originalWinchExtension = fullLengthLiningWorkDetailsGateway.GetWinchExtensionOriginal(workId); bool originalExtraGenerator = fullLengthLiningWorkDetailsGateway.GetExtraGeneratorOriginal(workId); bool originalGreyCableExtension = fullLengthLiningWorkDetailsGateway.GetGreyCableExtensionOriginal(workId); bool originalEasementMats = fullLengthLiningWorkDetailsGateway.GetEasementMatsOriginal(workId); bool originalRampRequired = fullLengthLiningWorkDetailsGateway.GetRampRequiredOriginal(workId); string originalVideoLength = fullLengthLiningWorkDetailsGateway.GetVideoLengthOriginal(workId); bool originalCameraSkid = fullLengthLiningWorkDetailsGateway.GetCameraSkidOriginal(workId); // Comments string originalComments = fullLengthLiningWorkDetailsGateway.GetCommentsOriginal(workId); // New variables string newClientId = fullLengthLiningWorkDetailsGateway.GetClientId(workId); DateTime? newProposedLiningDate = fullLengthLiningWorkDetailsGateway.GetProposedLiningDate(workId); DateTime? newDeadlineLiningDate = fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDate(workId); DateTime? newP1Date = fullLengthLiningWorkDetailsGateway.GetP1Date(workId); DateTime? newM1Date = fullLengthLiningWorkDetailsGateway.GetM1Date(workId); DateTime? newM2Date = fullLengthLiningWorkDetailsGateway.GetM2Date(workId); DateTime? newInstallDate = fullLengthLiningWorkDetailsGateway.GetInstallDate(workId); DateTime? newFinalVideoDate = fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workId); bool newIssueIdentified = fullLengthLiningWorkDetailsGateway.GetIssueIdentified(workId); bool newIssueLFS = fullLengthLiningWorkDetailsGateway.GetIssueLFS(workId); bool newIssueClient = fullLengthLiningWorkDetailsGateway.GetIssueClient(workId); bool newIssueSales = fullLengthLiningWorkDetailsGateway.GetIssueSales(workId); bool newIssueGivenToClient = fullLengthLiningWorkDetailsGateway.GetIssueGivenToClient(workId); bool newIssueResolved = fullLengthLiningWorkDetailsGateway.GetIssueResolved(workId); bool newIssueInvestigation = fullLengthLiningWorkDetailsGateway.GetIssueInvestigation(workId); int? newCxisRemoved = fullLengthLiningWorkDetailsGateway.GetCxisRemoved(workId); bool newRoboticPrepCompleted = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompleted(workId); DateTime? newRoboticPrepCompletedDate = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDate(workId); DateTime? newPreFlushDate = fullLengthLiningWorkDetailsGateway.GetPreFlushDate(workId); DateTime? newPreVideoDate = fullLengthLiningWorkDetailsGateway.GetPreVideoDate(workId); int newRaWorkId = fullLengthLiningWorkDetailsGateway.GetRaWorkId(workId); bool newP1Completed = fullLengthLiningWorkDetailsGateway.GetP1Completed(workId); // M1 string newMeasurementTakenBy = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenBy(workId); string newMaterial = fullLengthLiningWorkDetailsGateway.GetMaterial(workId); string newTrafficControl = fullLengthLiningWorkDetailsGateway.GetTrafficControl(workId); string newSiteDetails = fullLengthLiningWorkDetailsGateway.GetSiteDetails(workId); bool newPipeSizeChange = fullLengthLiningWorkDetailsGateway.GetPipeSizeChange(workId); bool newStandardBypass = fullLengthLiningWorkDetailsGateway.GetStandardBypass(workId); string newStandardBypassComments = fullLengthLiningWorkDetailsGateway.GetStandardBypassComments(workId); string newTrafficControlDetails = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetails(workId); string newMeasurementType = fullLengthLiningWorkDetailsGateway.GetMeasurementType(workId); string newMeasurementFromMh = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workId); string newVideoDoneFromMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMh(workId); string newVideoDoneToMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMh(workId); string newAccessType = fullLengthLiningWorkDetailsGateway.GetAccessType(workId); // M2 string newMeasurementTakenByM2 = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2(workId); bool newDropPipe = fullLengthLiningWorkDetailsGateway.GetDropPipe(workId); string newDropPipeInvertDepth = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepth(workId); int? newCappedLaterals = fullLengthLiningWorkDetailsGateway.GetCappedLaterals(workId); string newLineWithId = fullLengthLiningWorkDetailsGateway.GetLineWithId(workId); string newHydrantAddress = fullLengthLiningWorkDetailsGateway.GetHydrantAddress(workId); string newHydroWireWithin10FtOfInversionMH = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMH(workId); string newDistanceToInversionMh = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMh(workId); string newSurfaceGrade = fullLengthLiningWorkDetailsGateway.GetSurfaceGrade(workId); bool newHydroPulley = fullLengthLiningWorkDetailsGateway.GetHydroPulley(workId); bool newFridgeCart = fullLengthLiningWorkDetailsGateway.GetFridgeCart(workId); bool newTwoPump = fullLengthLiningWorkDetailsGateway.GetTwoPump(workId); bool newSixBypass = fullLengthLiningWorkDetailsGateway.GetSixBypass(workId); bool newScaffolding = fullLengthLiningWorkDetailsGateway.GetScaffolding(workId); bool newWinchExtension = fullLengthLiningWorkDetailsGateway.GetWinchExtension(workId); bool newExtraGenerator = fullLengthLiningWorkDetailsGateway.GetExtraGenerator(workId); bool newGreyCableExtension = fullLengthLiningWorkDetailsGateway.GetGreyCableExtension(workId); bool newEasementMats = fullLengthLiningWorkDetailsGateway.GetEasementMats(workId); bool newRampRequired = fullLengthLiningWorkDetailsGateway.GetRampRequired(workId); string newVideoLength = fullLengthLiningWorkDetailsGateway.GetVideoLength(workId); bool newCameraSkid = fullLengthLiningWorkDetailsGateway.GetCameraSkid(workId); // comments string newComments = fullLengthLiningWorkDetailsGateway.GetComments(workId); // Update work UpdateWork(countryId, provinceId, countyId, cityId, workId, originalClientId, originalProposedLiningDate, originalDeadlineLiningDate, originalP1Date, originalM1Date, originalM2Date, originalInstallDate, originalFinalVideoDate, originalIssueIdentified, originalIssueLFS, originalIssueClient, originalIssueSales, originalIssueGivenToClient, originalIssueResolved, originalIssueInvestigation, originalCxisRemoved, originalRoboticPrepCompleted, originalRoboticPrepCompletedDate, originalMeasurementTakenBy, originalTrafficControl, originalSiteDetails, originalPipeSizeChange, originalStandardBypass, originalStandardBypassComments, originalTrafficControlDetails, originalMeasurementType, originalMeasurementFromMh, originalVideoDoneFromMh, originalVideoDoneToMh, originalMeasurementTakenByM2, originalDropPipe, originalDropPipeInvertDepth, originalCappedLaterals, originalLineWithId, originalHydrantAddress, originalHydroWireWithin10FtOfInversionMH, originalDistanceToInversionMh, originalSurfaceGrade, originalHydroPulley, originalFridgeCart, originalTwoPump, originalSixBypass, originalScaffolding, originalWinchExtension, originalExtraGenerator, originalGreyCableExtension, originalEasementMats, originalRampRequired, originalVideoLength, originalComments, originalPreFlushDate, originalPreVideoDate, originalRaWorkId, false, companyId, originalMaterial, originalCameraSkid, originalAccessType, originalP1Completed, newClientId, newProposedLiningDate, newDeadlineLiningDate, newP1Date, newM1Date, newM2Date, newInstallDate, newFinalVideoDate, newIssueIdentified, newIssueLFS, newIssueClient, newIssueSales, newIssueGivenToClient, newIssueResolved, newIssueInvestigation, newCxisRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementTakenBy, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardBypass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasurementFromMh, newVideoDoneFromMh, newVideoDoneToMh, newMeasurementTakenByM2, newDropPipe, newDropPipeInvertDepth, newCappedLaterals, newLineWithId, newHydrantAddress, newHydroWireWithin10FtOfInversionMH, newDistanceToInversionMh, newSurfaceGrade, newHydroPulley, newFridgeCart, newTwoPump, newSixBypass, newScaffolding, newWinchExtension, newExtraGenerator, newGreyCableExtension, newEasementMats, newRampRequired, newVideoLength, newComments, newPreFlushDate, newPreVideoDate, newRaWorkId, sectionAssetId, false, companyId, newCameraSkid, newAccessType, newP1Completed); // For wet out information if (includeWetOutInformation) { // Update data WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway(); workFullLengthLiningWetOutGateway.LoadByWorkId(workId, companyId); // ... Verify if work has wet out data information if (workFullLengthLiningWetOutGateway.Table.Rows.Count > 0) { // Wet Out data original values string originalLinerTube = fullLengthLiningWorkDetailsGateway.GetLinerTubeOriginal(workId); int originalResinID = fullLengthLiningWorkDetailsGateway.GetResinIdOriginal(workId); decimal originalExcessResin = fullLengthLiningWorkDetailsGateway.GetExcessResinOriginal(workId); string originalPoundsDrums = fullLengthLiningWorkDetailsGateway.GetPoundsDrumsOriginal(workId); decimal originalDrumDiameter = fullLengthLiningWorkDetailsGateway.GetDrumDiameterOriginal(workId); decimal originalHoistMaximumHeight = fullLengthLiningWorkDetailsGateway.GetHoistMaximumHeightOriginal(workId); decimal originalHoistMinimumHeight = fullLengthLiningWorkDetailsGateway.GetHoistMinimumHeightOriginal(workId); decimal originalDownDropTubeLenght = fullLengthLiningWorkDetailsGateway.GetDownDropTubeLenghtOriginal(workId); decimal originalPumpHeightAboveGround = fullLengthLiningWorkDetailsGateway.GetPumpHeightAboveGroundOriginal(workId); int originalTubeResinToFeltFactor = fullLengthLiningWorkDetailsGateway.GetTubeResinToFeltFactorOriginal(workId); DateTime originalDateOfSheet = fullLengthLiningWorkDetailsGateway.GetDateOfSheetOriginal(workId); int originalEmployeeID = fullLengthLiningWorkDetailsGateway.GetEmployeeIdOriginal(workId); string originalRunDetails = fullLengthLiningWorkDetailsGateway.GetRunDetailsOriginal(workId); string originalRunDetails2 = fullLengthLiningWorkDetailsGateway.GetRunDetails2Original(workId); DateTime originalWetOutDate = fullLengthLiningWorkDetailsGateway.GetWetOutDateOriginal(workId); DateTime? originalWetOutInstallDate = fullLengthLiningWorkDetailsGateway.GetWetOutInstallDateOriginal(workId); string originalThickness = fullLengthLiningWorkDetailsGateway.GetInversionThicknessOriginal(workId); decimal originalLengthToLine = fullLengthLiningWorkDetailsGateway.GetLengthToLineOriginal(workId); decimal originalPlusExtra = fullLengthLiningWorkDetailsGateway.GetPlusExtraOriginal(workId); decimal originalForTurnOffset = fullLengthLiningWorkDetailsGateway.GetForTurnOffsetOriginal(workId); decimal originalLengthToWetOut = fullLengthLiningWorkDetailsGateway.GetLengthToWetOutOriginal(workId); decimal originalTubeMaxColdHead = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHeadOriginal(workId); decimal originalTubeMaxColdHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHeadPsiOriginal(workId); decimal originalTubeMaxHotHead = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHeadOriginal(workId); decimal originalTubeMaxHotHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHeadPsiOriginal(workId); decimal originalTubeIdealHead = fullLengthLiningWorkDetailsGateway.GetTubeIdealHeadOriginal(workId); decimal originalTubeIdealHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeIdealHeadPsiOriginal(workId); decimal originalNetResinForTube = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeOriginal(workId); decimal originalNetResinForTubeUsgals = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgalsOriginal(workId); string originalNetResinForTubeDrumsIns = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeDrumsInsOriginal(workId); decimal originalNetResinForTubeLbsFt = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeLbsFtOriginal(workId); decimal originalNetResinForTubeUsgFt = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgFtOriginal(workId); int originalExtraResinForMix = fullLengthLiningWorkDetailsGateway.GetExtraResinForMixOriginal(workId); decimal originalExtraLbsForMix = fullLengthLiningWorkDetailsGateway.GetExtraLbsForMixOriginal(workId); decimal originalTotalMixQuantity = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityOriginal(workId); decimal originalTotalMixQuantityUsgals = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityUsgalsOriginal(workId); string originalTotalMixQuantityDrumsIns = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityDrumsInsOriginal(workId); string originalInversionType = fullLengthLiningWorkDetailsGateway.GetInversionTypeOriginal(workId); decimal originalDepthOfInversionMH = fullLengthLiningWorkDetailsGateway.GetDepthOfInversionMHOriginal(workId); decimal originalTubeForColumn = fullLengthLiningWorkDetailsGateway.GetTubeForColumnOriginal(workId); decimal originalTubeForStartDry = fullLengthLiningWorkDetailsGateway.GetTubeForStartDryOriginal(workId); decimal originalTotalTube = fullLengthLiningWorkDetailsGateway.GetTotalTubeOriginal(workId); string originalDropTubeConnects = fullLengthLiningWorkDetailsGateway.GetDropTubeConnectsOriginal(workId); decimal originalAllowsHeadTo = fullLengthLiningWorkDetailsGateway.GetAllowsHeadToOriginal(workId); decimal originalRollerGap = fullLengthLiningWorkDetailsGateway.GetRollerGapOriginal(workId); decimal originalHeightNeeded = fullLengthLiningWorkDetailsGateway.GetHeightNeededOriginal(workId); string originalAvailable = fullLengthLiningWorkDetailsGateway.GetAvailableOriginal(workId); string originalHoistHeight = fullLengthLiningWorkDetailsGateway.GetHoistHeightOriginal(workId); string originalCommentsCipp = fullLengthLiningWorkDetailsGateway.GetCommentsCippOriginal(workId); string originalResinLabel = fullLengthLiningWorkDetailsGateway.GetResinsLabelOriginal(workId); string originalDrumContainsLabel = fullLengthLiningWorkDetailsGateway.GetDrumContainsLabelOriginal(workId); string originalLinerTubeLabel = fullLengthLiningWorkDetailsGateway.GetLinerTubeLabelOriginal(workId); string originalForLbDrumsLabel = fullLengthLiningWorkDetailsGateway.GetForLbDrumsLabelOriginal(workId); string originalNetResinLabel = fullLengthLiningWorkDetailsGateway.GetNetResinLabelOriginal(workId); string originalCatalystLabel = fullLengthLiningWorkDetailsGateway.GetCatalystLabelOriginal(workId); // Wet Out new data string newLinerTube = fullLengthLiningWorkDetailsGateway.GetLinerTube(workId); int newResinID = fullLengthLiningWorkDetailsGateway.GetResinId(workId); decimal newExcessResin = fullLengthLiningWorkDetailsGateway.GetExcessResin(workId); string newPoundsDrums = fullLengthLiningWorkDetailsGateway.GetPoundsDrums(workId); decimal newDrumDiameter = fullLengthLiningWorkDetailsGateway.GetDrumDiameter(workId); decimal newHoistMaximumHeight = fullLengthLiningWorkDetailsGateway.GetHoistMaximumHeight(workId); decimal newHoistMinimumHeight = fullLengthLiningWorkDetailsGateway.GetHoistMinimumHeight(workId); decimal newDownDropTubeLenght = fullLengthLiningWorkDetailsGateway.GetDownDropTubeLenght(workId); decimal newPumpHeightAboveGround = fullLengthLiningWorkDetailsGateway.GetPumpHeightAboveGround(workId); int newTubeResinToFeltFactor = fullLengthLiningWorkDetailsGateway.GetTubeResinToFeltFactor(workId); DateTime newDateOfSheet = fullLengthLiningWorkDetailsGateway.GetDateOfSheet(workId); int newEmployeeID = fullLengthLiningWorkDetailsGateway.GetEmployeeId(workId); string newRunDetails = fullLengthLiningWorkDetailsGateway.GetRunDetails(workId); string newRunDetails2 = fullLengthLiningWorkDetailsGateway.GetRunDetails2(workId); DateTime newWetOutDate = fullLengthLiningWorkDetailsGateway.GetWetOutDate(workId); DateTime? newWetOutInstallDate = fullLengthLiningWorkDetailsGateway.GetWetOutInstallDate(workId); string newThickness = fullLengthLiningWorkDetailsGateway.GetInversionThickness(workId); decimal newLengthToLine = fullLengthLiningWorkDetailsGateway.GetLengthToLine(workId); decimal newPlusExtra = fullLengthLiningWorkDetailsGateway.GetPlusExtra(workId); decimal newForTurnOffset = fullLengthLiningWorkDetailsGateway.GetForTurnOffset(workId); decimal newLengthToWetOut = fullLengthLiningWorkDetailsGateway.GetLengthToWetOut(workId); decimal newTubeMaxColdHead = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHead(workId); decimal newTubeMaxColdHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHeadPsi(workId); decimal newTubeMaxHotHead = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHead(workId); decimal newTubeMaxHotHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHeadPsi(workId); decimal newTubeIdealHead = fullLengthLiningWorkDetailsGateway.GetTubeIdealHead(workId); decimal newTubeIdealHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeIdealHeadPsi(workId); decimal newNetResinForTube = fullLengthLiningWorkDetailsGateway.GetNetResinForTube(workId); decimal newNetResinForTubeUsgals = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgals(workId); string newNetResinForTubeDrumsIns = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeDrumsIns(workId); decimal newNetResinForTubeLbsFt = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeLbsFt(workId); decimal newNetResinForTubeUsgFt = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgFt(workId); int newExtraResinForMix = fullLengthLiningWorkDetailsGateway.GetExtraResinForMix(workId); decimal newExtraLbsForMix = fullLengthLiningWorkDetailsGateway.GetExtraLbsForMix(workId); decimal newTotalMixQuantity = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantity(workId); decimal newTotalMixQuantityUsgals = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityUsgals(workId); string newTotalMixQuantityDrumsIns = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityDrumsIns(workId); string newInversionType = fullLengthLiningWorkDetailsGateway.GetInversionType(workId); decimal newDepthOfInversionMH = fullLengthLiningWorkDetailsGateway.GetDepthOfInversionMH(workId); decimal newTubeForColumn = fullLengthLiningWorkDetailsGateway.GetTubeForColumn(workId); decimal newTubeForStartDry = fullLengthLiningWorkDetailsGateway.GetTubeForStartDry(workId); decimal newTotalTube = fullLengthLiningWorkDetailsGateway.GetTotalTube(workId); string newDropTubeConnects = fullLengthLiningWorkDetailsGateway.GetDropTubeConnects(workId); decimal newAllowsHeadTo = fullLengthLiningWorkDetailsGateway.GetAllowsHeadTo(workId); decimal newRollerGap = fullLengthLiningWorkDetailsGateway.GetRollerGap(workId); decimal newHeightNeeded = fullLengthLiningWorkDetailsGateway.GetHeightNeeded(workId); string newAvailable = fullLengthLiningWorkDetailsGateway.GetAvailable(workId); string newHoistHeight = fullLengthLiningWorkDetailsGateway.GetHoistHeight(workId); string newCommentsCipp = fullLengthLiningWorkDetailsGateway.GetCommentsCipp(workId); string newResinLabel = fullLengthLiningWorkDetailsGateway.GetResinsLabel(workId); string newDrumContainsLabel = fullLengthLiningWorkDetailsGateway.GetDrumContainsLabel(workId); string newLinerTubeLabel = fullLengthLiningWorkDetailsGateway.GetLinerTubeLabel(workId); string newForLbDrumsLabel = fullLengthLiningWorkDetailsGateway.GetForLbDrumsLabel(workId); string newNetResinLabel = fullLengthLiningWorkDetailsGateway.GetNetResinLabel(workId); string newCatalystLabel = fullLengthLiningWorkDetailsGateway.GetCatalystLabel(workId); string originalInversionComment = ""; string originalPipeType = ""; string originalPipeCondition = ""; string originalGroundMoisture = ""; decimal originalBoilerSize = 0m; decimal originalPumpTotalCapacity = 0m; decimal originalLayFlatSize = 0m; decimal originalLayFlatQuantityTotal = 0m; decimal originalWaterStartTemp = 0m; decimal originalTemp1 = 0m; decimal originalHoldAtT1 = 0m; decimal originalTempT2 = 0m; decimal originalCookAtT2 = 0m; decimal originalCoolDownFor = 0m; decimal originalCoolToTemp = 0m; decimal originalDropInPipeRun = 0m; decimal originalPipeSlopOf = 0m; decimal originalF45F120 = 0m; decimal originalHold = 0m; decimal originalF120F185 = 0m; decimal originalCookTime = 0m; decimal originalCoolTime = 0m; decimal originalAproxTotal = 0m; decimal originalWaterChangesPerHour = 0m; decimal originalReturnWaterVelocity = 0m; decimal originalLayflatBackPressure = 0m; decimal originalPumpLiftAtIdealHead = 0m; decimal originalWaterToFillLinerColumn = 0m; decimal originalWaterPerFit = 0m; string originalInstallationResults = ""; string originalInversionLinerTubeLabel = ""; string originalHeadsIdealLabel = ""; string originalPumpingAndCirculationLabel = ""; // Inversion new Data string newInversionComment = ""; string newPipeType = ""; string newPipeCondition = ""; string newGroundMoisture = ""; decimal newBoilerSize = 0m; decimal newPumpTotalCapacity = 0m; decimal newLayFlatSize = 0m; decimal newLayFlatQuantityTotal = 0m; decimal newWaterStartTemp = 0m; decimal newTemp1 = 0m; decimal newHoldAtT1 = 0m; decimal newTempT2 = 0m; decimal newCookAtT2 = 0m; decimal newCoolDownFor = 0m; decimal newCoolToTemp = 0m; decimal newDropInPipeRun = 0m; decimal newPipeSlopOf = 0m; decimal newF45F120 = 0m; decimal newHold = 0m; decimal newF120F185 = 0m; decimal newCookTime = 0m; decimal newCoolTime = 0m; decimal newAproxTotal = 0m; decimal newWaterChangesPerHour = 0m; decimal newReturnWaterVelocity = 0m; decimal newLayflatBackPressure = 0m; decimal newPumpLiftAtIdealHead = 0m; decimal newWaterToFillLinerColumn = 0m; decimal newWaterPerFit = 0m; string newInstallationResults = ""; string newInversionLinerTubeLabel = ""; string newHeadsIdealLabel = ""; string newPumpingAndCirculationLabel = ""; if (includeInversionInformation) { // InversionData original values originalInversionComment = fullLengthLiningWorkDetailsGateway.GetInversionCommentOriginal(workId); originalPipeType = fullLengthLiningWorkDetailsGateway.GetPipeTypeOriginal(workId); originalPipeCondition = fullLengthLiningWorkDetailsGateway.GetPipeConditionOriginal(workId); originalGroundMoisture = fullLengthLiningWorkDetailsGateway.GetGroundMoistureOriginal(workId); originalBoilerSize = fullLengthLiningWorkDetailsGateway.GetBoilerSizeOriginal(workId); originalPumpTotalCapacity = fullLengthLiningWorkDetailsGateway.GetPumpTotalCapacityOriginal(workId); originalLayFlatSize = fullLengthLiningWorkDetailsGateway.GetLayFlatSizeOriginal(workId); originalLayFlatQuantityTotal = fullLengthLiningWorkDetailsGateway.GetLayFlatQuantityTotalOriginal(workId); originalWaterStartTemp = fullLengthLiningWorkDetailsGateway.GetWaterStartTempOriginal(workId); originalTemp1 = fullLengthLiningWorkDetailsGateway.GetTemp1Original(workId); originalHoldAtT1 = fullLengthLiningWorkDetailsGateway.GetHoldAtT1Original(workId); originalTempT2 = fullLengthLiningWorkDetailsGateway.GetTempT2Original(workId); originalCookAtT2 = fullLengthLiningWorkDetailsGateway.GetCookAtT2Original(workId); originalCoolDownFor = fullLengthLiningWorkDetailsGateway.GetCoolDownForOriginal(workId); originalCoolToTemp = fullLengthLiningWorkDetailsGateway.GetCoolToTempOriginal(workId); originalDropInPipeRun = fullLengthLiningWorkDetailsGateway.GetDropInPipeRunOriginal(workId); originalPipeSlopOf = fullLengthLiningWorkDetailsGateway.GetPipeSlopOfOriginal(workId); originalF45F120 = fullLengthLiningWorkDetailsGateway.GetF45F120Original(workId); originalHold = fullLengthLiningWorkDetailsGateway.GetHoldOriginal(workId); originalF120F185 = fullLengthLiningWorkDetailsGateway.GetF120F185Original(workId); originalCookTime = fullLengthLiningWorkDetailsGateway.GetCookTimeOriginal(workId); originalCoolTime = fullLengthLiningWorkDetailsGateway.GetCoolTimeOriginal(workId); originalAproxTotal = fullLengthLiningWorkDetailsGateway.GetAproxTotalOriginal(workId); originalWaterChangesPerHour = fullLengthLiningWorkDetailsGateway.GetWaterChangesPerHourOriginal(workId); originalReturnWaterVelocity = fullLengthLiningWorkDetailsGateway.GetReturnWaterVelocityOriginal(workId); originalLayflatBackPressure = fullLengthLiningWorkDetailsGateway.GetLayflatBackPressureOriginal(workId); originalPumpLiftAtIdealHead = fullLengthLiningWorkDetailsGateway.GetPumpLiftAtIdealHeadOriginal(workId); originalWaterToFillLinerColumn = fullLengthLiningWorkDetailsGateway.GetWaterToFillLinerColumnOriginal(workId); originalWaterPerFit = fullLengthLiningWorkDetailsGateway.GetWaterPerFitOriginal(workId); originalInstallationResults = fullLengthLiningWorkDetailsGateway.GetInstallationResultsOriginal(workId); originalInversionLinerTubeLabel = fullLengthLiningWorkDetailsGateway.GetInversionLinerTubeLabelOriginal(workId); originalHeadsIdealLabel = fullLengthLiningWorkDetailsGateway.GetHeadsIdealLabelOriginal(workId); originalPumpingAndCirculationLabel = fullLengthLiningWorkDetailsGateway.GetPumpingAndCirculationLabelOriginal(workId); // Inversion new Data newInversionComment = fullLengthLiningWorkDetailsGateway.GetInversionComment(workId); newPipeType = fullLengthLiningWorkDetailsGateway.GetPipeType(workId); newPipeCondition = fullLengthLiningWorkDetailsGateway.GetPipeCondition(workId); newGroundMoisture = fullLengthLiningWorkDetailsGateway.GetGroundMoisture(workId); newBoilerSize = fullLengthLiningWorkDetailsGateway.GetBoilerSize(workId); newPumpTotalCapacity = fullLengthLiningWorkDetailsGateway.GetPumpTotalCapacity(workId); newLayFlatSize = fullLengthLiningWorkDetailsGateway.GetLayFlatSize(workId); newLayFlatQuantityTotal = fullLengthLiningWorkDetailsGateway.GetLayFlatQuantityTotal(workId); newWaterStartTemp = fullLengthLiningWorkDetailsGateway.GetWaterStartTemp(workId); newTemp1 = fullLengthLiningWorkDetailsGateway.GetTemp1(workId); newHoldAtT1 = fullLengthLiningWorkDetailsGateway.GetHoldAtT1(workId); newTempT2 = fullLengthLiningWorkDetailsGateway.GetTempT2(workId); newCookAtT2 = fullLengthLiningWorkDetailsGateway.GetCookAtT2(workId); newCoolDownFor = fullLengthLiningWorkDetailsGateway.GetCoolDownFor(workId); newCoolToTemp = fullLengthLiningWorkDetailsGateway.GetCoolToTemp(workId); newDropInPipeRun = fullLengthLiningWorkDetailsGateway.GetDropInPipeRun(workId); newPipeSlopOf = fullLengthLiningWorkDetailsGateway.GetPipeSlopOf(workId); newF45F120 = fullLengthLiningWorkDetailsGateway.GetF45F120(workId); newHold = fullLengthLiningWorkDetailsGateway.GetHold(workId); newF120F185 = fullLengthLiningWorkDetailsGateway.GetF120F185(workId); newCookTime = fullLengthLiningWorkDetailsGateway.GetCookTime(workId); newCoolTime = fullLengthLiningWorkDetailsGateway.GetCoolTime(workId); newAproxTotal = fullLengthLiningWorkDetailsGateway.GetAproxTotal(workId); newWaterChangesPerHour = fullLengthLiningWorkDetailsGateway.GetWaterChangesPerHour(workId); newReturnWaterVelocity = fullLengthLiningWorkDetailsGateway.GetReturnWaterVelocity(workId); newLayflatBackPressure = fullLengthLiningWorkDetailsGateway.GetLayflatBackPressure(workId); newPumpLiftAtIdealHead = fullLengthLiningWorkDetailsGateway.GetPumpLiftAtIdealHead(workId); newWaterToFillLinerColumn = fullLengthLiningWorkDetailsGateway.GetWaterToFillLinerColumn(workId); newWaterPerFit = fullLengthLiningWorkDetailsGateway.GetWaterPerFit(workId); newInstallationResults = fullLengthLiningWorkDetailsGateway.GetInstallationResults(workId); newInversionLinerTubeLabel = fullLengthLiningWorkDetailsGateway.GetInversionLinerTubeLabel(workId); newHeadsIdealLabel = fullLengthLiningWorkDetailsGateway.GetHeadsIdealLabel(workId); newPumpingAndCirculationLabel = fullLengthLiningWorkDetailsGateway.GetPumpingAndCirculationLabel(workId); } // Get All sectionIds for insert string runDetails = row.RunDetails; string[] runDetailsList = runDetails.Split('>'); for (int i = 0; i < runDetailsList.Length; i++) { AssetSewerSectionGateway assetSewerSectionGateway = new AssetSewerSectionGateway(); string sectionId = runDetailsList[i].ToString(); assetSewerSectionGateway.LoadBySectionId(sectionId, companyId); int assetId = assetSewerSectionGateway.GetAssetID(sectionId); WorkGateway workGateway = new WorkGateway(); int newWorkId = 0; workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Full Length Lining", companyId); if (workGateway.Table.Rows.Count > 0) { newWorkId = workGateway.GetWorkId(assetId, "Full Length Lining", projectId); } WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGatewayForReview = new WorkFullLengthLiningWetOutGateway(); workFullLengthLiningWetOutGatewayForReview.LoadByWorkId(newWorkId, companyId); if (workFullLengthLiningWetOutGatewayForReview.Table.Rows.Count > 0) { // Update work with cipp information UpdateWorkWetOutInformation(newWorkId, originalLinerTube, originalResinID, originalExcessResin, originalPoundsDrums, originalDrumDiameter, originalHoistMaximumHeight, originalHoistMinimumHeight, originalDownDropTubeLenght, originalPumpHeightAboveGround, originalTubeResinToFeltFactor, originalDateOfSheet, originalEmployeeID, originalRunDetails, originalRunDetails2, originalWetOutDate, originalWetOutInstallDate, originalThickness, originalLengthToLine, originalPlusExtra, originalForTurnOffset, originalLengthToWetOut, originalTubeMaxColdHead, originalTubeMaxColdHeadPsi, originalTubeMaxHotHead, originalTubeMaxHotHeadPsi, originalTubeIdealHead, originalTubeIdealHeadPsi, originalNetResinForTube, originalNetResinForTubeUsgals, originalNetResinForTubeDrumsIns, originalNetResinForTubeLbsFt, originalNetResinForTubeUsgFt, originalExtraResinForMix, originalExtraLbsForMix, originalTotalMixQuantity, originalTotalMixQuantityUsgals, originalTotalMixQuantityDrumsIns, originalInversionType, originalDepthOfInversionMH, originalTubeForColumn, originalTubeForStartDry, originalTotalTube, originalDropTubeConnects, originalAllowsHeadTo, originalRollerGap, originalHeightNeeded, originalAvailable, originalHoistHeight, originalCommentsCipp, originalResinLabel, originalDrumContainsLabel, originalLinerTubeLabel, originalForLbDrumsLabel, originalNetResinLabel, originalCatalystLabel, originalInversionComment, originalPipeType, originalPipeCondition, originalGroundMoisture, originalBoilerSize, originalPumpTotalCapacity, originalLayFlatSize, originalLayFlatQuantityTotal, originalWaterStartTemp, originalTemp1, originalHoldAtT1, originalTempT2, originalCookAtT2, originalCoolDownFor, originalCoolToTemp, originalDropInPipeRun, originalPipeSlopOf, originalF45F120, originalHold, originalF120F185, originalCookTime, originalCoolTime, originalAproxTotal, originalWaterChangesPerHour, originalReturnWaterVelocity, originalLayflatBackPressure, originalPumpLiftAtIdealHead, originalWaterToFillLinerColumn, originalWaterPerFit, originalInstallationResults, originalInversionLinerTubeLabel, originalHeadsIdealLabel, originalPumpingAndCirculationLabel, false, companyId, newLinerTube, newResinID, newExcessResin, newPoundsDrums, newDrumDiameter, newHoistMaximumHeight, newHoistMinimumHeight, newDownDropTubeLenght, newPumpHeightAboveGround, newTubeResinToFeltFactor, newDateOfSheet, newEmployeeID, newRunDetails, newRunDetails2, newWetOutDate, newWetOutInstallDate, newThickness, 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, false, companyId, includeWetOutInformation, includeInversionInformation); } else { // ... Insert wet out data string inversionComment = fullLengthLiningWorkDetailsGateway.GetInversionComment(workId); string installationResults = fullLengthLiningWorkDetailsGateway.GetInstallationResults(workId); DateTime? wetOutInstallDate = fullLengthLiningWorkDetailsGateway.GetWetOutInstallDate(workId); InsertWorkWetOutInformation(newWorkId, row.LinerTube, row.ResinID, row.ExcessResin, row.PoundsDrums, row.DrumDiameter, row.HoistMaximumHeight, row.HoistMinimumHeight, row.DownDropTubeLenght, row.PumpHeightAboveGround, row.TubeResinToFeltFactor, row.DateOfSheet, row.EmployeeID, row.RunDetails, row.RunDetails2, row.WetOutDate, wetOutInstallDate, row.Thickness, row.LengthToLine, row.PlusExtra, row.ForTurnOffset, row.LengthToWetOut, row.TubeMaxColdHead, row.TubeMaxColdHeadPsi, row.TubeMaxHotHead, row.TubeMaxHotHeadPsi, row.TubeIdealHead, row.TubeIdealHeadPsi, row.NetResinForTube, row.NetResinForTubeUsgals, row.NetResinForTubeDrumsIns, row.NetResinForTubeLbsFt, row.NetResinForTubeUsgFt, row.ExtraResinForMix, row.ExtraLbsForMix, row.TotalMixQuantity, row.TotalMixQuantityUsgals, row.TotalMixQuantityDrumsIns, row.InversionType, row.DepthOfInversionMH, row.TubeForColumn, row.TubeForStartDry, row.TotalTube, row.DropTubeConnects, row.AllowsHeadTo, row.RollerGap, row.HeightNeeded, row.Available, row.HoistHeight, row.CommentsCipp, row.ResinsLabel, row.DrumContainsLabel, row.LinerTubeLabel, row.ForLbDrumsLabel, row.NetResinLabel, row.CatalystLabel, inversionComment, row.PipeType, row.PipeCondition, row.GroundMoisture, row.BoilerSize, row.PumpTotalCapacity, row.LayFlatSize, row.LayFlatQuantityTotal, row.WaterStartTemp, row.Temp1, row.HoldAtT1, row.TempT2, row.CookAtT2, row.CoolDownFor, row.CoolToTemp, row.DropInPipeRun, row.PipeSlopOf, row.F45F120, row.Hold, row.F120F185, row.CookTime, row.CoolTime, row.AproxTotal, row.WaterChangesPerHour, row.ReturnWaterVelocity, row.LayflatBackPressure, row.PumpLiftAtIdealHead, row.WaterToFillLinerColumn, row.WaterPerFit, installationResults, row.InversionLinerTubeLabel, row.HeadsIdealLabel, row.PumpingAndCirculationLabel, row.Deleted, row.COMPANY_ID, includeWetOutInformation, includeInversionInformation); } } } else { // Get All sectionIds for insert string runDetails = row.RunDetails; string[] runDetailsList = runDetails.Split('>'); for (int i = 0; i < runDetailsList.Length; i++) { AssetSewerSectionGateway assetSewerSectionGateway = new AssetSewerSectionGateway(); string sectionId = runDetailsList[i].ToString(); assetSewerSectionGateway.LoadBySectionId(sectionId, companyId); int assetId = assetSewerSectionGateway.GetAssetID(sectionId); WorkGateway workGateway = new WorkGateway(); workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Full Length Lining", companyId); if (workGateway.Table.Rows.Count > 0) { int newWorkId = workGateway.GetWorkId(assetId, "Full Length Lining", projectId); // ... Insert wet out data string inversionComment = fullLengthLiningWorkDetailsGateway.GetInversionComment(workId); string installationResults = fullLengthLiningWorkDetailsGateway.GetInstallationResults(workId); DateTime? wetOutInstallDate = fullLengthLiningWorkDetailsGateway.GetWetOutInstallDate(workId); InsertWorkWetOutInformation(newWorkId, row.LinerTube, row.ResinID, row.ExcessResin, row.PoundsDrums, row.DrumDiameter, row.HoistMaximumHeight, row.HoistMinimumHeight, row.DownDropTubeLenght, row.PumpHeightAboveGround, row.TubeResinToFeltFactor, row.DateOfSheet, row.EmployeeID, row.RunDetails, row.RunDetails2, row.WetOutDate, wetOutInstallDate, row.Thickness, row.LengthToLine, row.PlusExtra, row.ForTurnOffset, row.LengthToWetOut, row.TubeMaxColdHead, row.TubeMaxColdHeadPsi, row.TubeMaxHotHead, row.TubeMaxHotHeadPsi, row.TubeIdealHead, row.TubeIdealHeadPsi, row.NetResinForTube, row.NetResinForTubeUsgals, row.NetResinForTubeDrumsIns, row.NetResinForTubeLbsFt, row.NetResinForTubeUsgFt, row.ExtraResinForMix, row.ExtraLbsForMix, row.TotalMixQuantity, row.TotalMixQuantityUsgals, row.TotalMixQuantityDrumsIns, row.InversionType, row.DepthOfInversionMH, row.TubeForColumn, row.TubeForStartDry, row.TotalTube, row.DropTubeConnects, row.AllowsHeadTo, row.RollerGap, row.HeightNeeded, row.Available, row.HoistHeight, row.CommentsCipp, row.ResinsLabel, row.DrumContainsLabel, row.LinerTubeLabel, row.ForLbDrumsLabel, row.NetResinLabel, row.CatalystLabel, inversionComment, row.PipeType, row.PipeCondition, row.GroundMoisture, row.BoilerSize, row.PumpTotalCapacity, row.LayFlatSize, row.LayFlatQuantityTotal, row.WaterStartTemp, row.Temp1, row.HoldAtT1, row.TempT2, row.CookAtT2, row.CoolDownFor, row.CoolToTemp, row.DropInPipeRun, row.PipeSlopOf, row.F45F120, row.Hold, row.F120F185, row.CookTime, row.CoolTime, row.AproxTotal, row.WaterChangesPerHour, row.ReturnWaterVelocity, row.LayflatBackPressure, row.PumpLiftAtIdealHead, row.WaterToFillLinerColumn, row.WaterPerFit, installationResults, row.InversionLinerTubeLabel, row.HeadsIdealLabel, row.PumpingAndCirculationLabel, row.Deleted, row.COMPANY_ID, includeWetOutInformation, includeInversionInformation); } } } } // Update JL Section WorkID int sectionWorkId = 0; WorkGateway workGatewayForJL = new WorkGateway(); workGatewayForJL.LoadByProjectIdAssetIdWorkType(projectId, sectionAssetId, "Junction Lining Section", companyId); if (workGatewayForJL.Table.Rows.Count > 0) { sectionWorkId = workGatewayForJL.GetWorkId(sectionAssetId, "Junction Lining Section", projectId); WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway(); workJunctionLiningSectionGateway.LoadByWorkId(sectionWorkId, companyId); // get old values of section int numLats = workJunctionLiningSectionGateway.GetNumLats(sectionWorkId); int notLinedYet = workJunctionLiningSectionGateway.GetNotLinedYet(sectionWorkId); bool allMeasured = workJunctionLiningSectionGateway.GetAllMeasured(sectionWorkId); bool deleted = workJunctionLiningSectionGateway.GetDeleted(sectionWorkId); string issueWithLaterals = workJunctionLiningSectionGateway.GetIssueWithLaterals(sectionWorkId); int notMeasuredYet = workJunctionLiningSectionGateway.GetNotMeasuredYet(sectionWorkId); int notDeliveredYet = workJunctionLiningSectionGateway.GetNotDeliveredYet(sectionWorkId); string trafficControl = workJunctionLiningSectionGateway.GetTrafficControl(sectionWorkId); string trafficControlDetails = workJunctionLiningSectionGateway.GetTrafficControlDetails(sectionWorkId); bool standardBypass = workJunctionLiningSectionGateway.GetStandardBypass(sectionWorkId); string standardBypassComments = workJunctionLiningSectionGateway.GetStandardBypassComments(sectionWorkId); int availableToLine = workJunctionLiningSectionGateway.GetAvailableToLine(sectionWorkId); WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.UpdateDirect(sectionWorkId, numLats, notLinedYet, allMeasured, deleted, issueWithLaterals, notMeasuredYet, notDeliveredYet, companyId, trafficControl, trafficControlDetails, standardBypass, standardBypassComments, availableToLine, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, newTrafficControl, newTrafficControlDetails, newStandardBypass, newStandardBypassComments, availableToLine); } } } }
/// <summary> /// Save a Previous JL work /// </summary> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="companyId">companyId</param> private void SavePreviousJLWork(int projectId, int section_assetId, int companyId) { // Load Previous work - Junction Lining section data (last sections work) string workType = "Junction Lining Section"; WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway(); workJunctionLiningSectionGateway.LoadTop1ByProjectIdAssetIdWorkType(projectId, section_assetId, workType, companyId); int workId = workJunctionLiningSectionGateway.GetWorkIdTop1(); int numLats = workJunctionLiningSectionGateway.GetNumLats(workId); int notLinedYet = workJunctionLiningSectionGateway.GetNotLinedYet(workId); Boolean allMeasured = workJunctionLiningSectionGateway.GetAllMeasured(workId); string issueWithLaterals = workJunctionLiningSectionGateway.GetIssueWithLaterals(workId); int notMeasuredYet = workJunctionLiningSectionGateway.GetNotMeasuredYet(workId); int notDeliveredYet = workJunctionLiningSectionGateway.GetNotDeliveredYet(workId); string trafficControl = ""; if (workJunctionLiningSectionGateway.GetTrafficControl(workId) != "") trafficControl = workJunctionLiningSectionGateway.GetTrafficControl(workId); string trafficControlDetails = ""; if (workJunctionLiningSectionGateway.GetTrafficControlDetails(workId) != "") trafficControlDetails = workJunctionLiningSectionGateway.GetTrafficControlDetails(workId); Boolean standardBypass = workJunctionLiningSectionGateway.GetStandardBypass(workId); string standardBypassComments = ""; if (workJunctionLiningSectionGateway.GetStandardBypassComments(workId) != "") standardBypassComments = workJunctionLiningSectionGateway.GetStandardBypassComments(workId); int availableToLine = workJunctionLiningSectionGateway.GetAvailableToLine(workId); // Load Previous work - General work data WorkGateway workGateway = new WorkGateway(); workGateway.LoadByWorkId(workId, companyId); int? libraryCategoriesId = null; if (workGateway.GetLibraryCategoriesId(workId).HasValue) libraryCategoriesId = workGateway.GetLibraryCategoriesId(workId); string comments = workGateway.GetComments(workId); string history = workGateway.GetHistory(workId); // Save new work WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); int newSectionWorkId = workJunctionLiningSection.InsertDirect(projectId, section_assetId, libraryCategoriesId, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, false, companyId, comments, history, trafficControl, trafficControlDetails, standardBypass, standardBypassComments, availableToLine); // Load Previous work - Junction Lining Lateral data WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); workJunctionLiningLateralGateway.LoadBySectionWorkId(workId, companyId); foreach (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALRow lateralRow in (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALDataTable)workJunctionLiningLateralGateway.Table) { WorkGateway workGatewayForLateral = new WorkGateway(); workGatewayForLateral.LoadByWorkId(lateralRow.WorkID, companyId); int lateral_assetId = workGatewayForLateral.GetAssetId(lateralRow.WorkID); DateTime? pipeLocated = null; if (!lateralRow.IsPipeLocatedNull()) pipeLocated = lateralRow.PipeLocated; DateTime? sevicesLocated = null; if (!lateralRow.IsServicesLocatedNull()) sevicesLocated = lateralRow.ServicesLocated; DateTime? coInstalled = null; if (!lateralRow.IsCoInstalledNull()) coInstalled = lateralRow.CoInstalled; DateTime? backfilledConcrete = null; if (!lateralRow.IsBackfilledConcreteNull()) backfilledConcrete = lateralRow.BackfilledConcrete; DateTime? backfilledSoil = null; if (!lateralRow.IsBackfilledSoilNull()) backfilledSoil = lateralRow.BackfilledSoil; DateTime? grouted = null; if (!lateralRow.IsGroutedNull()) grouted = lateralRow.Grouted; DateTime? cored = null; if (!lateralRow.IsCoredNull()) cored = lateralRow.Cored; DateTime? prepped = null; if (!lateralRow.IsPreppedNull()) prepped = lateralRow.Prepped; DateTime? measured = null; if (!lateralRow.IsMeasuredNull()) measured = lateralRow.Measured; string linerSize = ""; if (!lateralRow.IsLinerSizeNull()) linerSize = lateralRow.LinerSize; DateTime? inProcess = null; if (!lateralRow.IsInProcessNull()) inProcess = lateralRow.InProcess; DateTime? inStock = null; if (!lateralRow.IsInStockNull()) inStock = lateralRow.InStock; DateTime? delivered = null; if (!lateralRow.IsDeliveredNull()) delivered = lateralRow.Delivered; int? buildRebuild = null; if (!lateralRow.IsBuildRebuildNull()) buildRebuild = lateralRow.BuildRebuild; DateTime? preVideo = null; if (!lateralRow.IsPreVideoNull()) preVideo = lateralRow.PreVideo; DateTime? linerInstalled = null; if (!lateralRow.IsLinerInstalledNull()) linerInstalled = lateralRow.LinerInstalled; DateTime? finalVideo = null; if (!lateralRow.IsFinalVideoNull()) finalVideo = lateralRow.FinalVideo; decimal? cost = null; if (!lateralRow.IsCostNull()) cost = lateralRow.Cost; DateTime? videoInspection = null; if (!lateralRow.IsVideoInspectionNull()) videoInspection = lateralRow.VideoInspection; bool coRequired = lateralRow.CoRequired; bool pitRequired = lateralRow.PitRequired; string coPitLocation = ""; if (!lateralRow.IsCoPitLocationNull()) coPitLocation = lateralRow.CoPitLocation; bool postContractDigRequired = lateralRow.PostContractDigRequired; DateTime? coCutDown = null; if (!lateralRow.IsCoCutDownNull()) coCutDown = lateralRow.CoCutDown; DateTime? finalRestoration = null; if (!lateralRow.IsFinalRestorationNull()) finalRestoration = lateralRow.FinalRestoration; string videoLengthToPropertyLine = ""; if (!lateralRow.IsVideoLengthToPropertyLineNull()) videoLengthToPropertyLine = lateralRow.VideoLengthToPropertyLine; bool liningThruCo = lateralRow.LiningThruCo; DateTime? noticeDelivered = null; if (!lateralRow.IsNoticeDeliveredNull()) noticeDelivered = lateralRow.NoticeDelivered; string hamiltonInspectionNumber = ""; if (!lateralRow.IsHamiltonInspectionNumberNull()) hamiltonInspectionNumber = lateralRow.HamiltonInspectionNumber; string flange = ""; if (!lateralRow.IsFlangeNull()) flange = lateralRow.Flange; string gasket = ""; if (!lateralRow.IsGasketNull()) gasket = lateralRow.Gasket; string depthOfLocated = ""; if (!lateralRow.IsDepthOfLocatedNull()) depthOfLocated = lateralRow.DepthOfLocated; bool digRequiredPriorToLining = lateralRow.DigRequiredPriorToLining; DateTime? digRequiredPriorToLiningCompleted = null; if (!lateralRow.IsDigRequiredPriorToLiningCompletedNull()) digRequiredPriorToLiningCompleted = lateralRow.DigRequiredPriorToLiningCompleted; bool digRequiredAfterLining = lateralRow.DigRequiredAfterLining; DateTime? digRequiredAfterLiningCompleted = null; if (!lateralRow.IsDigRequiredAfterLiningCompletedNull()) digRequiredAfterLiningCompleted = lateralRow.DigRequiredAfterLiningCompleted; bool outOfScope = lateralRow.OutOfScope; bool holdClientIssue = lateralRow.HoldClientIssue; DateTime? holdClientIssueResolved = null; if (!lateralRow.IsHoldClientIssueResolvedNull()) holdClientIssueResolved = lateralRow.HoldClientIssueResolved; bool holdLFSIssue = lateralRow.HoldLFSIssue; DateTime? holdLFSIssueResolved = null; if (!lateralRow.IsHoldLFSIssueResolvedNull()) holdLFSIssueResolved = lateralRow.HoldLFSIssueResolved; bool requiresRoboticPrep = lateralRow.LateralRequiresRoboticPrep; DateTime? requiresRoboticPrepCompleted = null; if (!lateralRow.IsLateralRequiresRoboticPrepCompletedNull()) requiresRoboticPrepCompleted = lateralRow.LateralRequiresRoboticPrepCompleted; string linerType = ""; if (!lateralRow.IsLinerTypeNull()) linerType = lateralRow.LinerType; string prepType = ""; if (!lateralRow.IsPrepTypeNull()) prepType = lateralRow.PrepType; bool dyeTestReq = lateralRow.DyeTestReq; DateTime? dyeTestComplete = null; if (!lateralRow.IsDyeTestCompleteNull()) dyeTestComplete = lateralRow.DyeTestComplete; string contractYear = ""; if (!lateralRow.IsContractYearNull()) contractYear = lateralRow.ContractYear; WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(null); workJunctionLiningLateral.InsertDirect(projectId, lateral_assetId, newSectionWorkId, pipeLocated, sevicesLocated, coInstalled, backfilledConcrete, backfilledSoil, grouted, cored, prepped, measured, linerSize, inProcess, inStock, delivered, buildRebuild, preVideo, linerInstalled, finalVideo, cost, videoInspection, coRequired, pitRequired, coPitLocation, postContractDigRequired, coCutDown, finalRestoration, false, companyId, comments, history, videoLengthToPropertyLine, liningThruCo, noticeDelivered, hamiltonInspectionNumber, flange, gasket, depthOfLocated, digRequiredPriorToLining, digRequiredPriorToLiningCompleted, digRequiredAfterLining, digRequiredAfterLiningCompleted, outOfScope, holdClientIssue, holdClientIssueResolved, holdLFSIssue, holdLFSIssueResolved, requiresRoboticPrep, requiresRoboticPrepCompleted, linerType, prepType, dyeTestReq, dyeTestComplete, contractYear); } // Load Previous work - Comments and History SavePreviousComments(workId, workType, companyId, newSectionWorkId); SavePreviousHistory(workId, workType, companyId, newSectionWorkId); }
/// <summary> /// Save a JL Work /// </summary> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="companyId">companyId</param> /// <param name="rehabAssessmentPrevWork">rehabAssessmentPrevWork</param> /// <param name="fullLengthLiningPrevWork">fullLengthLiningPrevWork</param> /// <param name="pointRepairsPrevWork">pointRepairsPrevWork</param> /// <param name="junctionLiningPrevWork">junctionLiningPrevWork</param> private void SaveJLWork(int projectId, int section_assetId, int companyId, bool rehabAssessmentPrevWork, bool fullLengthLiningPrevWork, bool pointRepairsPrevWork, bool junctionLiningPrevWork, bool rehabAssessmentNewWork, bool fullLengthLiningNewWork, bool pointRepairsNewWork, bool junctionLiningNewWork) { // If there is no previous work if (!junctionLiningPrevWork) { WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.InsertDirect(projectId, section_assetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); } else { // Copy selected works if (rehabAssessmentPrevWork && !rehabAssessmentNewWork) SavePreviousRAWork(projectId, section_assetId, companyId); if (fullLengthLiningPrevWork && !fullLengthLiningNewWork) SavePreviousFLWork(projectId, section_assetId, companyId); if (pointRepairsPrevWork && !pointRepairsNewWork) SavePreviousPRWork(projectId, section_assetId, companyId); SavePreviousJLWork(projectId, section_assetId, companyId); } }
/// <summary> /// Save a JL Work /// </summary> /// <param name="originalId">originalId</param> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="numLats">numLats</param> /// <param name="notLinedYet">notLinedYet</param> /// <param name="allMeasured">allMeasured</param> /// <param name="issueWithLaterals">issueWithLaterals</param> /// <param name="notMeasuredYet">notMeasuredYet</param> /// <param name="notDeliveredYet">notDeliveredYet</param> /// <param name="countryId">countryId</param> /// <param name="provinceId">provinceId</param> /// <param name="countyId">countyId</param> /// <param name="cityId">cityId</param> /// <param name="companyId">companyId</param> private void SaveJLWork(Guid originalId, int section_assetId, int numLats, int notLinedYet, bool allMeasured, string issueWithLaterals, int notMeasuredYet, int notDeliveredYet, int projectId, Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int companyId) { // Insert Junction Lining Section WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); int sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, section_assetId, null, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, false, companyId, "", "", "", "", false, "", 0); // Insert Junction Lining Laterals SectionTDS sectionTDS = new SectionTDS(); SectionGateway sectionGateway = new SectionGateway(sectionTDS); sectionGateway.LoadById(originalId, companyId); JlinerGateway jlinerGateway = new JlinerGateway(sectionTDS); jlinerGateway.LoadByIdCompanyId(originalId, companyId); foreach (SectionTDS.LFS_JUNCTION_LINER2Row row in (SectionTDS.LFS_JUNCTION_LINER2DataTable)jlinerGateway.Table) { string lateralID = ""; if (!row.IsDetailIDNull()) lateralID = row.DetailID; string address = ""; if (!row.IsAddressNull()) address = row.Address; string distanceFromUSMH = ""; if (!row.IsDistanceFromUSMHNull()) distanceFromUSMH = row.DistanceFromUSMH.ToString(); string distanceFromDSMH = ""; if (!row.IsDistanceFromDSMHNull()) distanceFromDSMH = row.DistanceFromDSMH.ToString(); DateTime? pipeLocated = null; if (!row.IsPipeLocatedNull()) pipeLocated = row.PipeLocated; DateTime? servicesLocated = null; if (!row.IsServicesLocatedNull()) servicesLocated = row.ServicesLocated; DateTime? coInstalled = null; if (!row.IsCoInstalledNull()) coInstalled = row.CoInstalled; DateTime? backfilledConcrete = null; if (!row.IsBackfilledConcreteNull()) backfilledConcrete = row.BackfilledConcrete; DateTime? backfilledSoil = null; if (!row.IsBackfilledSoilNull()) backfilledSoil = row.BackfilledSoil; DateTime? grouted = null; if (!row.IsGroutedNull()) grouted = row.Grouted; DateTime? cored = null; if (!row.IsCoredNull()) cored = row.Cored; DateTime? prepped = null; if (!row.IsPreppedNull()) prepped = row.Prepped; DateTime? measured = null; if (!row.IsMeasuredNull()) measured = row.Measured; string linerSize = ""; if (!row.IsLinerSizeNull()) linerSize = row.LinerSize; DateTime? inProcess = null; if (!row.IsInProcessNull()) inProcess = row.InProcess; DateTime? inStock = null; if (!row.IsInStockNull()) inStock = row.InStock; DateTime? delivered = null; if (!row.IsDeliveredNull()) delivered = row.Delivered; int? buildRebuid = null; if (!row.IsBuildRebuildNull()) buildRebuid = row.BuildRebuild; DateTime? preVideo = null; if (!row.IsPreVideoNull()) preVideo = row.PreVideo; DateTime? linerInstalled = null; if (!row.IsLinerInstalledNull()) linerInstalled = row.LinerInstalled; DateTime? finalVideo = null; if (!row.IsFinalVideoNull()) finalVideo = row.FinalVideo; string map = ""; if (!row.IsMapNull()) map = row.Map; decimal? cost = null; if (!row.IsCostNull()) cost = row.Cost; DateTime? videoInspection = null; if (!row.IsVideoInspectionNull()) videoInspection = row.VideoInspection; bool coRequired = row.CoRequired; bool pitRequired = row.PitRequired; string coPitLocation = ""; if (!row.IsCoPitLocationNull()) coPitLocation = row.CoPitLocation; bool postContractDigRequired = row.PostContractDigRequired; string comments = ""; if (!row.IsCommentsNull()) comments = row.Comments; string history = ""; if (!row.IsHistoryNull()) history = row.History; DateTime? coCutDown = null; if (!row.IsCoCutDownNull()) coCutDown = row.CoCutDown; DateTime? finalRestoration = null; if (!row.IsFinalRestorationNull()) finalRestoration = row.FinalRestoration; string clientLateralId = ""; if (!row.IsClientLateralIDNull()) clientLateralId = row.ClientLateralID; string videoLengthToPropertyLine = ""; if (!row.IsVideoLengthToPropertyLineNull()) videoLengthToPropertyLine = row.VideoLengthToPropertyLine; bool liningThruCo = row.LiningThruCo; DateTime? noticeDelivered = null; if (!row.IsNoticeDeliveredNull()) noticeDelivered = row.NoticeDelivered; string hamiltonInspectionNumber = ""; if (!row.IsHamiltonInspectionNumberNull()) hamiltonInspectionNumber = row.HamiltonInspectionNumber; bool dyeTestReq = row.DyeTestReq; DateTime? dyeTestComplete = null; if (!row.IsDyeTestCompleteNull()) dyeTestComplete = row.DyeTestComplete; // Fields only presents in new Junction lining string flange = ""; string gasket = ""; string connectionType = ""; string depthOfLocated = ""; bool digRequiredPriorToLining = false; DateTime? digRequiredPriorToLiningCompleted = null; bool digRequiredAfterLining = false; DateTime? digRequiredAfterLiningCompleted = null; bool outOfScope = false; bool holdClientIssue = false; DateTime? holdClientIssueResolved = null; bool holdLFSIssue = false; DateTime? holdLFSIssueResolved = null; bool requiresRoboticPrep = false; DateTime? requiresRoboticPrepCompleted = null; ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); int clientId = projectGateway.GetClientID(projectId); // Insert into LFS Asset Lateral LfsAssetSewerLateral lfsAssetSewerLateral = new LfsAssetSewerLateral(null); int lateralAssetId = lfsAssetSewerLateral.InsertDirect(countryId, provinceId, countyId, cityId, section_assetId, address, lateralID, "", "", "", "", "Live", "", distanceFromUSMH, distanceFromDSMH, "", false, companyId, connectionType); // Insert into LFS Asset Lateral Client LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.InsertDirect(lateralAssetId, clientId, clientLateralId, false, companyId); // Insert into Work Junction Lining Lateral WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(null); int workLateral = workJunctionLiningLateral.InsertDirect(projectId, lateralAssetId, sectionWorkId, pipeLocated, servicesLocated, coInstalled, backfilledConcrete, backfilledSoil, grouted, cored, prepped, measured, linerSize, inProcess, inStock, delivered, buildRebuid, preVideo, linerInstalled, finalVideo, cost, videoInspection, coRequired, pitRequired, coPitLocation, postContractDigRequired, coCutDown, finalRestoration, false, companyId, comments, history, videoLengthToPropertyLine, liningThruCo, noticeDelivered, hamiltonInspectionNumber, flange, gasket, depthOfLocated, digRequiredPriorToLining, digRequiredPriorToLiningCompleted, digRequiredAfterLining, digRequiredAfterLiningCompleted, outOfScope, holdClientIssue, holdClientIssueResolved, holdLFSIssue, holdLFSIssueResolved, requiresRoboticPrep, requiresRoboticPrepCompleted, "", "", dyeTestReq, dyeTestComplete, ""); // Insert into Work Comments JlinerCommentGateway jlinerCommentGateway = new JlinerCommentGateway(sectionTDS); jlinerCommentGateway.LoadByIdRefId(originalId, row.RefID, companyId); foreach (SectionTDS.LFS_JUNCTION_LINER2_COMMENTRow rowComment in (SectionTDS.LFS_JUNCTION_LINER2_COMMENTDataTable)jlinerCommentGateway.Table) { int loginId = rowComment.LoginID; DateTime dateTime_ = rowComment.DateTime_; string comment = rowComment.Comment; WorkCommentsGateway workCommentsGateway = new WorkCommentsGateway(); workCommentsGateway.LoadByWorkIdWorkType(workLateral, companyId, "Junction Lining Lateral"); WorkComments workComments = new WorkComments(workCommentsGateway.Data); workComments.Insert(workLateral, 0, "Junction Lining Lateral", "Bulk Upload Comments", loginId, dateTime_, comment, null, false, companyId, false, "Junction Lining"); // Update Comments workCommentsGateway.Update(); } // Insert into Work History JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(sectionTDS); jlinerHistoryGateway.LoadByIdRefId(originalId, row.RefID, companyId); foreach (SectionTDS.LFS_JUNCTION_LINER2_HISTORYRow rowHistory in (SectionTDS.LFS_JUNCTION_LINER2_HISTORYDataTable)jlinerHistoryGateway.Table) { int loginId = rowHistory.LoginID; DateTime dateTime_H = rowHistory.DateTime_; string history_ = rowHistory.History; WorkHistoryGateway workHistoryGateway = new WorkHistoryGateway(); workHistoryGateway.LoadByWorkIdWorkType(workLateral, companyId, "Junction Lining Lateral"); WorkHistory workHistory = new WorkHistory(workHistoryGateway.Data); workHistory.Insert(workLateral, 0, "Junction Lining Lateral", "Bulk Upload History", loginId, dateTime_H, history_, null, false, companyId, false, "Junction Lining"); // Update History workHistoryGateway.Update(); } } }
/// <summary> /// Save /// </summary> /// <param name="countryId">countryId</param> /// <param name="provinceId">provinceId</param> /// <param name="countyId">countyId</param> /// <param name="cityId">cityId</param> /// <param name="projectId">projectId</param> /// <param name="companyId">companyId</param> /// <param name="sectionAssetId">sectionAssetId</param> public void Save(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int companyId, int sectionAssetId) { RehabAssessmentTDS rehabAssessmentChanges = (RehabAssessmentTDS)Data.GetChanges(); if (rehabAssessmentChanges.WorkDetails.Rows.Count > 0) { RehabAssessmentWorkDetailsGateway rehabAssessmentWorkDetailsGateway = new RehabAssessmentWorkDetailsGateway(rehabAssessmentChanges); // Update sections foreach (RehabAssessmentTDS.WorkDetailsRow workDetailsRow in (RehabAssessmentTDS.WorkDetailsDataTable)rehabAssessmentChanges.WorkDetails) { // Unchanged values int workId = workDetailsRow.WorkID; // Original values // ... General string originalClientId = rehabAssessmentWorkDetailsGateway.GetClientIdOriginal(workId); DateTime? originalPreFlushDate = rehabAssessmentWorkDetailsGateway.GetPreFlushDateOriginal(workId); DateTime? originalPreVideoDate = rehabAssessmentWorkDetailsGateway.GetPreVideoDateOriginal(workId); // ... P1 DateTime? originalP1Date = rehabAssessmentWorkDetailsGateway.GetP1DateOriginal(workId); int? originalCxisRemoved = rehabAssessmentWorkDetailsGateway.GetCxisRemovedOriginal(workId); bool originalRoboticPrepCompleted = rehabAssessmentWorkDetailsGateway.GetRoboticPrepCompletedOriginal(workId); DateTime? originalRoboticPrepCompletedDate = rehabAssessmentWorkDetailsGateway.GetRoboticPrepCompletedDateOriginal(workId); bool originalP1Completed = rehabAssessmentWorkDetailsGateway.GetP1CompletedOriginal(workId); // ... M1 DateTime? originalM1Date = rehabAssessmentWorkDetailsGateway.GetM1DateOriginal(workId); string originalMeasurementTakenBy = rehabAssessmentWorkDetailsGateway.GetMeasurementTakenByOriginal(workId); string originalTrafficControl = rehabAssessmentWorkDetailsGateway.GetTrafficControlOriginal(workId); string originalSiteDetails = rehabAssessmentWorkDetailsGateway.GetSiteDetailsOriginal(workId); bool originalPipeSizeChange = rehabAssessmentWorkDetailsGateway.GetPipeSizeChange(workId); bool originalStandardBypass = rehabAssessmentWorkDetailsGateway.GetStandardBypass(workId); string originalStandardBypassComments = rehabAssessmentWorkDetailsGateway.GetStandardBypassCommentsOriginal(workId); string originalTrafficControlDetails = rehabAssessmentWorkDetailsGateway.GetTrafficControlDetailsOriginal(workId); string originalMeasurementType = rehabAssessmentWorkDetailsGateway.GetMeasurementTypeOriginal(workId); string originalMeasurementFromMh = rehabAssessmentWorkDetailsGateway.GetMeasurementFromMhOriginal(workId); string originalVideoDoneFromMh = rehabAssessmentWorkDetailsGateway.GetVideoDoneFromMhOriginal(workId); string originalVideoDoneToMh = rehabAssessmentWorkDetailsGateway.GetVideoDoneToMhOriginal(workId); string originalMaterial = rehabAssessmentWorkDetailsGateway.GetMaterialOriginal(workId); string originalAccessType = rehabAssessmentWorkDetailsGateway.GetAccessTypeOriginal(workId); // ... Comments string originalComments = rehabAssessmentWorkDetailsGateway.GetCommentsOriginal(workId); // ... M2 string originalVideoDistance = rehabAssessmentWorkDetailsGateway.GetVideoDistanceOriginal(workId); // New variables // ... General string newClientId = rehabAssessmentWorkDetailsGateway.GetClientId(workId); // ... P1 DateTime? newP1Date = rehabAssessmentWorkDetailsGateway.GetP1Date(workId); int? newCxisRemoved = rehabAssessmentWorkDetailsGateway.GetCxisRemoved(workId); bool newRoboticPrepCompleted = rehabAssessmentWorkDetailsGateway.GetRoboticPrepCompleted(workId); DateTime? newRoboticPrepCompletedDate = rehabAssessmentWorkDetailsGateway.GetRoboticPrepCompletedDate(workId); bool newP1Completed = rehabAssessmentWorkDetailsGateway.GetP1Completed(workId); // ... M1 DateTime? newM1Date = rehabAssessmentWorkDetailsGateway.GetM1Date(workId); string newMeasurementTakenBy = rehabAssessmentWorkDetailsGateway.GetMeasurementTakenBy(workId); string newTrafficControl = rehabAssessmentWorkDetailsGateway.GetTrafficControl(workId); string newSiteDetails = rehabAssessmentWorkDetailsGateway.GetSiteDetails(workId); bool newPipeSizeChange = rehabAssessmentWorkDetailsGateway.GetPipeSizeChange(workId); bool newStandardBypass = rehabAssessmentWorkDetailsGateway.GetStandardBypass(workId); string newStandardBypassComments = rehabAssessmentWorkDetailsGateway.GetStandardBypassComments(workId); string newTrafficControlDetails = rehabAssessmentWorkDetailsGateway.GetTrafficControlDetails(workId); string newMeasurementType = rehabAssessmentWorkDetailsGateway.GetMeasurementType(workId); string newMeasurementFromMh = rehabAssessmentWorkDetailsGateway.GetMeasurementFromMh(workId); string newVideoDoneFromMh = rehabAssessmentWorkDetailsGateway.GetVideoDoneFromMh(workId); string newVideoDoneToMh = rehabAssessmentWorkDetailsGateway.GetVideoDoneToMh(workId); string newMaterial = rehabAssessmentWorkDetailsGateway.GetMaterial(workId); string newAccessType = rehabAssessmentWorkDetailsGateway.GetAccessType(workId); // ... M2 string newVideoDistance = rehabAssessmentWorkDetailsGateway.GetVideoDistance(workId); // ... Comments string newComments = rehabAssessmentWorkDetailsGateway.GetComments(workId); // ... RA DateTime? newPreFlushDate = rehabAssessmentWorkDetailsGateway.GetPreFlushDate(workId); DateTime? newPreVideoDate = rehabAssessmentWorkDetailsGateway.GetPreVideoDate(workId); // ... FLL WorkID int workIdFll = 0; if (!workDetailsRow.IsWorkIDFllNull()) workIdFll = workDetailsRow.WorkIDFll; if (workIdFll != 0) // ... Has Fll work { WorkFullLengthLiningGateway workFullLengthLiningGateway = new WorkFullLengthLiningGateway(); workFullLengthLiningGateway.LoadByWorkId(workIdFll, companyId); DateTime? originalProposedLiningDate = workFullLengthLiningGateway.GetProposedLiningDate(workIdFll); DateTime? originalDeadlineLiningDate = workFullLengthLiningGateway.GetDeadlineLiningDate(workIdFll); DateTime? originalM2Date = workFullLengthLiningGateway.GetM2Date(workIdFll); DateTime? originalInstallDate = workFullLengthLiningGateway.GetInstallDate(workIdFll); DateTime? originalFinalVideoDate = workFullLengthLiningGateway.GetFinalVideoDate(workIdFll); bool originalIssueIdentified = workFullLengthLiningGateway.GetIssueIdentified(workIdFll); bool originalIssueLFS = workFullLengthLiningGateway.GetIssueLFS(workIdFll); bool originalIssueClient = workFullLengthLiningGateway.GetIssueClient(workIdFll); bool originalIssueSales = workFullLengthLiningGateway.GetIssueSales(workIdFll); bool originalIssueGivenToClient = workFullLengthLiningGateway.GetIssueGivenToClient(workIdFll); bool originalIssueResolved = workFullLengthLiningGateway.GetIssueResolved(workIdFll); bool originalIssueInvestigation = workFullLengthLiningGateway.GetIssueInvestigation(workIdFll); // ... Update work UpdateFllWork(sectionAssetId, countryId, provinceId, countyId, cityId, workIdFll, originalClientId, originalProposedLiningDate, originalDeadlineLiningDate, originalP1Date, originalM1Date, originalM2Date, originalInstallDate, originalFinalVideoDate, originalIssueIdentified, originalIssueLFS, originalIssueClient, originalIssueSales, originalIssueGivenToClient, originalIssueResolved, originalIssueInvestigation, originalCxisRemoved, originalRoboticPrepCompleted, originalRoboticPrepCompletedDate, originalMeasurementTakenBy, originalTrafficControl, originalSiteDetails, originalPipeSizeChange, originalStandardBypass, originalStandardBypassComments, originalTrafficControlDetails, originalMeasurementType, originalMeasurementFromMh, originalVideoDoneFromMh, originalVideoDoneToMh, originalVideoDistance, originalComments, false, companyId, originalMaterial, originalAccessType, originalP1Completed, newClientId, originalProposedLiningDate, originalDeadlineLiningDate, newP1Date, newM1Date, originalM2Date, originalInstallDate, originalFinalVideoDate, originalIssueIdentified, originalIssueLFS, originalIssueClient, originalIssueSales, originalIssueGivenToClient, originalIssueResolved, originalIssueInvestigation, newCxisRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementTakenBy, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardBypass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasurementFromMh, newVideoDoneFromMh, newVideoDoneToMh, newVideoDistance, newComments, false, companyId, newAccessType, newP1Completed); UpdateRaWork(workId, originalPreFlushDate, originalPreVideoDate, newPreFlushDate, newPreVideoDate, companyId); } else { if (newClientId != "" || newP1Date.HasValue || newCxisRemoved.HasValue || newM1Date.HasValue || newMeasurementTakenBy != "" || newMaterial != "" || newTrafficControl != "" || newMeasurementType != "" || newMeasurementFromMh != "" || newVideoDoneFromMh != "" || newVideoDoneToMh != "" || newStandardBypassComments != "" || newTrafficControlDetails != "" || newVideoDistance != "") // Insert Fll work { WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(null); workIdFll = workFullLengthLining.InsertDirectEmptyWorks(projectId, sectionAssetId, null, "", null, null, null, null, null, null, null, false, false, false, false, false, false, false, companyId, false, "", ""); WorkFullLengthLiningGateway workFullLengthLiningGateway = new WorkFullLengthLiningGateway(); workFullLengthLiningGateway.LoadByWorkId(workIdFll, companyId); DateTime? originalProposedLiningDate = workFullLengthLiningGateway.GetProposedLiningDate(workIdFll); DateTime? originalDeadlineLiningDate = workFullLengthLiningGateway.GetDeadlineLiningDate(workIdFll); DateTime? originalM2Date = workFullLengthLiningGateway.GetM2Date(workIdFll); DateTime? originalInstallDate = workFullLengthLiningGateway.GetInstallDate(workIdFll); DateTime? originalFinalVideoDate = workFullLengthLiningGateway.GetFinalVideoDate(workIdFll); bool originalIssueIdentified = workFullLengthLiningGateway.GetIssueIdentified(workIdFll); bool originalIssueLFS = workFullLengthLiningGateway.GetIssueLFS(workIdFll); bool originalIssueClient = workFullLengthLiningGateway.GetIssueClient(workIdFll); bool originalIssueSales = workFullLengthLiningGateway.GetIssueSales(workIdFll); bool originalIssueGivenToClient = workFullLengthLiningGateway.GetIssueGivenToClient(workIdFll); bool originalIssueResolved = workFullLengthLiningGateway.GetIssueResolved(workIdFll); bool originalIssueInvestigation = workFullLengthLiningGateway.GetIssueInvestigation(workIdFll); // ... Update work UpdateFllWork(sectionAssetId, countryId, provinceId, countyId, cityId, workIdFll, originalClientId, originalProposedLiningDate, originalDeadlineLiningDate, originalP1Date, originalM1Date, originalM2Date, originalInstallDate, originalFinalVideoDate, originalIssueIdentified, originalIssueLFS, originalIssueClient, originalIssueSales, originalIssueGivenToClient, originalIssueResolved, originalIssueInvestigation, originalCxisRemoved, originalRoboticPrepCompleted, originalRoboticPrepCompletedDate, originalMeasurementTakenBy, originalTrafficControl, originalSiteDetails, originalPipeSizeChange, originalStandardBypass, originalStandardBypassComments, originalTrafficControlDetails, originalMeasurementType, originalMeasurementFromMh, originalVideoDoneFromMh, originalVideoDoneToMh, originalVideoDistance, originalComments, false, companyId, originalMaterial, originalAccessType, originalP1Completed, newClientId, originalProposedLiningDate, originalDeadlineLiningDate, newP1Date, newM1Date, originalM2Date, originalInstallDate, originalFinalVideoDate, originalIssueIdentified, originalIssueLFS, originalIssueClient, originalIssueSales, originalIssueGivenToClient, originalIssueResolved, originalIssueInvestigation, newCxisRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementTakenBy, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardBypass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasurementFromMh, newVideoDoneFromMh, newVideoDoneToMh, newVideoDistance, newComments, false, companyId, newAccessType, newP1Completed); UpdateRaWork(workId, originalPreFlushDate, originalPreVideoDate, newPreFlushDate, newPreVideoDate, companyId); } else // ... Do not have Fll work { UpdateRaWork(workId, originalPreFlushDate, originalPreVideoDate, newPreFlushDate, newPreVideoDate, companyId); } } // JL Section WorkID int sectionWorkId = 0; WorkGateway workGatewayForJL = new WorkGateway(); workGatewayForJL.LoadByProjectIdAssetIdWorkType(projectId, sectionAssetId, "Junction Lining Section", companyId); if (workGatewayForJL.Table.Rows.Count > 0) { sectionWorkId = workGatewayForJL.GetWorkId(sectionAssetId, "Junction Lining Section", projectId); WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway(); workJunctionLiningSectionGateway.LoadByWorkId(sectionWorkId, companyId); // get old values of section int numLats = workJunctionLiningSectionGateway.GetNumLats(sectionWorkId); int notLinedYet = workJunctionLiningSectionGateway.GetNotLinedYet(sectionWorkId); bool allMeasured = workJunctionLiningSectionGateway.GetAllMeasured(sectionWorkId); bool deleted = workJunctionLiningSectionGateway.GetDeleted(sectionWorkId); string issueWithLaterals = workJunctionLiningSectionGateway.GetIssueWithLaterals(sectionWorkId); int notMeasuredYet = workJunctionLiningSectionGateway.GetNotMeasuredYet(sectionWorkId); int notDeliveredYet = workJunctionLiningSectionGateway.GetNotDeliveredYet(sectionWorkId); string trafficControl = workJunctionLiningSectionGateway.GetTrafficControl(sectionWorkId); string trafficControlDetails = workJunctionLiningSectionGateway.GetTrafficControlDetails(sectionWorkId); bool standardBypass = workJunctionLiningSectionGateway.GetStandardBypass(sectionWorkId); string standardBypassComments = workJunctionLiningSectionGateway.GetStandardBypassComments(sectionWorkId); int availableToLine = workJunctionLiningSectionGateway.GetAvailableToLine(sectionWorkId); WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.UpdateDirect(sectionWorkId, numLats, notLinedYet, allMeasured, deleted, issueWithLaterals, notMeasuredYet, notDeliveredYet, companyId, trafficControl, trafficControlDetails, standardBypass, standardBypassComments, availableToLine, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, newTrafficControl, newTrafficControlDetails, newStandardBypass, newStandardBypassComments, availableToLine); } } } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// UpdateSection /// <param name="companyId">companyId</param> public void UpdateSection(int companyId) { foreach (Fix1WorkJuntionLiningSectionTDS.LFS_WORK_JUNCTIONLINING_SECTIONRow row in (Fix1WorkJuntionLiningSectionTDS.LFS_WORK_JUNCTIONLINING_SECTIONDataTable)Table) { WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway(); workJunctionLiningSectionGateway.LoadByWorkId(row.WorkID, companyId); // get old values of section int numLats = workJunctionLiningSectionGateway.GetNumLats(row.WorkID); int notLinedYet = workJunctionLiningSectionGateway.GetNotLinedYet(row.WorkID); bool allMeasured = workJunctionLiningSectionGateway.GetAllMeasured(row.WorkID); bool deleted = workJunctionLiningSectionGateway.GetDeleted(row.WorkID); string issueWithLaterals = workJunctionLiningSectionGateway.GetIssueWithLaterals(row.WorkID); int notMeasuredYet = workJunctionLiningSectionGateway.GetNotMeasuredYet(row.WorkID); int notDeliveredYet = workJunctionLiningSectionGateway.GetNotDeliveredYet(row.WorkID); string trafficControl = workJunctionLiningSectionGateway.GetTrafficControl(row.WorkID); string trafficControlDetails = workJunctionLiningSectionGateway.GetTrafficControlDetails(row.WorkID); bool standardBypass = workJunctionLiningSectionGateway.GetStandardBypass(row.WorkID); string standardBypassComments = workJunctionLiningSectionGateway.GetStandardBypassComments(row.WorkID); int availableToLine = workJunctionLiningSectionGateway.GetAvailableToLine(row.WorkID); // get new values of section int newAvailableToLine = 0; // load laterals WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); workJunctionLiningLateralGateway.LoadBySectionWorkId(row.WorkID, companyId); int delivered = 0; int installed = 0; foreach (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALRow row1 in (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALDataTable)workJunctionLiningLateralGateway.Table) { if ((!row1.Deleted) && (!row1.OutOfScope)) { if (!row1.IsDeliveredNull()) delivered++; if (!row1.IsLinerInstalledNull()) installed++; } } if (numLats > 0) { newAvailableToLine = delivered - installed; } // Update Work Juntion Lining Section WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.UpdateDirect(row.WorkID, numLats, notLinedYet, allMeasured, deleted, issueWithLaterals, notMeasuredYet, notDeliveredYet, companyId, trafficControl, trafficControlDetails, standardBypass, standardBypassComments, availableToLine, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, trafficControl, trafficControlDetails, standardBypass, standardBypassComments, newAvailableToLine); } }
/// <summary> /// Save all sections & works to database (direct) /// </summary> /// <param name="workId">workId</param> /// <param name="projectId">projectId</param> /// <param name="sectionAssetId">sectionAssetId</param> /// <param name="countryId">countryId</param> /// <param name="provinceId">provinceId</param> /// <param name="countyId">countyId</param> /// <param name="cityId">cityId</param> /// <param name="videoLength">videoLength</param> /// <param name="companyId">companyId</param> /// <param name="isNewMeasuredFromDsmh">isNewMeasuredFromDsmh</param> public void Save(int workId, int projectId, int sectionAssetId, Int64 countryId, Int64? provinceId, Int64? countyId, Int64? cityId, string videoLength, int companyId, bool isNewMeasuredFromDsmh, bool prepDataRoboticPrep, DateTime? prepDataRoboticPrepCompleted) { FullLengthLiningTDS fullLengthLiningChanges = (FullLengthLiningTDS)Data.GetChanges(); if (fullLengthLiningChanges.LateralDetails.Rows.Count > 0) { FullLengthLiningLateralDetailsGateway fullLengthLiningLateralDetailsGateway = new FullLengthLiningLateralDetailsGateway(fullLengthLiningChanges); foreach (FullLengthLiningTDS.LateralDetailsRow row in (FullLengthLiningTDS.LateralDetailsDataTable)fullLengthLiningChanges.LateralDetails) { // Process modified rows if (row.ToProcess) { // Insert new laterals if ((!row.Deleted) && (row.InProject) && (!row.InProjectDatabase)) { // Insert asset int lateral_assetId = SaveLateral(row, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, companyId, isNewMeasuredFromDsmh); int lateral = row.Lateral; // Insert work string videoDistance = fullLengthLiningLateralDetailsGateway.GetVideoDistance(lateral); string clockPosition = fullLengthLiningLateralDetailsGateway.GetClockPosition(lateral); string distanceToCentre = fullLengthLiningLateralDetailsGateway.GetDistanceToCentre(lateral); string timeOpened = fullLengthLiningLateralDetailsGateway.GetTimeOpened(lateral); string reverseSetup = fullLengthLiningLateralDetailsGateway.GetReverseSetup(lateral); DateTime? reinstate = fullLengthLiningLateralDetailsGateway.GetReinstate(lateral); string comments = fullLengthLiningLateralDetailsGateway.GetComments(lateral); string clientInspectionNo = fullLengthLiningLateralDetailsGateway.GetClientInspectionNo(lateral); DateTime? v1Inspection = null; bool requiresRoboticPrep = fullLengthLiningLateralDetailsGateway.GetRequiresRoboticPrep(lateral); DateTime? requiresRoboticPrepDate = null; bool holdClientIssue = fullLengthLiningLateralDetailsGateway.GetHoldClientIssue(lateral); bool holdLFSIssue = fullLengthLiningLateralDetailsGateway.GetHoldLFSIssue(lateral); bool lineLateral = fullLengthLiningLateralDetailsGateway.GetLineLateral(lateral); string flange = fullLengthLiningLateralDetailsGateway.GetFlange(lateral); bool dyeTestReq = fullLengthLiningLateralDetailsGateway.GetDyeTestReq(lateral); DateTime? dyeTestComplete = null; if (fullLengthLiningLateralDetailsGateway.GetDyeTestComplete(lateral).HasValue) dyeTestComplete = fullLengthLiningLateralDetailsGateway.GetDyeTestComplete(lateral); string contractYear = fullLengthLiningLateralDetailsGateway.GetContractYear(lateral); WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateay = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateay.LoadAllByWorkIdLateral(workId, lateral_assetId, companyId); if (workFullLengthLiningM1LateralGateay.Table.Rows.Count == 0) { InsertFLLLateral(workId, lateral_assetId, videoDistance, clockPosition, distanceToCentre, timeOpened, reverseSetup, reinstate, comments, row.Deleted, companyId, clientInspectionNo, v1Inspection, requiresRoboticPrep, requiresRoboticPrepDate, holdClientIssue, holdLFSIssue, lineLateral, dyeTestReq, dyeTestComplete, contractYear); } // ... ... If lateral will be in Junction Lining if ((row.LineLateral) && (!row.InJlDatabase)) { if (((!prepDataRoboticPrep) && (!prepDataRoboticPrepCompleted.HasValue)) || ((prepDataRoboticPrep) && (prepDataRoboticPrepCompleted.HasValue))) { // ... ... Load work id int sectionWorkId = 0; WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, sectionAssetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(workJunctionLiningLateralGateway.Data); workJunctionLiningLateral.InsertDirect(projectId, lateral_assetId, sectionWorkId, null, null, null, null, null, null, null, null, null, "", null, null, null, 0, null, null, null, 0, null, true, false, "", false, null, null, false, companyId, "", "", "", false, null, "", flange, "", "", false, null, false, null, false, holdClientIssue, null, holdLFSIssue, null, requiresRoboticPrep, requiresRoboticPrepDate, "", "", dyeTestReq, dyeTestComplete, contractYear); } } //... Insert material for m1 lateral string material = fullLengthLiningLateralDetailsGateway.GetMaterialType(lateral); if (material != "") { InsertMaterial(lateral_assetId, material, companyId); } //... Insert client lateral id string clientLateralId = fullLengthLiningLateralDetailsGateway.GetClientLateralId(lateral); if (clientLateralId.Trim() != "") { ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); int clientId = projectGateway.GetClientID(projectId); LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.InsertDirect(lateral_assetId, clientId, clientLateralId, false, companyId); } // Change row process state NotProcess(lateral); } // Update laterals if ((!row.Deleted) && (row.InProject) && (row.InProjectDatabase)) { int lateral = row.Lateral; // original values string originalVideoDistance = fullLengthLiningLateralDetailsGateway.GetVideoDistanceOriginal(lateral); string originalClockPosition = fullLengthLiningLateralDetailsGateway.GetClockPositionOriginal(lateral); string originalDistanceToCentre = fullLengthLiningLateralDetailsGateway.GetDistanceToCentreOriginal(lateral); string originalTimeOpened = fullLengthLiningLateralDetailsGateway.GetTimeOpenedOriginal(lateral); string originalReverseSetup = fullLengthLiningLateralDetailsGateway.GetReverseSetupOriginal(lateral); DateTime? originalReinstate = fullLengthLiningLateralDetailsGateway.GetReinstateOriginal(lateral); string originalComments = fullLengthLiningLateralDetailsGateway.GetCommentsOriginal(lateral); string originalClientFullLateralId = fullLengthLiningLateralDetailsGateway.GetClientLateralIdOriginal(lateral); string originalClientLateralId = ""; if (originalClientFullLateralId != "") originalClientLateralId = originalClientFullLateralId; string originalClientInspectionNo = fullLengthLiningLateralDetailsGateway.GetClientInspectionNoOriginal(lateral); DateTime? originalV1Inspection = fullLengthLiningLateralDetailsGateway.GetV1InspectionOriginal(lateral); bool originalRequiresRoboticPrep = fullLengthLiningLateralDetailsGateway.GetRequiresRoboticPrepOriginal(lateral); DateTime? originalRequiresRoboticPrepDate = fullLengthLiningLateralDetailsGateway.GetRequiresRoboticPrepDateOriginal(lateral); bool originalHoldClientIssue = fullLengthLiningLateralDetailsGateway.GetHoldClientIssueOriginal(lateral); bool originalHoldLFSIssue = fullLengthLiningLateralDetailsGateway.GetHoldLFSIssueOriginal(lateral); bool originalLineLateral = fullLengthLiningLateralDetailsGateway.GetLineLateralOriginal(lateral); bool originalDyeTestReq = fullLengthLiningLateralDetailsGateway.GetDyeTestReqOriginal(lateral); DateTime? originalDyeTestComplete = null; if (fullLengthLiningLateralDetailsGateway.GetDyeTestCompleteOriginal(lateral).HasValue) originalDyeTestComplete = fullLengthLiningLateralDetailsGateway.GetDyeTestCompleteOriginal(lateral); string originalContractYear = fullLengthLiningLateralDetailsGateway.GetContractYearOriginal(lateral); // new values string newVideoDistance = fullLengthLiningLateralDetailsGateway.GetVideoDistance(lateral); string newClockPosition = fullLengthLiningLateralDetailsGateway.GetClockPosition(lateral); string newDistanceToCentre = fullLengthLiningLateralDetailsGateway.GetDistanceToCentre(lateral); string newTimeOpened = fullLengthLiningLateralDetailsGateway.GetTimeOpened(lateral); string newReverseSetup = fullLengthLiningLateralDetailsGateway.GetReverseSetup(lateral); DateTime? newReinstate = fullLengthLiningLateralDetailsGateway.GetReinstate(lateral); string newComments = fullLengthLiningLateralDetailsGateway.GetComments(lateral); string newClientFullLateralId = fullLengthLiningLateralDetailsGateway.GetClientLateralId(lateral); string newClientLateralId = ""; if (newClientFullLateralId != "") newClientLateralId = newClientFullLateralId; string newClientInspectionNo = fullLengthLiningLateralDetailsGateway.GetClientInspectionNo(lateral); bool newRequiresRoboticPrep = fullLengthLiningLateralDetailsGateway.GetRequiresRoboticPrep(lateral); DateTime? newRequiresRoboticPrepDate = fullLengthLiningLateralDetailsGateway.GetRequiresRoboticPrepDate(lateral); bool newHoldClientIssue = fullLengthLiningLateralDetailsGateway.GetHoldClientIssue(lateral); bool newHoldLFSIssue = fullLengthLiningLateralDetailsGateway.GetHoldLFSIssue(lateral); bool newLineLateral = fullLengthLiningLateralDetailsGateway.GetLineLateral(lateral); string newFlange = fullLengthLiningLateralDetailsGateway.GetFlange(lateral); bool newDyeTestReq = fullLengthLiningLateralDetailsGateway.GetDyeTestReq(lateral); DateTime? newDyeTestComplete = null; if (fullLengthLiningLateralDetailsGateway.GetDyeTestComplete(lateral).HasValue) newDyeTestComplete = fullLengthLiningLateralDetailsGateway.GetDyeTestComplete(lateral); string newContractYear = fullLengthLiningLateralDetailsGateway.GetContractYear(lateral); // ... Update fll laterals int lateral_assetId = SaveLateral(row, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, companyId, isNewMeasuredFromDsmh); UpdateLateral(row, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, videoLength, companyId); UpdateFLLLateral(workId, lateral_assetId, originalVideoDistance, originalClockPosition, originalDistanceToCentre, originalTimeOpened, originalReverseSetup, originalReinstate, originalComments, false, companyId, originalClientInspectionNo, originalV1Inspection, originalRequiresRoboticPrep, originalRequiresRoboticPrepDate, originalHoldClientIssue, originalHoldLFSIssue, originalLineLateral, originalDyeTestReq, originalDyeTestComplete, originalContractYear, workId, lateral_assetId, newVideoDistance, newClockPosition, newDistanceToCentre, newTimeOpened, newReverseSetup, newReinstate, newComments, false, companyId, newClientInspectionNo, originalV1Inspection, newRequiresRoboticPrep, newRequiresRoboticPrepDate, newHoldClientIssue, newHoldLFSIssue, newLineLateral, newDyeTestReq, newDyeTestComplete, newContractYear); // ... Update if lateral is in Junction Lining if (row.InJlDatabase) { if (originalLineLateral == newLineLateral) { // ... ... Update jl lateral (clientInspectionNo, v1Inspection, requiredRoboticPrep, requiredRoboticPrepDate, holdClientIssue, holdLFSIssue, flange) UpdateJLLaterals(projectId, lateral_assetId, companyId, newClientInspectionNo, newRequiresRoboticPrep, newRequiresRoboticPrepDate, newHoldClientIssue, newHoldLFSIssue, newFlange, newDyeTestReq, newDyeTestComplete, newContractYear); } else { int sectionWorkId = 0; WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, sectionAssetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); // Delete empty lateral form jl. DeleteJLLaterals(projectId, lateral_assetId, companyId, sectionWorkId); } } else { // ... ... Insert if should be in junction Lining if (row.LineLateral) { if (((!prepDataRoboticPrep) && (!prepDataRoboticPrepCompleted.HasValue)) || ((prepDataRoboticPrep) && (prepDataRoboticPrepCompleted.HasValue))) { int sectionWorkId = 0; // Insert to jl laterals WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, sectionAssetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(workJunctionLiningLateralGateway.Data); workJunctionLiningLateral.InsertDirect(projectId, lateral_assetId, sectionWorkId, null, null, null, null, null, null, null, null, null, "", null, null, null, 0, null, null, null, 0, null, false, false, "", false, null, null, false, companyId, "", "", "", false, null, newClientInspectionNo, newFlange, "", "", false, null, false, null, false, newHoldClientIssue, null, newHoldLFSIssue, null, newRequiresRoboticPrep, newRequiresRoboticPrepDate, "", "", newDyeTestReq, newDyeTestComplete, newContractYear); } } } //... Insert material for m1 lateral string material = fullLengthLiningLateralDetailsGateway.GetMaterialType(lateral); if (material != "") { InsertMaterial(lateral_assetId, material, companyId); } ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); int clientId = projectGateway.GetClientID(projectId); LfsAssetSewerLateralClientGateway lfsAssetSewerLateralClientGateway = new LfsAssetSewerLateralClientGateway(); lfsAssetSewerLateralClientGateway.LoadAllByAssetIdClientId(lateral_assetId, clientId, companyId); if (lfsAssetSewerLateralClientGateway.Table.Rows.Count == 0) { LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.InsertDirect(lateral_assetId, clientId, originalClientLateralId, false, companyId); } else { LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); string originalFullClientLateralId = lfsAssetSewerLateralClientGateway.GetClientLateralId(lateral_assetId, clientId); lfsAssetSewerLateralClient.UpdateDirect(lateral_assetId, clientId, originalClientLateralId, false, companyId, lateral_assetId, clientId, newClientLateralId, false, companyId); } // Change row process state NotProcess(lateral); } // Deleted laterals or exclude them from fulllength lining work if (((row.Deleted) && (row.InProject) && (row.InProjectDatabase)) || ((!row.Deleted) && (!row.InProject) && (row.InProjectDatabase))) { DeleteFLLLateral(workId, row.Lateral, companyId, projectId); // Change row process state NotProcess(row.Lateral); } } } } }
/// <summary> /// Save all sections & works to database (direct) /// </summary> /// <param name="workId">workId</param> /// <param name="projectId">projectId</param> /// <param name="sectionAssetId">sectionAssetId</param> /// <param name="countryId">countryId</param> /// <param name="provinceId">provinceId</param> /// <param name="countyId">countyId</param> /// <param name="cityId">cityId</param> /// <param name="length">length</param> /// <param name="companyId">companyId</param> /// <param name="isNewMeasuredFromDsmh">isNewMeasuredFromDsmh</param> /// <param name="prepDataRoboticPrep">prepDataRoboticPrep</param> /// <param name="prepDataRoboticPrepCompleted">prepDataRoboticPrepCompleted</param> public void Save(int workId, int projectId, int sectionAssetId, Int64 countryId, Int64? provinceId, Int64? countyId, Int64? cityId, string length, int companyId, bool isNewMeasuredFromDsmh, bool prepDataRoboticPrep, DateTime? prepDataRoboticPrepCompleted) { // Update Laterals RehabAssessmentLateralDetailsGateway rehabAssessmentLateralDetailsGateway = new RehabAssessmentLateralDetailsGateway(Data); if (rehabAssessmentLateralDetailsGateway.Table.Rows.Count > 0) { // Get WorkId if (workId == 0) { WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(null); workId = workFullLengthLining.InsertDirectEmptyWorks(projectId, sectionAssetId, null, "", null, null, null, null, null, null, null, false, false, false, false, false, false, false, companyId, false, "", ""); } foreach (RehabAssessmentTDS.LateralDetailsRow row in (RehabAssessmentTDS.LateralDetailsDataTable)Table) { int lateral = row.Lateral; ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); int clientId = projectGateway.GetClientID(projectId); // ... Insert lateral if ((!row.InDatabase) && (!row.Deleted)) { string videoDistance = rehabAssessmentLateralDetailsGateway.GetVideoDistance(lateral); string clockPosition = rehabAssessmentLateralDetailsGateway.GetClockPosition(lateral); string distanceToCentre = rehabAssessmentLateralDetailsGateway.GetDistanceToCentre(lateral); string timeOpened = rehabAssessmentLateralDetailsGateway.GetTimeOpened(lateral); string reverseSetup = rehabAssessmentLateralDetailsGateway.GetReverseSetup(lateral); DateTime? reinstate = rehabAssessmentLateralDetailsGateway.GetReinstate(lateral); string comments = rehabAssessmentLateralDetailsGateway.GetComments(lateral); string clientLateralId = rehabAssessmentLateralDetailsGateway.GetClientLateralId(lateral); string clientInspectionNo = rehabAssessmentLateralDetailsGateway.GetClientInspectionNo(lateral); DateTime? v1Inspection = rehabAssessmentLateralDetailsGateway.GetV1Inspection(lateral); bool requiredRoboticPrep = rehabAssessmentLateralDetailsGateway.GetRequiresRoboticPrep(lateral); DateTime? requiredRoboticPrepDate = rehabAssessmentLateralDetailsGateway.GetRequiresRoboticPrepDate(lateral); bool holdClientIssue = rehabAssessmentLateralDetailsGateway.GetHoldClientIssue(lateral); bool holdLFSIssue = rehabAssessmentLateralDetailsGateway.GetHoldLFSIssue(lateral); bool lineLateral = rehabAssessmentLateralDetailsGateway.GetLineLateral(lateral); string flange = rehabAssessmentLateralDetailsGateway.GetFlange(lateral); bool dyeTestReq = rehabAssessmentLateralDetailsGateway.GetDyeTestReq(lateral); DateTime? dyeTestComplete = null; if (rehabAssessmentLateralDetailsGateway.GetDyeTestComplete(lateral).HasValue) dyeTestComplete = rehabAssessmentLateralDetailsGateway.GetDyeTestComplete(lateral); string contractYear = rehabAssessmentLateralDetailsGateway.GetContractYear(lateral); // ... ... Insert asset int lateral_assetId = SaveLateral(row, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, companyId, isNewMeasuredFromDsmh); // ... ... Insert lateral to FulllengthLining InsertFLLLateral(workId, lateral_assetId, videoDistance, clockPosition, distanceToCentre, timeOpened, reverseSetup, reinstate, comments, false, companyId, clientInspectionNo, v1Inspection, requiredRoboticPrep, requiredRoboticPrepDate, holdClientIssue, holdLFSIssue, lineLateral, dyeTestReq, dyeTestComplete, contractYear); // ... ... If lateral will be in Junction Lining if ((row.LineLateral) && (!row.InJlDatabase)) { if (((!prepDataRoboticPrep) && (!prepDataRoboticPrepCompleted.HasValue)) || ((prepDataRoboticPrep) && (prepDataRoboticPrepCompleted.HasValue))) { // ... ... Load work id int sectionWorkId = 0; WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, sectionAssetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(workJunctionLiningLateralGateway.Data); workJunctionLiningLateral.InsertDirect(projectId, lateral_assetId, sectionWorkId, null, null, null, null, null, null, null, null, null, "", null, null, null, 0, null, null, null, 0, v1Inspection, true, false, "", false, null, null, false, companyId, "", "", "", false, null, "", flange, "", "", false, null, false, null, false, holdClientIssue, null, holdLFSIssue, null, requiredRoboticPrep, requiredRoboticPrepDate, "", "", dyeTestReq, dyeTestComplete, contractYear); } } // ... Insert material for M1 lateral try { string material = rehabAssessmentLateralDetailsGateway.GetMaterialType(lateral); if (material != "") { InsertMaterial(lateral_assetId, material, companyId); } } catch { } //... Insert client lateral id try { if (clientLateralId.Trim() != "") { LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.InsertDirect(lateral_assetId, clientId, clientLateralId, false, companyId); } } catch { } } // ... Edit laterals if ((row.InDatabase) && (!row.Deleted)) { // original values string originalVideoDistance = rehabAssessmentLateralDetailsGateway.GetVideoDistanceOriginal(lateral); string originalClockPosition = rehabAssessmentLateralDetailsGateway.GetClockPositionOriginal(lateral); string originalDistanceToCentre = rehabAssessmentLateralDetailsGateway.GetDistanceToCentreOriginal(lateral); string originalTimeOpened = rehabAssessmentLateralDetailsGateway.GetTimeOpenedOriginal(lateral); string originalReverseSetup = rehabAssessmentLateralDetailsGateway.GetReverseSetupOriginal(lateral); DateTime? originalReinstate = rehabAssessmentLateralDetailsGateway.GetReinstateOriginal(lateral); string originalComments = rehabAssessmentLateralDetailsGateway.GetCommentsOriginal(lateral); string originalClientLateralId = rehabAssessmentLateralDetailsGateway.GetClientLateralIdOriginal(lateral); string originalClientInspectionNo = rehabAssessmentLateralDetailsGateway.GetClientInspectionNoOriginal(lateral); DateTime? originalV1Inspection = rehabAssessmentLateralDetailsGateway.GetV1InspectionOriginal(lateral); bool originalRequiresRoboticPrep = rehabAssessmentLateralDetailsGateway.GetRequiresRoboticPrepOriginal(lateral); DateTime? originalRequiresRoboticPrepDate = rehabAssessmentLateralDetailsGateway.GetRequiresRoboticPrepDateOriginal(lateral); bool originalHoldClientIssue = rehabAssessmentLateralDetailsGateway.GetHoldClientIssueOriginal(lateral); bool originalHoldLFSIssue = rehabAssessmentLateralDetailsGateway.GetHoldLFSIssueOriginal(lateral); bool originalLineLateral = rehabAssessmentLateralDetailsGateway.GetLineLateralOriginal(lateral); bool originalDyeTestReq = rehabAssessmentLateralDetailsGateway.GetDyeTestReqOriginal(lateral); DateTime? originalDyeTestComplete = null; if (rehabAssessmentLateralDetailsGateway.GetDyeTestCompleteOriginal(lateral).HasValue) originalDyeTestComplete = rehabAssessmentLateralDetailsGateway.GetDyeTestCompleteOriginal(lateral); string originalContractYear = rehabAssessmentLateralDetailsGateway.GetContractYearOriginal(lateral); // new values string newVideoDistance = rehabAssessmentLateralDetailsGateway.GetVideoDistance(lateral); string newClockPosition = rehabAssessmentLateralDetailsGateway.GetClockPosition(lateral); string newDistanceToCentre = rehabAssessmentLateralDetailsGateway.GetDistanceToCentre(lateral); string newTimeOpened = rehabAssessmentLateralDetailsGateway.GetTimeOpened(lateral); string newReverseSetup = rehabAssessmentLateralDetailsGateway.GetReverseSetup(lateral); DateTime? newReinstate = rehabAssessmentLateralDetailsGateway.GetReinstate(lateral); string newComments = rehabAssessmentLateralDetailsGateway.GetComments(lateral); string newClientLateralId = rehabAssessmentLateralDetailsGateway.GetClientLateralId(lateral); string newClientInspectionNo = rehabAssessmentLateralDetailsGateway.GetClientInspectionNo(lateral); DateTime? newV1Inspection = rehabAssessmentLateralDetailsGateway.GetV1Inspection(lateral); bool newRequiresRoboticPrep = rehabAssessmentLateralDetailsGateway.GetRequiresRoboticPrep(lateral); DateTime? newRequiresRoboticPrepDate = rehabAssessmentLateralDetailsGateway.GetRequiresRoboticPrepDate(lateral); bool newHoldClientIssue = rehabAssessmentLateralDetailsGateway.GetHoldClientIssue(lateral); bool newHoldLFSIssue = rehabAssessmentLateralDetailsGateway.GetHoldLFSIssue(lateral); bool newLineLateral = rehabAssessmentLateralDetailsGateway.GetLineLateral(lateral); string newFlange = rehabAssessmentLateralDetailsGateway.GetFlange(lateral); bool newDyeTestReq = rehabAssessmentLateralDetailsGateway.GetDyeTestReq(lateral); DateTime? newDyeTestComplete = null; if (rehabAssessmentLateralDetailsGateway.GetDyeTestComplete(lateral).HasValue) newDyeTestComplete = rehabAssessmentLateralDetailsGateway.GetDyeTestComplete(lateral); string newContractYear = rehabAssessmentLateralDetailsGateway.GetContractYear(lateral); // ... Update laterals int lateral_assetId = SaveLateral(row, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, companyId, isNewMeasuredFromDsmh); UpdateLateral(row, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, length, companyId); // ... Update if lateral is in FulllenghtLining if (!row.InFllDatabase) { WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateay = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateay.LoadAllByWorkIdLateral(workId, lateral_assetId, companyId); if (workFullLengthLiningM1LateralGateay.Table.Rows.Count == 0) { InsertFLLLateral(workId, lateral_assetId, newVideoDistance, newClockPosition, newDistanceToCentre, newTimeOpened, newReverseSetup, newReinstate, newComments, false, companyId, newClientInspectionNo, newV1Inspection, newRequiresRoboticPrep, newRequiresRoboticPrepDate, newHoldClientIssue, newHoldLFSIssue, newLineLateral, newDyeTestReq, newDyeTestComplete, newContractYear); } else { UpdateFLLLateral(workId, lateral_assetId, originalVideoDistance, originalClockPosition, originalDistanceToCentre, originalTimeOpened, originalReverseSetup, originalReinstate, originalComments, true, companyId, originalClientInspectionNo, originalV1Inspection, originalRequiresRoboticPrep, originalRequiresRoboticPrepDate, originalHoldClientIssue, originalHoldLFSIssue, originalLineLateral, originalDyeTestReq, originalDyeTestComplete, originalContractYear, workId, lateral_assetId, newVideoDistance, newClockPosition, newDistanceToCentre, newTimeOpened, newReverseSetup, newReinstate, newComments, false, companyId, newClientInspectionNo, newV1Inspection, newRequiresRoboticPrep, newRequiresRoboticPrepDate, newHoldClientIssue, newHoldLFSIssue, newLineLateral, newDyeTestReq, newDyeTestComplete, newContractYear); } } else { UpdateFLLLateral(workId, lateral_assetId, originalVideoDistance, originalClockPosition, originalDistanceToCentre, originalTimeOpened, originalReverseSetup, originalReinstate, originalComments, false, companyId, originalClientInspectionNo, originalV1Inspection, originalRequiresRoboticPrep, originalRequiresRoboticPrepDate, originalHoldClientIssue, originalHoldLFSIssue, originalLineLateral, originalDyeTestReq, originalDyeTestComplete, originalContractYear,workId, lateral_assetId, newVideoDistance, newClockPosition, newDistanceToCentre, newTimeOpened, newReverseSetup, newReinstate, newComments, false, companyId, newClientInspectionNo, newV1Inspection, newRequiresRoboticPrep, newRequiresRoboticPrepDate, newHoldClientIssue, newHoldLFSIssue, newLineLateral, newDyeTestReq, newDyeTestComplete, newContractYear); } // ... Update if lateral is in Junction Lining if (row.InJlDatabase) { if (originalLineLateral == newLineLateral) { // ... ... Update jl lateral (clientInspectionNo, v1Inspection, requiredRoboticPrep, requiredRoboticPrepDate, holdClientIssue, holdLFSIssue, flange) UpdateJLLaterals(projectId, lateral_assetId, companyId, newV1Inspection, newClientInspectionNo, newRequiresRoboticPrep, newRequiresRoboticPrepDate, newHoldClientIssue, newHoldLFSIssue, newFlange, newDyeTestReq, newDyeTestComplete, newContractYear); } else { int sectionWorkId = 0; WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, sectionAssetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); // Delete empty lateral form jl. DeleteJLLaterals(projectId, lateral_assetId, companyId, sectionWorkId); } } else { // ... ... Insert if should be in junction Lining if (row.LineLateral) { if (((!prepDataRoboticPrep) && (!prepDataRoboticPrepCompleted.HasValue)) || ((prepDataRoboticPrep) && (prepDataRoboticPrepCompleted.HasValue))) { int sectionWorkId = 0; // Insert to jl laterals WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, sectionAssetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(workJunctionLiningLateralGateway.Data); workJunctionLiningLateral.InsertDirect(projectId, lateral_assetId, sectionWorkId, null, null, null, null, null, null, null, null, null, "", null, null, null, 0, null, null, null, 0, newV1Inspection, false, false, "", false, null, null, false, companyId, "", "", "", false, null, newClientInspectionNo, newFlange, "", "", false, null, false, null, false, newHoldClientIssue, null, newHoldLFSIssue, null, newRequiresRoboticPrep, newRequiresRoboticPrepDate, "", "", newDyeTestReq, newDyeTestComplete, newContractYear); } } } string material = rehabAssessmentLateralDetailsGateway.GetMaterialType(lateral); if (material != "") { InsertMaterial(lateral_assetId, material, companyId); } try { LfsAssetSewerLateralClientGateway lfsAssetSewerLateralClientGateway = new LfsAssetSewerLateralClientGateway(); lfsAssetSewerLateralClientGateway.LoadAllByAssetIdClientId(lateral_assetId, clientId, companyId); if (lfsAssetSewerLateralClientGateway.Table.Rows.Count == 0) { LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.InsertDirect(lateral_assetId, clientId, originalClientLateralId, false, companyId); } else { LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); string originalClientLateralId2 = lfsAssetSewerLateralClientGateway.GetClientLateralId(lateral_assetId, clientId); lfsAssetSewerLateralClient.UpdateDirect(lateral_assetId, clientId, originalClientLateralId, false, companyId, lateral_assetId, clientId, newClientLateralId, false, companyId); } } catch { } } // ... Delete laterals if ((row.InDatabase) && (row.Deleted)) { DeleteFLLLateral(workId, row.Lateral, companyId, clientId); } } } }
/// <summary> /// Update Work /// </summary> /// <param name="workId">workId</param> /// <param name="numLats">numLats</param> /// <param name="notLinedYet">notLinedYet</param> /// <param name="allMeasured">allMeasured</param> /// <param name="issueWithLaterals">issueWithLaterals</param> /// <param name="notMeasuredYet">notMeasuredYet</param> /// <param name="notDeliveredYet">notDeliveredYet</param> /// <param name="originalSubArea">originalSubArea</param> /// <param name="originalTrafficControl">originalTrafficControl</param> /// <param name="originalTrafficControlDetails">originalTrafficControlDetails</param> /// <param name="originalStandardBypass">originalStandardBypass</param> /// <param name="originalStandardBypassComments">originalStandardBypassComments</param> /// <param name="originalAvailableToLine">originalAvailableToLine</param> /// /// <param name="newTrafficControl">newTrafficControl</param> /// <param name="newTrafficControlDetails">newTrafficControlDetails</param> /// <param name="newStandardBypass">newStandardBypass</param> /// <param name="newStandardBypassComments">newStandardBypassComments</param> /// <param name="newAvailableToLine">newAvailableToLine</param> /// <param name="companyId">companyId</param> private void UpdateWork(int workId, int numLats, int notLinedYet, bool allMeasured, string issueWithLaterals, int notMeasuredYet, int notDeliveredYet, string originalTrafficControl, string originalTrafficControlDetails, bool originalStandardBypass, string originalStandardBypassComments, int originalAvailableToLine, string newTrafficControl, string newTrafficControlDetails, bool newStandardBypass, string newStandardBypassComments, int companyId, int newAvailableToLine) { WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.UpdateDirect(workId, numLats, notLinedYet, allMeasured, false, issueWithLaterals, notMeasuredYet, notDeliveredYet, companyId, originalTrafficControl, originalTrafficControlDetails, originalStandardBypass, originalStandardBypassComments, originalAvailableToLine, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, newTrafficControl, newTrafficControlDetails, newStandardBypass, newStandardBypassComments, newAvailableToLine); }
/// <summary> /// Delete /// </summary> /// <param name="workId">workId</param> /// <param name="assetId">assetId</param> /// <param name="companyId">companyId</param> private void Delete(int workId, int assetId, int companyId) { // Delete work WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.DeleteDirect(workId, companyId); // Delete section LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(null); lfsAssetSewerSection.DeleteDirect(assetId, companyId); }
/// <summary> /// Save a JL Work /// </summary> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="companyId">companyId</param> private void SaveJLWork(int projectId, int section_assetId, int companyId) { WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); workJunctionLiningSection.InsertDirect(projectId, section_assetId, null, 0, 0, false, "No", 0, 0, false, companyId, "", "", "", "", false, "", 0); }