/// <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); }