// ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="companyId">companyId</param>
        public void Delete(int workId, int companyId)
        {
            WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway();
            workFullLengthLiningM1LateralGateway.LoadByWorkId(workId, companyId);

            foreach (WorkTDS.LFS_WORK_FULLLENGTHLINING_M1_LATERALRow row in (WorkTDS.LFS_WORK_FULLLENGTHLINING_M1_LATERALDataTable)workFullLengthLiningM1LateralGateway.Table)
            {
                // delete lfs lateral client
                WorkGateway workGateway = new WorkGateway();
                workGateway.LoadByWorkId(workId, companyId);
                int currentProjectId = workGateway.GetProjectId(workId);

                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                int clientId = projectGateway.GetClientID(currentProjectId);

                LfsAssetSewerLateralClientGateway lfsAssetSewerLateralClientGateway = new LfsAssetSewerLateralClientGateway();
                lfsAssetSewerLateralClientGateway.LoadByAssetIdClientId(row.Lateral, clientId, companyId);

                if (lfsAssetSewerLateralClientGateway.Table.Rows.Count > 0)
                {
                    LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null);
                    lfsAssetSewerLateralClient.DeleteDirect(row.Lateral, clientId, companyId);
                }

                // Delete work lateral
                workFullLengthLiningM1LateralGateway.Delete(workId, row.Lateral, companyId);

                // Delete section
                LfsAssetSewerLateral lfsAssetSewerLateral = new LfsAssetSewerLateral(null);
                lfsAssetSewerLateral.DeleteDirect(row.Lateral, companyId);
            }
        }
Ejemplo n.º 2
0
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// Insert a new work (direct to DB)
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="assetId">assetId</param>
        /// <param name="workType">workType</param>
        /// <param name="libraryCategoriesId">libraryCategoriesId</param>
        /// <param name="deleted">deleted</param>
        /// <param name="companyId">companyId</param>
        /// <param name="comments">comments</param>
        /// <param name="history">history</param>
        /// <returns>workId</returns>
        public int InsertDirect(int projectId, int assetId, string workType, int? libraryCategoriesId, bool deleted, int companyId, string comments, string history)
        {
            WorkGateway workGateway = new WorkGateway(null);
            int workId = workGateway.Insert(projectId, assetId, workType, libraryCategoriesId, deleted, companyId, comments, history);

            return workId;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// DeleteDirect including comments & history
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="companyId">companyId</param>
        public void DeleteDirect(int workId, int companyId)
        {
            // Delete comments
            WorkComments workComments = new WorkComments(null);
            workComments.DeleteAllDirect(workId, companyId);

            // Delete History
            WorkHistory workHistory = new WorkHistory(null);
            workHistory.DeleteAllDirect(workId, companyId);

            // delete Work
            WorkGateway workGateway = new WorkGateway(Data);
            workGateway.Delete(workId, companyId);
        }
        /// <summary>
        /// InsertDirect a rehabilitation
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="preppredDate">preppredDate</param>
        /// <param name="sprayedDate">sprayedDate</param>
        /// <param name="batchId">batchId</param>
        /// <param name="deleted">deleted</param>       
        /// <param name="companyId">companyId</param>        
        public int InsertDirectEmptyWorks(int projectId, int assetId, DateTime? preppredDate, DateTime? sprayedDate, int? batchId, bool deleted, int companyId)
        {
            int workId = 0;
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Manhole Rehabilitation", companyId);

            if (workGateway.Table.Rows.Count == 0)
            {
                workId = new Work(null).InsertDirect(projectId, assetId, "Manhole Rehabilitation", null, deleted, companyId, "", "");
                new WorkManholeRehabilitationGateway(null).Insert(workId, preppredDate, sprayedDate, batchId, deleted, companyId);
            }
            else
            {
                workId = workGateway.GetWorkId(assetId, "Manhole Rehabilitation", projectId);
            }

            return workId;
        }
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// InsertDirect
        /// </summary>
        /// <param name="projectId">projectId></param>
        /// <param name="assetId">assetId</param>
        /// <param name="libraryCategoriesId">libraryCategoriesId</param>
        /// <param name="preFlushDate">preFlushDate</param>
        /// <param name="preVideoDate">preVideoDate</param>
        /// <param name="deleted">deleted</param>
        /// <param name="companyId">companyId</param>
        public int InsertDirect(int projectId, int assetId, int? libraryCategoriesId, DateTime? preFlushDate, DateTime? preVideoDate, bool deleted, int companyId, string comments, string history)
        {
            int workId = 0;
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Rehab Assessment", companyId);

            if (workGateway.Table.Rows.Count == 0)
            {
                workId = new Work(null).InsertDirect(projectId, assetId, "Rehab Assessment", libraryCategoriesId, deleted, companyId, comments, history);
                new WorkRehabAssessmentGateway(null).Insert(workId, preFlushDate, preVideoDate, deleted, companyId);
            }
            else
            {
                workId = workGateway.GetWorkId(assetId, "Rehab Assessment", projectId);
            }

            return workId;
        }
Ejemplo n.º 6
0
        private int GetWorkId(int projectId, int assetId, string workType, int companyId)
        {
            int workId = 0;
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, workType, companyId);
            if (workGateway.Table.Rows.Count > 0)
            {
                // Get WorkId
                workId = workGateway.GetWorkId(assetId, workType, projectId);
            }

            return workId;
        }
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// InsertDirect
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="assetId">assetId</param>
        /// <param name="sectionWorkId">sectionWorkId</param>
        /// <param name="pipeLocated">pipeLocated</param>
        /// <param name="servicesLocated">servicesLocated</param>
        /// <param name="coInstalled">coInstalled</param>
        /// <param name="backfilledConcrete">backfilledConcrete</param>
        /// <param name="backfilledSoil">backfilledSoil</param>
        /// <param name="grouted">grouted</param>
        /// <param name="cored">cored</param>
        /// <param name="prepped">prepped</param>
        /// <param name="measured">measured</param>
        /// <param name="linerSize">linerSize</param>
        /// <param name="inProcess">inProcess</param>
        /// <param name="inStock">inStock</param>
        /// <param name="delivered">delivered</param>
        /// <param name="builRebuild">builRebuild</param>
        /// <param name="preVideo">preVideo</param>
        /// <param name="linerInstalled">linerInstalled</param>
        /// <param name="finalVideo">finalVideo</param>
        /// <param name="cost">cost</param>
        /// <param name="videoInspection">videoInspection</param>
        /// <param name="coRequired">coRequired</param>
        /// <param name="pitRequired">pitRequired</param>
        /// <param name="coPitLocation">coPitLocation</param>
        /// <param name="postContractDigRequired">postContractDigRequired</param>
        /// <param name="coCutDown">coCutDown</param>
        /// <param name="finalRestoration">finalRestoration</param>
        /// <param name="deleted">deleted</param>
        /// <param name="companyId">companyId</param>
        /// <param name="comments">comments</param>
        /// <param name="history">history</param>
        /// <param name="videoLengthToPropertyLine">videoLengthToPropertyLine</param>
        /// <param name="liningThruCo">liningThruCo</param>
        /// <param name="noticeDelivered">noticeDelivered</param>
        /// <param name="hamiltonInspectionNumber">hamiltonInspectionNumber</param>
        /// <param name="flange">flange</param>
        /// <param name="gasket">gasket</param>
        /// <param name="depthOfLocated">depthOfLocated</param>
        /// <param name="digRequiredPriorToLining">digRequiredPriorToLining</param>
        /// <param name="digRequiredPriorToLiningCompleted">digRequiredPriorToLiningCompleted</param>
        /// <param name="digRequiredAfterLining">digRequiredAfterLining</param>
        /// <param name="digRequiredAfterLiningCompleted">digRequiredAfterLiningCompleted</param>
        /// <param name="outOfScope">outOfScope</param>
        /// <param name="holdClientIssue">holdClientIssue</param>
        /// <param name="holdClientIssueResolved">holdClientIssueResolved</param>
        /// <param name="holdLFSIssue">holdLFSIssue</param>
        /// <param name="holdLFSIssueResolved">holdLFSIssueResolved</param>
        /// <param name="requiresRoboticPrep">requiresRoboticPrep</param>
        /// <param name="requiresRoboticPrepCompleted">requiresRoboticPrepCompleted</param> 
        /// <param name="linerType">linerType</param>
        /// <param name="prepType">prepType</param>
        /// <returns>int</returns>
        public int InsertDirect(int projectId, int assetId, int sectionWorkId, DateTime? pipeLocated, DateTime? servicesLocated, DateTime? coInstalled, DateTime? backfilledConcrete, DateTime? backfilledSoil, DateTime? grouted, DateTime? cored, DateTime? prepped, DateTime? measured, string linerSize, DateTime? inProcess, DateTime? inStock, DateTime? delivered, int? builRebuild, DateTime? preVideo, DateTime? linerInstalled, DateTime? finalVideo, decimal? cost, DateTime? videoInspection, bool coRequired, bool pitRequired, string coPitLocation, bool postContractDigRequired, DateTime? coCutDown, DateTime? finalRestoration, bool deleted, int companyId, string comments, string history, string videoLengthToPropertyLine, bool liningThruCo, DateTime? noticeDelivered, string hamiltonInspectionNumber, string flange, string gasket, string depthOfLocated, bool digRequiredPriorToLining, DateTime? digRequiredPriorToLiningCompleted, bool digRequiredAfterLining, DateTime? digRequiredAfterLiningCompleted, bool outOfScope, bool holdClientIssue, DateTime? holdClientIssueResolved, bool holdLFSIssue, DateTime? holdLFSIssueResolved, bool requiresRoboticPrep, DateTime? requiresRoboticPrepCompleted, string linerType, string prepType, bool dyeTestReq, DateTime? dyeTestComplete, string contractYear)
        {
            int workId = 0;
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Junction Lining Lateral", companyId);

            if (workGateway.Table.Rows.Count == 0)
            {
                workId = new Work(null).InsertDirect(projectId, assetId, "Junction Lining Lateral", null, false, companyId, comments, history);
                new WorkJunctionLiningLateralGateway(null).Insert(workId, sectionWorkId, pipeLocated, servicesLocated, coInstalled, backfilledConcrete, backfilledSoil, grouted, cored, prepped, measured, linerSize, inProcess, inStock, delivered, builRebuild, preVideo, linerInstalled, finalVideo, cost, videoInspection, coRequired, pitRequired, coPitLocation, postContractDigRequired, coCutDown, finalRestoration, deleted, companyId, videoLengthToPropertyLine, liningThruCo, noticeDelivered, hamiltonInspectionNumber, flange, gasket, depthOfLocated, digRequiredPriorToLining, digRequiredPriorToLiningCompleted, digRequiredAfterLining, digRequiredAfterLiningCompleted, outOfScope, holdClientIssue, holdClientIssueResolved, holdLFSIssue, holdLFSIssueResolved, requiresRoboticPrep,  requiresRoboticPrepCompleted, linerType, prepType, dyeTestReq, dyeTestComplete, contractYear);

                // Update WorkJunctionLiningSection
                UpdateSection(sectionWorkId, workId, companyId);
            }
            else
            {
                workId = workGateway.GetWorkId(assetId, "Junction Lining Lateral", projectId);
            }

            return workId;
        }
        /// <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);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private void TagPage()
        {
            hdfCompanyId.Value = Session["companyID"].ToString();
            hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
            hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
            hdfWorkType.Value = "Full Length Lining";
            hdfAssetId.Value = Request.QueryString["asset_id"].ToString();
            hdfErrorFieldList.Value = "";

            // Get ids & location
            int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim());
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(projectId);

            // ... Get ids
            Int64 currentCountry = projectGateway.GetCountryID(projectId);
            Int64? currentProvince = null; if (projectGateway.GetProvinceID(projectId).HasValue) currentProvince = (Int64)projectGateway.GetProvinceID(projectId);
            Int64? currentCounty = null; if (projectGateway.GetCountyID(projectId).HasValue) currentCounty = (Int64)projectGateway.GetCountyID(projectId);
            Int64? currentCity = null; if (projectGateway.GetCityID(projectId).HasValue) currentCity = (Int64)projectGateway.GetCityID(projectId);

            hdfCountryId.Value = currentCountry.ToString();
            hdfProvinceId.Value = currentProvince.ToString();
            hdfCountyId.Value = currentCounty.ToString();
            hdfCityId.Value = currentCity.ToString();

            // Get workId
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int assetId = Int32.Parse(hdfAssetId.Value);
            string workType = hdfWorkType.Value;

            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, workType, companyId);
            hdfWorkId.Value = workGateway.GetWorkId(assetId, workType, projectId).ToString();
            hdfWorkIdJl.Value = GetWorkId(projectId, assetId, "Junction Lining Section", companyId).ToString();
        }
Ejemplo n.º 10
0
        private bool LateralsCouldBeDeletedInJl(int lateral)
        {
            bool delete = false;

            // Get workId
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int assetId = Int32.Parse(hdfAssetId.Value);
            string workType = hdfWorkType.Value;
            int projectId = Int32.Parse(hdfCurrentProjectId.Value);

            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, workType, companyId);

            int workIdJlLateral = GetWorkId(projectId, lateral, "Junction Lining Lateral", companyId);

            WorkJunctionLiningLateralGateway row = new WorkJunctionLiningLateralGateway();
            row.LoadByWorkId(workIdJlLateral, companyId);

            // All fields are empty for deleting a lateral on jl
            if ((!row.GetPipeLocated(workIdJlLateral).HasValue) && (!row.GetServicesLocated(workIdJlLateral).HasValue) && (!row.GetCoInstalled(workIdJlLateral).HasValue) && (!row.GetBackfilledConcrete(workIdJlLateral).HasValue) && (!row.GetBackfilledSoil(workIdJlLateral).HasValue) && (!row.GetGrouted(workIdJlLateral).HasValue) && (!row.GetCored(workIdJlLateral).HasValue) && (!row.GetPrepped(workIdJlLateral).HasValue) && (!row.GetMeasured(workIdJlLateral).HasValue) && (!row.GetInProcess(workIdJlLateral).HasValue) && (!row.GetInStock(workIdJlLateral).HasValue) && (!row.GetDelivered(workIdJlLateral).HasValue) && (!row.GetPreVideo(workIdJlLateral).HasValue) && (!row.GetLinerInstalled(workIdJlLateral).HasValue) && (!row.GetFinalVideo(workIdJlLateral).HasValue) && (!row.GetVideoInspection(workIdJlLateral).HasValue) && (!row.GetCoCutDown(workIdJlLateral).HasValue) && (!row.GetFinalRestoration(workIdJlLateral).HasValue) && (!row.GetNoticeDelivered(workIdJlLateral).HasValue) && (!row.GetHoldClientIssueResolved(workIdJlLateral).HasValue) && (!row.GetDigRequiredPriorToLiningCompleted(workIdJlLateral).HasValue) && (!row.GetHoldLFSIssueResolved(workIdJlLateral).HasValue) && (!row.GetDigRequiredAfterLiningCompleted(workIdJlLateral).HasValue) && (!row.GetLateralRequiresRoboticPrepCompleted(workIdJlLateral).HasValue))
            {
                if ((!row.GetCoRequired(workIdJlLateral)) && (!row.GetPitRequired(workIdJlLateral)) && (!row.GetLiningThruCo(workIdJlLateral)) && (!row.GetPostContractDigRequired(workIdJlLateral)) && (!row.GetDigRequiredPriorToLining(workIdJlLateral)) && (!row.GetDigRequiredAfterLining(workIdJlLateral)) && (!row.GetOutOfScope(workIdJlLateral)) && (!row.GetHoldClientIssue(workIdJlLateral)) && (!row.GetHoldLFSIssue(workIdJlLateral)) && (!row.GetLateralRequiresRoboticPrep(workIdJlLateral)) && (row.GetLinerSize(workIdJlLateral) == "") && (row.GetFlange(workIdJlLateral) == "") && (row.GetHamiltonInspectionNumber(workIdJlLateral) == "") && (row.GetCoPitLocation(workIdJlLateral) == "") && (row.GetPrepType(workIdJlLateral) == "") && (row.GetGasket(workIdJlLateral) == "") && (row.GetDepthOfLocated(workIdJlLateral) == "") && (row.GetLinerType(workIdJlLateral) == "") && (row.GetVideoLengthToPropertyLine(workIdJlLateral) == ""))
                {
                    if ((row.GetBuildRebuild(workIdJlLateral) == 0) && (row.GetCost(workIdJlLateral) == 0.00m))
                    {
                        delete = true;
                    }
                }
            }

            return delete;
        }
        /// <summary>
        /// Save all comments to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>   
        /// <param name="runDetails">runDetails</param>
        /// <param name="projectId">projectId</param>
        public void Save(int companyId, string runDetails, int projectId)
        {
            string[] runDetailsList = runDetails.Split('>');

            FullLengthLiningTDS fullLengthLiningWetOutCommentsDetailsChanges = (FullLengthLiningTDS)Data.GetChanges();

            if (fullLengthLiningWetOutCommentsDetailsChanges.WetOutCommentsDetails.Rows.Count > 0)
            {
                FullLengthLiningWetOutCommentsDetailsGateway fullLengthLiningWetOutCommentsDetailsGateway = new FullLengthLiningWetOutCommentsDetailsGateway(fullLengthLiningWetOutCommentsDetailsChanges);

                foreach (FullLengthLiningTDS.WetOutCommentsDetailsRow row in (FullLengthLiningTDS.WetOutCommentsDetailsDataTable)fullLengthLiningWetOutCommentsDetailsChanges.WetOutCommentsDetails)
                {
                    // Insert new comments
                    if ((!row.Deleted) && (!row.InDatabase))
                    {
                        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);
                            }

                            WorkFullLengthLiningWetOutComments workFullLengthLiningWetOutComments = new WorkFullLengthLiningWetOutComments(null);
                            int? libraryFilesId = null; if (!row.IsLIBRARY_FILES_IDNull()) libraryFilesId = row.LIBRARY_FILES_ID;

                            workFullLengthLiningWetOutComments.InsertDirect(newWorkId, row.RefID, row.Type, row.Subject, row.UserID, row.DateTime_, row.Comment, libraryFilesId, row.Deleted, row.COMPANY_ID, row.WorkType);
                        }
                    }

                    // Update comments
                    if ((!row.Deleted) && (row.InDatabase))
                    {
                        int workId = row.WorkID;
                        int refId = row.RefID;
                        bool originalDeleted = false;
                        int originalCompanyId = companyId;

                        // original values
                        string originalType = fullLengthLiningWetOutCommentsDetailsGateway.GetTypeOriginal(workId, refId);
                        string originalSubject = fullLengthLiningWetOutCommentsDetailsGateway.GetSubjectOriginal(workId, refId);
                        int originalUserId = fullLengthLiningWetOutCommentsDetailsGateway.GetUserIdOriginal(workId, refId);
                        DateTime? originalDateTime = null; if (fullLengthLiningWetOutCommentsDetailsGateway.GetDateTime_Original(workId, refId) != null) originalDateTime = fullLengthLiningWetOutCommentsDetailsGateway.GetDateTime_Original(workId, refId);
                        string originalComment = fullLengthLiningWetOutCommentsDetailsGateway.GetCommentOriginal(workId, refId);
                        int? originalLibraryFilesId = null; if (fullLengthLiningWetOutCommentsDetailsGateway.GetLIBRARY_FILES_IDOriginal(workId, refId) != null) originalLibraryFilesId = fullLengthLiningWetOutCommentsDetailsGateway.GetLIBRARY_FILES_IDOriginal(workId, refId);
                        string originalWorkType = fullLengthLiningWetOutCommentsDetailsGateway.GetWorkTypeOriginal(workId, refId);

                        // new values
                        string newType = fullLengthLiningWetOutCommentsDetailsGateway.GetType(workId, refId);
                        string newSubject = fullLengthLiningWetOutCommentsDetailsGateway.GetSubject(workId, refId);
                        string newComment = fullLengthLiningWetOutCommentsDetailsGateway.GetComment(workId, refId);
                        int? newLibraryFilesId = null; if (fullLengthLiningWetOutCommentsDetailsGateway.GetLIBRARY_FILES_IDOriginal(workId, refId) != null) originalLibraryFilesId = fullLengthLiningWetOutCommentsDetailsGateway.GetLIBRARY_FILES_ID(workId, refId);

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

                            string workType = "Full Length Lining Wet Out";
                            FullLengthLiningWetOutCommentsDetailsGateway fullLengthLiningWetOutCommentsDetailsGatewayForReview = new FullLengthLiningWetOutCommentsDetailsGateway();
                            fullLengthLiningWetOutCommentsDetailsGatewayForReview.LoadAllByWorkIdWorkType(newWorkId, companyId, workType);
                            if (fullLengthLiningWetOutCommentsDetailsGatewayForReview.Table.Rows.Count > 0)
                            {
                                WorkFullLengthLiningWetOutComments workFullLengthLiningWetOutComments = new WorkFullLengthLiningWetOutComments(null);
                                workFullLengthLiningWetOutComments.UpdateDirect(newWorkId, refId, originalType, originalSubject, originalUserId, originalDateTime, originalComment, originalLibraryFilesId, originalDeleted, originalCompanyId, originalWorkType, workId, refId, newType, newSubject, originalUserId, originalDateTime, newComment, newLibraryFilesId, originalDeleted, originalCompanyId, originalWorkType);
                            }
                            else
                            {
                                WorkFullLengthLiningWetOutComments workFullLengthLiningWetOutComments = new WorkFullLengthLiningWetOutComments(null);
                                int? libraryFilesId = null; if (!row.IsLIBRARY_FILES_IDNull()) libraryFilesId = row.LIBRARY_FILES_ID;

                                workFullLengthLiningWetOutComments.InsertDirect(newWorkId, row.RefID, row.Type, row.Subject, row.UserID, row.DateTime_, row.Comment, libraryFilesId, row.Deleted, row.COMPANY_ID, row.WorkType);
                            }
                        }
                    }

                    // Deleted comments
                    if ((row.Deleted) && (row.InDatabase))
                    {
                        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);
                            }
                            WorkFullLengthLiningWetOutComments workFullLengthLiningWetOutComments = new WorkFullLengthLiningWetOutComments(null);
                            workFullLengthLiningWetOutComments.DeleteDirect(newWorkId, row.RefID, row.COMPANY_ID);
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "eSewers";

            // ... For Works
            WorkGateway workGateway = new WorkGateway();

            if (workGateway.ExistsProjectIdAssetIdWorkTypeCompanyId(int.Parse(hdfAssetId.Value), int.Parse(hdfCurrentProjectId.Value), "Full Length Lining", int.Parse(hdfCompanyId.Value)))
            {
                rbtnDeleteAll.Visible = true;
                rbtnDeleteRaOnly.Visible = true;
                lblDeleteDeleteAll.Visible = true;
                lblDeleteDeleteRaOnly.Visible = false;
            }
            else
            {
                rbtnDeleteAll.Visible = false;
                rbtnDeleteRaOnly.Visible = false;
                lblDeleteDeleteAll.Visible = false;
                lblDeleteDeleteRaOnly.Visible = true;
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Update a work (direct to DB)
 /// </summary>
 /// <param name="originalWorkId">originalWorkId</param>
 /// <param name="originalProjectId">originalProjectId</param>
 /// <param name="originalAssetId">originalAssetId</param>
 /// <param name="originalWorkType">originalWorkType</param>
 /// <param name="originalLibraryCategoriesId">originalLibraryCategoriesId</param>
 /// <param name="originalDeleted">originalDeleted</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// <param name="originalComments">originalComments</param>
 /// <param name="originalHistory">originalHistory</param>
 /// 
 /// <param name="newWorkId">newWorkId</param>
 /// <param name="newProjectId">newProjectId</param>
 /// <param name="newAssetId">newAssetId</param>
 /// <param name="newWorkType">newWorkType</param>
 /// <param name="newLibraryCategoriesId">newLibraryCategoriesId</param>
 /// <param name="newDeleted">newDeleted</param>
 /// <param name="newCompanyId">newCompanyId</param>
 /// <param name="newComments">newComments</param>
 /// <param name="newHistory">newHistory</param>
 public void UpdateDirect(int originalWorkId, int originalProjectId, int originalAssetId, string originalWorkType, int? originalLibraryCategoriesId, bool originalDeleted, int originalCompanyId, string originalComments, string originalHistory, int newWorkId, int newProjectId, int newAssetId, string newWorkType, int? newLibraryCategoriesId, bool newDeleted, int newCompanyId, string newComments, string newHistory)
 {
     WorkGateway workGateway = new WorkGateway(null);
     workGateway.Update(originalWorkId, originalProjectId, originalAssetId, originalWorkType, originalLibraryCategoriesId, originalDeleted, originalCompanyId, originalComments, originalHistory, newWorkId, newProjectId, newAssetId, newWorkType, newLibraryCategoriesId, newDeleted, newCompanyId, newComments, newHistory);
 }
Ejemplo n.º 14
0
        private void TagPage()
        {
            hdfCompanyId.Value = Session["companyID"].ToString();
            hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
            hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
            hdfWorkType.Value = "Manhole Rehabilitation";
            hdfAssetId.Value = Request.QueryString["asset_id"].ToString();
            hdfActiveTab.Value = Request.QueryString["active_tab"].ToString();
            hdfInProject.Value = Request.QueryString["in_project"].ToString();
            hdfExistBatchId.Value = "False";

            // Get ids & location
            int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim());
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(projectId);

            if (projectGateway.Table.Rows.Count > 0)
            {
                // ... Get ids
                Int64 currentCountry = projectGateway.GetCountryID(projectId);
                Int64? currentProvince = null; if (projectGateway.GetProvinceID(projectId).HasValue) currentProvince = (Int64)projectGateway.GetProvinceID(projectId);
                Int64? currentCounty = null; if (projectGateway.GetCountyID(projectId).HasValue) currentCounty = (Int64)projectGateway.GetCountyID(projectId);
                Int64? currentCity = null; if (projectGateway.GetCityID(projectId).HasValue) currentCity = (Int64)projectGateway.GetCityID(projectId);

                hdfCountryId.Value = currentCountry.ToString();
                hdfProvinceId.Value = currentProvince.ToString();
                hdfCountyId.Value = currentCounty.ToString();
                hdfCityId.Value = currentCity.ToString();
            }
            else
            {
                hdfCountryId.Value = "";
                hdfProvinceId.Value = "";
                hdfCountyId.Value = "";
                hdfCityId.Value = "";
            }

            // Get workId
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int assetId = Int32.Parse(hdfAssetId.Value);
            string workType = hdfWorkType.Value;

            WorkGateway workGateway = new WorkGateway();
            hdfWorkId.Value = "0";

            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, workType, companyId);

            if (workGateway.Table.Rows.Count > 0)
            {
                hdfWorkId.Value = workGateway.GetWorkId(assetId, workType, projectId).ToString();
            }
        }
        /// <summary>
        /// UpdateFieldsForSections
        /// </summary>
        /// <param name="companyId">companyId</param>
        /// <param name="currentProjectId">currentProjectId</param>
        private void UpdateFieldsForSections(int companyId, int currentProjectId)
        {
            AssetSewerSectionGateway assetSewerFindSectionGateway = new AssetSewerSectionGateway();

            AssetSewerMHGateway assetSewerFindMHGateway = new AssetSewerMHGateway();
            WorkGateway workGateway = new WorkGateway();
            foreach (ProjectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATORRow row in (ProjectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATORDataTable)Table)
            {
                //General data for asset
                assetSewerFindSectionGateway.LoadByAssetId(row.AssetID, companyId); //COMPANY_ID

                // ... For usmh
                row.USMHDescription = "";
                if (!row.IsUSMHNull())
                {
                    assetSewerFindMHGateway.LoadByAssetId(row.USMH, companyId);
                    row.USMHDescription = assetSewerFindMHGateway.GetMHID(row.USMH);
                }

                // ... For dsmh
                row.DSMHDescription = "";
                if (!row.IsDSMHNull())
                {
                    assetSewerFindMHGateway.LoadByAssetId(row.DSMH, companyId);
                    row.DSMHDescription = assetSewerFindMHGateway.GetMHID(row.DSMH);
                }

                // ... For Works
                row.RehabAssessment = workGateway.ExistsProjectIdAssetIdWorkTypeCompanyId(row.AssetID, currentProjectId, "Rehab Assessment", companyId);
                row.FullLengthLining = workGateway.ExistsProjectIdAssetIdWorkTypeCompanyId(row.AssetID, currentProjectId, "Full Length Lining", companyId);
                row.JunctionLining = workGateway.ExistsProjectIdAssetIdWorkTypeCompanyId(row.AssetID, currentProjectId, "Junction Lining Section", companyId);

                row.WorksDescription = "";
                if (row.RehabAssessment) row.WorksDescription = row.WorksDescription + "Rehab Assessment";

                if (row.FullLengthLining)
                {
                    if (row.WorksDescription.Trim().Length > 0)
                    {
                        row.WorksDescription = row.WorksDescription + ", Full Length Lining";
                    }
                    else
                    {
                        row.WorksDescription = row.WorksDescription + "Full Length Lining";
                    }
                }
                if (row.JunctionLining)
                {
                    if (row.WorksDescription.Trim().Length > 0)
                    {
                        row.WorksDescription = row.WorksDescription + ", Junction Lining";
                    }
                    else
                    {
                        row.WorksDescription = row.WorksDescription + "Junction Lining";
                    }
                }

                // ... For Laterals
                AssetSewerLateralGateway assetSewerLateralGateway = new AssetSewerLateralGateway();

                assetSewerLateralGateway.LoadBySectionId(row.AssetID, companyId);

                AssetSewerLateral assetSewerLateral = new AssetSewerLateral(assetSewerLateralGateway.Data);
                row.LateralsDescription = assetSewerLateral.GetAllLaterals(row.AssetID, companyId);
            }
        }
        /// <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="assetId">assetId</param>
        /// <param name="companyId">companyId</param>
        /// <param name="inProject">inProject</param>
        /// <returns>WorkID</returns>
        public int Save(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int assetId, int companyId, bool inProject)
        {
            ManholeRehabilitationTDS manholeRehabilitationChanges = (ManholeRehabilitationTDS)Data.GetChanges();
            int workId = 0;

            if (manholeRehabilitationChanges.WorkDetails.Rows.Count > 0)
            {
                ManholeRehabilitationWorkDetailsGateway manholeRehabilitationWorkDetailsGateway = new ManholeRehabilitationWorkDetailsGateway(manholeRehabilitationChanges);

                // Update manhole rehabilitation
                foreach (ManholeRehabilitationTDS.WorkDetailsRow row in (ManholeRehabilitationTDS.WorkDetailsDataTable)manholeRehabilitationChanges.WorkDetails)
                {
                    // Unchanged values
                    workId = row.WorkID;

                    WorkManholeRehabilitationGateway workManholeRehabilitationGateway = new WorkManholeRehabilitationGateway();
                    workManholeRehabilitationGateway.LoadByWorkId(workId, companyId);

                    if (workManholeRehabilitationGateway.Table.Rows.Count > 0)
                    {
                        // Update Information
                        // Original values
                        // ... work values
                        DateTime? originalPreppedDate = manholeRehabilitationWorkDetailsGateway.GetPreppedDateOriginal(workId);
                        DateTime? originalSprayedDate = manholeRehabilitationWorkDetailsGateway.GetSprayedDateOriginal(workId);

                        // ... Comments
                        string originalComments = manholeRehabilitationWorkDetailsGateway.GetCommentsOriginal(workId);

                        // New variables
                        DateTime? newPreppedDate = manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId);
                        DateTime? newSprayedDate = manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId);

                        // comments
                        string newComments = manholeRehabilitationWorkDetailsGateway.GetComments(workId);

                        // Update work
                        UpdateWork(countryId, provinceId, countyId, cityId, projectId, assetId, originalPreppedDate, originalSprayedDate, row.BatchID, originalComments, false, companyId, newPreppedDate, newSprayedDate, row.BatchID, newComments, false);
                    }
                    else
                    {
                        // Loading workId
                        WorkGateway workGateway = new WorkGateway();
                        workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Manhole Rehabilitation", companyId);

                        if (workGateway.Table.Rows.Count == 0)
                        {
                            // New variables
                            DateTime? newPreppedDate = manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId);
                            DateTime? newSprayedDate = manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId);
                            int? newBatchId = manholeRehabilitationWorkDetailsGateway.GetBatchID(workId);
                            string newComments = manholeRehabilitationWorkDetailsGateway.GetComments(workId);

                            // InsertWork
                            Work work = new Work();

                            int? libraryCategories = null;
                            string history = "";

                            int newWorkId = work.InsertDirect(projectId, assetId, "Manhole Rehabilitation", libraryCategories, false, companyId, newComments, history);

                            // ... Insert manhole rehabilitation work
                            WorkManholeRehabilitation workManholeRehabilitation = new WorkManholeRehabilitation();
                            workManholeRehabilitation.InsertDirect(newWorkId, newPreppedDate, newSprayedDate, newBatchId, false, companyId);

                            workId = newWorkId;
                        }
                    }
                }
            }

            return workId;
        }
Ejemplo n.º 17
0
        private void TagPage()
        {
            hdfCompanyId.Value = Session["companyID"].ToString();
            hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
            hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
            hdfAssetId.Value = Request.QueryString["asset_id"].ToString();
            hdfActiveTab.Value = Request.QueryString["active_tab"].ToString();

            // Get ids & location
            int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim());
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int assetId = Int32.Parse(hdfAssetId.Value);

            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(projectId);

            // ... Get ids
            Int64 currentCountry = projectGateway.GetCountryID(projectId);
            Int64? currentProvince = null; if (projectGateway.GetProvinceID(projectId).HasValue) currentProvince = (Int64)projectGateway.GetProvinceID(projectId);
            Int64? currentCounty = null; if (projectGateway.GetCountyID(projectId).HasValue) currentCounty = (Int64)projectGateway.GetCountyID(projectId);
            Int64? currentCity = null; if (projectGateway.GetCityID(projectId).HasValue) currentCity = (Int64)projectGateway.GetCityID(projectId);

            hdfCountryId.Value = currentCountry.ToString();
            hdfProvinceId.Value = currentProvince.ToString();
            hdfCountyId.Value = currentCounty.ToString();
            hdfCityId.Value = currentCity.ToString();

            // Get workId
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Point Repairs", companyId);
            hdfWorkId.Value = workGateway.GetWorkId(assetId, "Point Repairs", projectId).ToString();
        }
Ejemplo n.º 18
0
        private void TagPage()
        {
            hdfCompanyId.Value = Session["companyID"].ToString();
            hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
            hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
            hdfWorkType.Value = "Rehab Assessment";
            hdfAssetId.Value = Request.QueryString["asset_id"].ToString();

            // Get workId
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int assetId = Int32.Parse(hdfAssetId.Value);
            string workType = hdfWorkType.Value;
            int projectId = Int32.Parse(hdfCurrentProjectId.Value);

            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, workType, companyId);
            hdfWorkId.Value = workGateway.GetWorkId(assetId, workType, projectId).ToString();
        }
Ejemplo n.º 19
0
        protected void grdLaterals_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
            {
                int lateral = int.Parse(((Label)e.Row.FindControl("lblLateral")).Text);

                if (lateral > 0)
                {
                    FullLengthLiningLateralDetailsGateway gateway = new FullLengthLiningLateralDetailsGateway(fullLengthLiningTDS);
                    ((TextBox)e.Row.FindControl("tbxMaterial")).Text = gateway.GetMaterialType(lateral);
                }
            }

            // Control value for footer material
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                // For Material
                ((DropDownList)e.Row.FindControl("ddlNewMaterial")).SelectedIndex = 0;
            }

            // Control of edit controls
            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
            {
                int lateral = int.Parse(((Label)e.Row.FindControl("lblLateral")).Text);

                if (lateral > 0)
                {
                    FullLengthLiningLateralDetailsGateway gateway = new FullLengthLiningLateralDetailsGateway(fullLengthLiningTDS);

                    int companyId = Int32.Parse(hdfCompanyId.Value);

                    // ... Control material and connection type dropdownlists
                    ((DropDownList)e.Row.FindControl("ddlMaterialEdit")).SelectedValue = gateway.GetMaterialType(lateral);
                    ((DropDownList)e.Row.FindControl("ddlConnectionTypeEdit")).SelectedValue = gateway.GetConnectionType(lateral);

                    // .... If lateral us used in junction lining
                    if (gateway.GetInJlDatabase(lateral))
                    {
                        if (!LateralsCouldBeDeletedInJl(lateral))
                        {
                            ((CheckBox)e.Row.FindControl("cbxJlEdit")).Enabled = false;
                        }
                    }

                    // ... Control live value
                    int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value);
                    WorkGateway workGateway = new WorkGateway();
                    workGateway.LoadByProjectIdAssetIdWorkType(currentProjectId, lateral, "Junction Lining Lateral", companyId);

                    // ... If lateral is not used in junction lining
                    if (!workGateway.ExistsProjectIdAssetIdWorkTypeCompanyId(lateral, currentProjectId, "Junction Lining Lateral", companyId))
                    {
                        ((DropDownList)e.Row.FindControl("ddlLiveEdit")).Visible = true;
                        ((DropDownList)e.Row.FindControl("ddlLiveEdit")).SelectedValue = gateway.GetLive(lateral);
                        ((TextBox)e.Row.FindControl("tbxJlLive")).Visible = false;
                    }
                    else
                    {
                        ((DropDownList)e.Row.FindControl("ddlLiveEdit")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxJlLive")).Visible = true;
                    }
                }
            }
        }
        /// <summary>
        /// Save a Previous FL work
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="section_assetId">section_assetId</param>
        /// <param name="companyId">companyId</param>
        private void SavePreviousFLWork(int projectId, int section_assetId, int companyId)
        {
            // Load Previous work  -  Full Length Lining data (last sections work)
            string workType = "Full Length Lining";
            WorkFullLengthLiningGateway workFullLengthLiningGateway = new WorkFullLengthLiningGateway();
            workFullLengthLiningGateway.LoadTop1ByProjectIdAssetIdWorkType(projectId, section_assetId, workType, companyId);

            int workId = workFullLengthLiningGateway.GetWorkIdTop1();
            string clientId = ""; if (workFullLengthLiningGateway.GetClientId(workId) != "") clientId = workFullLengthLiningGateway.GetClientId(workId);
            DateTime? proposedLiningDate = null; if (workFullLengthLiningGateway.GetProposedLiningDate(workId).HasValue) proposedLiningDate = workFullLengthLiningGateway.GetProposedLiningDate(workId);
            DateTime? deadlineLiningDate = null; if (workFullLengthLiningGateway.GetDeadlineLiningDate(workId).HasValue) deadlineLiningDate = workFullLengthLiningGateway.GetDeadlineLiningDate(workId);
            DateTime? p1Date = null; if (workFullLengthLiningGateway.GetP1Date(workId).HasValue) p1Date = workFullLengthLiningGateway.GetP1Date(workId);
            DateTime? m1Date = null; if (workFullLengthLiningGateway.GetM1Date(workId).HasValue) m1Date = workFullLengthLiningGateway.GetM1Date(workId);
            DateTime? m2Date = null; if (workFullLengthLiningGateway.GetM2Date(workId).HasValue) m2Date = workFullLengthLiningGateway.GetM2Date(workId);
            DateTime? installDate = null; if (workFullLengthLiningGateway.GetInstallDate(workId).HasValue) installDate = workFullLengthLiningGateway.GetInstallDate(workId);
            DateTime? finalVideoDate = null; if (workFullLengthLiningGateway.GetFinalVideoDate(workId).HasValue) finalVideoDate = workFullLengthLiningGateway.GetFinalVideoDate(workId);
            bool issueIdentified = workFullLengthLiningGateway.GetIssueIdentified(workId);
            bool issueLfs = workFullLengthLiningGateway.GetIssueLFS(workId);
            bool issueClient = workFullLengthLiningGateway.GetIssueClient(workId);
            bool issueSales = workFullLengthLiningGateway.GetIssueSales(workId);
            bool issueGivenToClient = workFullLengthLiningGateway.GetIssueGivenToClient(workId);
            bool issueResolved = workFullLengthLiningGateway.GetIssueResolved(workId);
            bool issueInvestigation = workFullLengthLiningGateway.GetIssueInvestigation(workId);

            // Load Previous work  -  Full Length Lining M1 data (last sections work)
            FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway();
            fullLengthLiningWorkDetailsGateway.LoadByWorkIdAssetId(workId, section_assetId, companyId);

            string measurementTakenBy = ""; if (fullLengthLiningWorkDetailsGateway.GetMeasurementTakenBy(workId) != "") measurementTakenBy = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenBy(workId);
            string trafficControl = ""; if (fullLengthLiningWorkDetailsGateway.GetTrafficControl(workId) != "") trafficControl = fullLengthLiningWorkDetailsGateway.GetTrafficControl(workId);
            string siteDetails = ""; if (fullLengthLiningWorkDetailsGateway.GetSiteDetails(workId) != "") siteDetails = fullLengthLiningWorkDetailsGateway.GetSiteDetails(workId);
            string accessType = ""; if (fullLengthLiningWorkDetailsGateway.GetAccessType(workId) != "") accessType = fullLengthLiningWorkDetailsGateway.GetAccessType(workId);
            bool pipeSizeChange = fullLengthLiningWorkDetailsGateway.GetPipeSizeChange(workId);
            bool standardByPass = fullLengthLiningWorkDetailsGateway.GetStandardBypass(workId);
            string standardByPassComments = ""; if (fullLengthLiningWorkDetailsGateway.GetStandardBypassComments(workId) != "") standardByPassComments = fullLengthLiningWorkDetailsGateway.GetStandardBypassComments(workId);
            string trafficControlDetails = ""; if (fullLengthLiningWorkDetailsGateway.GetTrafficControlDetails(workId) != "") trafficControlDetails = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetails(workId);
            string measurementType = ""; if (fullLengthLiningWorkDetailsGateway.GetMeasurementType(workId) != "") measurementType = fullLengthLiningWorkDetailsGateway.GetMeasurementType(workId);
            string measurementFromMH = ""; if (fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workId) != "") measurementFromMH = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workId);
            string videoDoneFromMH = ""; if (fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMh(workId) != "") videoDoneFromMH = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMh(workId);
            string videoDoneToMH = ""; if (fullLengthLiningWorkDetailsGateway.GetVideoDoneToMh(workId) != "") videoDoneToMH = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMh(workId);

            // Load Previous work  -  Full Length Lining M2 data (last sections work)
            string videoLength = ""; if (fullLengthLiningWorkDetailsGateway.GetVideoLength(workId) != "") videoLength = fullLengthLiningWorkDetailsGateway.GetVideoLength(workId);
            string measurementTakenBy2 = ""; if (fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2(workId) != "") measurementTakenBy2 = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2(workId);
            bool dropPipe = fullLengthLiningWorkDetailsGateway.GetDropPipe(workId);
            string dropPipeInvertDepth = ""; if (fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepth(workId) != "") dropPipeInvertDepth = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepth(workId);
            int? cappedLaterals = null; if (fullLengthLiningWorkDetailsGateway.GetCappedLaterals(workId).HasValue) cappedLaterals = fullLengthLiningWorkDetailsGateway.GetCappedLaterals(workId);
            string lineWithID = ""; if (fullLengthLiningWorkDetailsGateway.GetLineWithId(workId) != "") lineWithID = fullLengthLiningWorkDetailsGateway.GetLineWithId(workId);
            string hydrantAddress = ""; if (fullLengthLiningWorkDetailsGateway.GetHydrantAddress(workId) != "") hydrantAddress = fullLengthLiningWorkDetailsGateway.GetHydrantAddress(workId);
            string hydroWireWithin10FtOfInversionMH = ""; if (fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMH(workId) != "") hydroWireWithin10FtOfInversionMH = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMH(workId);
            string distanceToInversionMH = ""; if (fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMh(workId) != "") distanceToInversionMH = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMh(workId);
            string surfaceGrade = ""; if (fullLengthLiningWorkDetailsGateway.GetSurfaceGrade(workId) != "") surfaceGrade = fullLengthLiningWorkDetailsGateway.GetSurfaceGrade(workId);
            bool hydroPulley = fullLengthLiningWorkDetailsGateway.GetHydroPulley(workId);
            bool fridgeCart = fullLengthLiningWorkDetailsGateway.GetFridgeCart(workId);
            bool twoPump = fullLengthLiningWorkDetailsGateway.GetTwoPump(workId);
            bool sixBypass = fullLengthLiningWorkDetailsGateway.GetSixBypass(workId);
            bool scaffolding = fullLengthLiningWorkDetailsGateway.GetScaffolding(workId);
            bool winchExtention = fullLengthLiningWorkDetailsGateway.GetWinchExtension(workId);
            bool extraGenerator = fullLengthLiningWorkDetailsGateway.GetExtraGenerator(workId);
            bool greyCableExtension = fullLengthLiningWorkDetailsGateway.GetGreyCableExtension(workId);
            bool easementMats = fullLengthLiningWorkDetailsGateway.GetEasementMats(workId);
            bool rampRequired = fullLengthLiningWorkDetailsGateway.GetRampRequired(workId);
            bool cameraSkid = fullLengthLiningWorkDetailsGateway.GetCameraSkid(workId);

            // Load Previous work  -  Full Length Lining P1 data (last sections work)
            int? cxisRemoved = null; if (fullLengthLiningWorkDetailsGateway.GetCxisRemoved(workId).HasValue) fullLengthLiningWorkDetailsGateway.GetCxisRemoved(workId);
            bool roboticPrepCompleted = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompleted(workId);
            DateTime? roboticPrepCompletedDate = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDate(workId);
            bool p1Completed = fullLengthLiningWorkDetailsGateway.GetP1Completed(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
            WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(null);
            int newSectionWorkId = workFullLengthLining.InsertDirectFullWork(projectId, section_assetId, libraryCategoriesId, clientId, proposedLiningDate, deadlineLiningDate, p1Date, m1Date, m2Date, installDate, finalVideoDate, issueIdentified, issueLfs, issueClient, issueSales, issueGivenToClient, issueResolved, false, companyId, issueInvestigation, comments, history, cxisRemoved, roboticPrepCompleted, roboticPrepCompletedDate, measurementTakenBy, trafficControl, siteDetails, pipeSizeChange, standardByPass, standardByPassComments, trafficControlDetails, measurementType, measurementFromMH, videoDoneFromMH, videoDoneToMH, videoLength, measurementTakenBy2, dropPipe, dropPipeInvertDepth, cappedLaterals, lineWithID, hydrantAddress, hydroWireWithin10FtOfInversionMH, distanceToInversionMH, surfaceGrade, hydroPulley, fridgeCart, twoPump, sixBypass, scaffolding, winchExtention, extraGenerator, greyCableExtension, easementMats, rampRequired, cameraSkid, accessType, p1Completed);

            // Load Previous work  -  Save fl laterals
            WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway();
            workFullLengthLiningM1LateralGateway.LoadByWorkId(workId, companyId);

            foreach (WorkTDS.LFS_WORK_FULLLENGTHLINING_M1_LATERALRow lateralRow in (WorkTDS.LFS_WORK_FULLLENGTHLINING_M1_LATERALDataTable)workFullLengthLiningM1LateralGateway.Table)
            {
                int lateral = lateralRow.Lateral;
                string videoDistance = ""; if (!lateralRow.IsVideoDistanceNull()) videoDistance = lateralRow.VideoDistance;
                string clockPosition = ""; if (!lateralRow.IsClockPositionNull()) clockPosition = lateralRow.ClockPosition;
                string distanceToCentre = ""; if (!lateralRow.IsDistanceToCentreNull()) distanceToCentre = lateralRow.DistanceToCentre;
                string timeOpened = ""; if (!lateralRow.IsTimeOpenedNull()) timeOpened = lateralRow.TimeOpened;
                string reverseSetup = ""; if (!lateralRow.IsReverseSetupNull()) reverseSetup = lateralRow.ReverseSetup;
                DateTime? reinstate = null; if (!lateralRow.IsReinstateNull()) reinstate = lateralRow.Reinstate;
                string lateralComments = ""; if (!lateralRow.IsCommentsNull()) lateralComments = lateralRow.Comments;
                string clientInspectionNo = ""; if (!lateralRow.IsClientInspectionNoNull()) clientInspectionNo = lateralRow.ClientInspectionNo;
                DateTime? v1Inspection = null; if (!lateralRow.IsV1InspectionNull()) v1Inspection = lateralRow.V1Inspection;
                bool requiresRoboticPrep = lateralRow.RequiresRoboticPrep;
                DateTime? requiresRoboticPrepDate = null; if (!lateralRow.IsRequiresRoboticPrepDateNull()) requiresRoboticPrepDate = lateralRow.RequiresRoboticPrepDate;
                bool holdClientIssue = lateralRow.HoldClientIssue;
                bool holdLFSIssue = lateralRow.HoldLFSIssue;
                bool lineLateral = lateralRow.LineLateral;
                bool dyeTestReq = lateralRow.DyeTestReq;
                DateTime? dyeTestComplete = null; if (!lateralRow.IsDyeTestCompleteNull()) dyeTestComplete = lateralRow.DyeTestComplete;
                string contractYear = lateralRow.ContractYear;

                WorkFullLengthLiningM1Lateral workFullLengthLiningM1Lateral = new WorkFullLengthLiningM1Lateral();
                workFullLengthLiningM1Lateral.InsertDirect(newSectionWorkId, lateral, videoDistance, clockPosition, distanceToCentre, timeOpened, reverseSetup, reinstate, lateralComments, false, companyId, clientInspectionNo, v1Inspection, requiresRoboticPrep, requiresRoboticPrepDate, holdClientIssue, holdLFSIssue, lineLateral, dyeTestReq, dyeTestComplete, contractYear);
            }

            // Load Previous work  - Comments and History
            SavePreviousComments(workId, workType, companyId, newSectionWorkId);
            SavePreviousHistory(workId, workType, companyId, newSectionWorkId);
        }
Ejemplo n.º 21
0
        private void LoadWorkData(int workId, int assetId)
        {
            FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway(fullLengthLiningTDS);

            if (fullLengthLiningWorkDetailsGateway.Table.Rows.Count > 0)
            {
                // For Header
                tbxVideoLength.Text = fullLengthLiningWorkDetailsGateway.GetVideoLength(workId);

                // Load full length lining general data
                tbxGeneralClientId.Text = fullLengthLiningWorkDetailsGateway.GetClientId(workId);
                ckbxGeneralIssueIdentified.Checked = fullLengthLiningWorkDetailsGateway.GetIssueIdentified(workId);
                ckbxGeneralLfsIssue.Checked = fullLengthLiningWorkDetailsGateway.GetIssueLFS(workId);
                ckbxGeneralClientIssue.Checked = fullLengthLiningWorkDetailsGateway.GetIssueClient(workId);
                ckbxGeneralSalesIssue.Checked = fullLengthLiningWorkDetailsGateway.GetIssueSales(workId);
                ckbxGeneralIssueGivenToClient.Checked = fullLengthLiningWorkDetailsGateway.GetIssueGivenToClient(workId);
                ckbxGeneralIssueResolved.Checked = fullLengthLiningWorkDetailsGateway.GetIssueResolved(workId);
                ckbxGeneralIssueInvestigation.Checked = fullLengthLiningWorkDetailsGateway.GetIssueInvestigation(workId);

                // ... Load Dates
                if (fullLengthLiningWorkDetailsGateway.GetProposedLiningDate(workId).HasValue)
                {
                    tkrdpGeneralProposedLiningDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetProposedLiningDate(workId);
                }

                if (fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDate(workId).HasValue)
                {
                    tkrdpGeneralDeadlineLiningDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDate(workId);
                }

                if (fullLengthLiningWorkDetailsGateway.GetP1Date(workId).HasValue)
                {
                    tkrdpPrepDataP1Date.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetP1Date(workId);
                    tkrdpGeneralP1Date.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetP1Date(workId);
                }

                if (fullLengthLiningWorkDetailsGateway.GetM1Date(workId).HasValue)
                {
                    tkrdpM1DataM1Date.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetM1Date(workId);
                    tkrdpGeneralM1Date.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetM1Date(workId);
                }

                if (fullLengthLiningWorkDetailsGateway.GetM2Date(workId).HasValue)
                {
                    tkrdpGeneralM2Date.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetM2Date(workId);
                    tkrdpM2DataM2Date.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetM2Date(workId);
                }

                if (fullLengthLiningWorkDetailsGateway.GetInstallDate(workId).HasValue)
                {
                    tkrdpGeneralInstallDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetInstallDate(workId);
                    tkrdpInstallDataInstallDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetInstallDate(workId);
                }

                if (fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workId).HasValue)
                {
                    tkrdpGeneralFinalVideo.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workId);
                    tkrdpInstallDataFinalVideoDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workId);
                }

                // ... for RA data
                if (fullLengthLiningWorkDetailsGateway.GetPreFlushDate(workId).HasValue)
                {
                    tkrdpGeneralPreFlushDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetPreFlushDate(workId);
                    tkrdpGeneralPreFlushDateReadOnly.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetPreFlushDate(workId);
                }

                if (fullLengthLiningWorkDetailsGateway.GetPreVideoDate(workId).HasValue)
                {
                    tkrdpGeneralPreVideoDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetPreVideoDate(workId);
                    tkrdpGeneralPreVideoDateReadOnly.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetPreVideoDate(workId);
                }

                // For FullLengthLiningP1 data
                tbxPrepDataCXIsRemoved.Text = ""; if (fullLengthLiningWorkDetailsGateway.GetCxisRemoved(workId).HasValue) tbxPrepDataCXIsRemoved.Text = fullLengthLiningWorkDetailsGateway.GetCxisRemoved(workId).ToString();
                ckbxPrepDataRoboticPrepCompleted.Checked = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompleted(workId);
                if (fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDate(workId).HasValue)
                {
                    tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate = (DateTime)fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDate(workId);
                }
                ckbxPrepDataP1Completed.Checked = fullLengthLiningWorkDetailsGateway.GetP1Completed(workId);

                // For FullLengthLiningM1 data
                // ... for material
                ddlM1DataMaterial.SelectedValue = fullLengthLiningWorkDetailsGateway.GetMaterial(workId);

                // ... form m1 data
                tbxM1DataMeasurementsTakenBy.Text = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenBy(workId);
                ddlM1DataTrafficControl.SelectedValue = fullLengthLiningWorkDetailsGateway.GetTrafficControl(workId);
                if(fullLengthLiningWorkDetailsGateway.GetSiteDetails(workId) == "") ddlM1DataSiteDetails.SelectedIndex = 0; else ddlM1DataSiteDetails.SelectedValue = fullLengthLiningWorkDetailsGateway.GetSiteDetails(workId);
                if (fullLengthLiningWorkDetailsGateway.GetAccessType(workId) == "") ddlM1DataAccessType.SelectedIndex = 0; else ddlM1DataAccessType.SelectedValue = fullLengthLiningWorkDetailsGateway.GetAccessType(workId);
                ckbxM1DataPipeSizeChange.Checked = fullLengthLiningWorkDetailsGateway.GetPipeSizeChange(workId);
                ckbxM1DataStandardBypass.Checked = fullLengthLiningWorkDetailsGateway.GetStandardBypass(workId);
                tbxM1DataStandardBypassComments.Text = fullLengthLiningWorkDetailsGateway.GetStandardBypassComments(workId);
                tbxM1DataTrafficControlDetails.Text = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetails(workId);
                ddlM1DataMeasurementType.SelectedValue = fullLengthLiningWorkDetailsGateway.GetMeasurementType(workId);
                ddlM1DataMeasuredFromMh.SelectedValue = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workId);
                tbxM1DataMeasuredFromMh.Text = ""; fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workId);
                ddlM1DataVideoDoneFromMh.SelectedValue = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMh(workId);
                tbxM1DataVideoDoneFromMh.Text = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMh(workId);
                ddlM1DataVideoDoneToMh.SelectedValue = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMh(workId);
                tbxM1DataVideoDoneToMh.Text = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMh(workId);

                // For FullLengthLiningM2 data
                tbxM2DataMeasurementsTakenBy.Text = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2(workId);
                ckbxM2DataDropPipe.Checked = fullLengthLiningWorkDetailsGateway.GetDropPipe(workId);
                tbxM2DataDropPipeInvertdepth.Text = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepth(workId);
                tbxM2DataCappedLaterals.Text = ""; if (fullLengthLiningWorkDetailsGateway.GetCappedLaterals(workId).HasValue) tbxM2DataCappedLaterals.Text = fullLengthLiningWorkDetailsGateway.GetCappedLaterals(workId).ToString();
                tbxM2DataLineWidthId.Text = fullLengthLiningWorkDetailsGateway.GetLineWithId(workId);
                tbxM2DataHydrantAddress.Text = fullLengthLiningWorkDetailsGateway.GetHydrantAddress(workId);
                ddlM2DataHydroWireWithin10FtOfInversionMh.SelectedValue = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMH(workId);
                tbxM2DataDistanceToInversionMH.Text = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMh(workId);
                if (fullLengthLiningWorkDetailsGateway.GetSurfaceGrade(workId) == "") ddlM2DataSurfaceGrade.SelectedIndex = 0; else ddlM2DataSurfaceGrade.SelectedValue = fullLengthLiningWorkDetailsGateway.GetSurfaceGrade(workId);
                cbxM2DataHydroPulley.Checked = fullLengthLiningWorkDetailsGateway.GetHydroPulley(workId);
                cbxM2DataFridgeCart.Checked = fullLengthLiningWorkDetailsGateway.GetFridgeCart(workId);
                cbxM2DataTwoPump.Checked = fullLengthLiningWorkDetailsGateway.GetTwoPump(workId);
                cbxM2DataSixBypass.Checked = fullLengthLiningWorkDetailsGateway.GetSixBypass(workId);
                cbxM2DataScaffolding.Checked = fullLengthLiningWorkDetailsGateway.GetScaffolding(workId);
                cbxM2DataWinchExtension.Checked = fullLengthLiningWorkDetailsGateway.GetWinchExtension(workId);
                cbxM2DataExtraGenerator.Checked = fullLengthLiningWorkDetailsGateway.GetExtraGenerator(workId);
                cbxM2DataGreyCableExtension.Checked = fullLengthLiningWorkDetailsGateway.GetGreyCableExtension(workId);
                cbxM2DataEasementMats.Checked = fullLengthLiningWorkDetailsGateway.GetEasementMats(workId);
                cbxM2DataRampsRequired.Checked = fullLengthLiningWorkDetailsGateway.GetRampRequired(workId);
                cbxM2DataCameraSkid.Checked = fullLengthLiningWorkDetailsGateway.GetCameraSkid(workId);

                // For FullLengthLiningWetOut data
                int companyId = Int32.Parse(hdfCompanyId.Value);

                // ... ... tube size = confirmed Size
                Distance confirmedSizeDistance = new Distance(tbxConfirmedSize.Text);
                double confirmedSize = 0;
                string[] confirmedSizeString = confirmedSizeDistance.ToStringInEng1().Split('\"');

                if (!confirmedSizeDistance.ToStringInEng1().Contains("'"))
                {
                    if (Validator.IsValidDouble(tbxConfirmedSize.Text))
                    {
                        confirmedSize = double.Parse(tbxConfirmedSize.Text);
                    }
                    else
                    {
                        confirmedSize = double.Parse(confirmedSizeString[0]);
                    }
                }
                else
                {
                    confirmedSize = Math.Ceiling(confirmedSizeDistance.ToDoubleInEng3()*12);
                    tbxConfirmedSize.Text = confirmedSize.ToString();
                }

                // ... Verify if work has wet out information
                WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway();
                workFullLengthLiningWetOutGateway.LoadByWorkId(workId, companyId);

                if (workFullLengthLiningWetOutGateway.Table.Rows.Count > 0)
                {
                    // ... setup data
                    ddlWetOutDataLinerTube.SelectedValue = fullLengthLiningWorkDetailsGateway.GetLinerTube(workId);
                    if (ddlWetOutDataLinerTube.SelectedValue != "(Select)")
                    {
                        ckbxWetOutDataIncludeWetOutInformation.Checked = true;
                    }
                    else
                    {
                        ckbxWetOutDataIncludeWetOutInformation.Checked = false;
                    }

                    ddlWetOutDataResins.SelectedValue = fullLengthLiningWorkDetailsGateway.GetResinId(workId).ToString();
                    tbxWetOutDataExcessResin.Text = fullLengthLiningWorkDetailsGateway.GetExcessResin(workId).ToString();
                    ddlWetOutDataPoundsDrums.SelectedValue = fullLengthLiningWorkDetailsGateway.GetPoundsDrums(workId);
                    tbxWetOutDataDrumDiameter.Text = fullLengthLiningWorkDetailsGateway.GetDrumDiameter(workId).ToString();
                    tbxWetOutDataHoistMaximumHeight.Text = fullLengthLiningWorkDetailsGateway.GetHoistMaximumHeight(workId).ToString();
                    tbxWetOutDataHoistMinimumHeight.Text = fullLengthLiningWorkDetailsGateway.GetHoistMinimumHeight(workId).ToString();
                    tbxWetOutDataDownDropTubeLength.Text = fullLengthLiningWorkDetailsGateway.GetDownDropTubeLenght(workId).ToString();
                    tbxWetOutDataPumpHeightAboveGround.Text = fullLengthLiningWorkDetailsGateway.GetPumpHeightAboveGround(workId).ToString();
                    tbxWetOutDataTubeResinToFeltFactor.Text = fullLengthLiningWorkDetailsGateway.GetTubeResinToFeltFactor(workId).ToString();

                    // ... wet out sheet
                    DateTime wetOutDataDateOfSheet = fullLengthLiningWorkDetailsGateway.GetDateOfSheet(workId);
                    tbxWetOutDataDateOfSheet.Text = wetOutDataDateOfSheet.Month.ToString() + "/" + wetOutDataDateOfSheet.Day.ToString() + "/" + wetOutDataDateOfSheet.Year.ToString();
                    ddlWetOutDataMadeBy.SelectedValue = fullLengthLiningWorkDetailsGateway.GetEmployeeId(workId).ToString();
                    hdfRunDetails.Value = fullLengthLiningWorkDetailsGateway.GetRunDetails(workId);
                    ddlWetOutDataRunDetails2.SelectedValue = fullLengthLiningWorkDetailsGateway.GetRunDetails2(workId);
                    tkrdpWetOutDataWetOutDate.SelectedDate = fullLengthLiningWorkDetailsGateway.GetWetOutDate(workId);

                    tbxWetOutDataInstallDate.Text = "";
                    if (fullLengthLiningWorkDetailsGateway.GetWetOutInstallDate(workId).HasValue)
                    {
                        DateTime? wetOutDataInstallDate = fullLengthLiningWorkDetailsGateway.GetWetOutInstallDate(workId);
                        DateTime wetOutDataInstallDateDateTime = (DateTime)wetOutDataInstallDate;
                        tbxWetOutDataInstallDate.Text = wetOutDataInstallDateDateTime.Month.ToString() + "/" + wetOutDataInstallDateDateTime.Day.ToString() + "/" + wetOutDataInstallDateDateTime.Year.ToString();
                    }

                    tbxWetOutDataTubeThickness.Text = fullLengthLiningWorkDetailsGateway.GetInversionThickness(workId);
                    tbxWetOutDataLengthToLine.Text = decimal.Round(decimal.Parse(fullLengthLiningWorkDetailsGateway.GetLengthToLine(workId).ToString()), 1).ToString();
                    tbxWetOutDataPlusExtra.Text = fullLengthLiningWorkDetailsGateway.GetPlusExtra(workId).ToString();
                    tbxWetOutDataForTurnOffset.Text = fullLengthLiningWorkDetailsGateway.GetForTurnOffset(workId).ToString();
                    tbxWetOutDataLengthtToWetOut.Text = fullLengthLiningWorkDetailsGateway.GetLengthToWetOut(workId).ToString();

                    tbxWetOutDataTubeMaxColdHead.Text = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHead(workId).ToString();
                    tbxWetOutDataTubeMaxColdHeadPSI.Text = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHeadPsi(workId).ToString();
                    tbxWetOutDataTubeMaxHotHead.Text = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHead(workId).ToString();
                    tbxWetOutDataTubeMaxHotHeadPSI.Text = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHeadPsi(workId).ToString();
                    tbxWetOutDataTubeIdealHead.Text = fullLengthLiningWorkDetailsGateway.GetTubeIdealHead(workId).ToString();
                    tbxWetOutDataTubeIdealHeadPSI.Text = fullLengthLiningWorkDetailsGateway.GetTubeIdealHeadPsi(workId).ToString();

                    tbxWetOutDataNetResinForTube.Text = fullLengthLiningWorkDetailsGateway.GetNetResinForTube(workId).ToString();
                    tbxWetOutDataNetResinForTubeUsgals.Text = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgals(workId).ToString();
                    tbxWetOutDataNetResinForTubeDrumsIns.Text = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeDrumsIns(workId);
                    tbxWetOutDataNetResinForTubeLbsFt.Text = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeLbsFt(workId).ToString();
                    tbxWetOutDataNetResinForTubeUsgFt.Text = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgFt(workId).ToString();

                    tbxWetOutDataExtraResinForMix.Text = fullLengthLiningWorkDetailsGateway.GetExtraResinForMix(workId).ToString();
                    tbxWetOutDataExtraLbsForMix.Text = fullLengthLiningWorkDetailsGateway.GetExtraLbsForMix(workId).ToString();
                    tbxWetOutDataTotalMixQuantity.Text = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantity(workId).ToString();
                    tbxWetOutDataTotalMixQuantityUsgals.Text = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityUsgals(workId).ToString();
                    tbxWetOutDataTotalMixQuantityDrumsIns.Text = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityDrumsIns(workId);

                    ddlWetOutDataInversionType.SelectedValue = fullLengthLiningWorkDetailsGateway.GetInversionType(workId);
                    tbxWetOutDataDepthOfInversionMH.Text = fullLengthLiningWorkDetailsGateway.GetDepthOfInversionMH(workId).ToString();
                    tbxWetOutDataTubeForColumn.Text = fullLengthLiningWorkDetailsGateway.GetTubeForColumn(workId).ToString();
                    tbxWetOutDataTubeForStartDry.Text = fullLengthLiningWorkDetailsGateway.GetTubeForStartDry(workId).ToString();
                    tbxWetOutDataTotalTube.Text = fullLengthLiningWorkDetailsGateway.GetTotalTube(workId).ToString();
                    tbxWetOutDataDropTubeConnects.Text = fullLengthLiningWorkDetailsGateway.GetDropTubeConnects(workId);
                    tbxWetOutDataAllowsHeadTo.Text = fullLengthLiningWorkDetailsGateway.GetAllowsHeadTo(workId).ToString();
                    tbxWetOutDataRollerGap.Text = fullLengthLiningWorkDetailsGateway.GetRollerGap(workId).ToString();

                    tbxWetOutDataHeightNeeded.Text = fullLengthLiningWorkDetailsGateway.GetHeightNeeded(workId).ToString();
                    tbxWetOutDataAvailable.Text = fullLengthLiningWorkDetailsGateway.GetAvailable(workId);
                    tbxWetOutDataHoistHeight.Text = fullLengthLiningWorkDetailsGateway.GetHoistHeight(workId);
                    hdfResinId.Value = fullLengthLiningWorkDetailsGateway.GetResinId(workId).ToString();
                    hdfMadeBy.Value = fullLengthLiningWorkDetailsGateway.GetEmployeeId(workId).ToString();
                    tbxWetOutDataNotes.Text = fullLengthLiningWorkDetailsGateway.GetCommentsCipp(workId);

                    lblWetOutDataResinGray.Text = fullLengthLiningWorkDetailsGateway.GetResinsLabel(workId);
                    lblWetOutDataDrumContainsGray.Text = fullLengthLiningWorkDetailsGateway.GetDrumContainsLabel(workId);
                    lblWetOutDataLinerTubeGray.Text = fullLengthLiningWorkDetailsGateway.GetLinerTubeLabel(workId);
                    lblWetOutDataLbDrumsGrey.Text = fullLengthLiningWorkDetailsGateway.GetForLbDrumsLabel(workId);
                    lblWetOutDataNetResinGrey.Text = fullLengthLiningWorkDetailsGateway.GetNetResinLabel(workId);
                    lblWetOutDataCatalystGrey.Text = fullLengthLiningWorkDetailsGateway.GetCatalystLabel(workId);

                    // ... ... graphic labels
                    lblWetOutDataDimensionLabel.Text = confirmedSize + " ins x " + ddlThickness.SelectedValue + " mm Tube";
                    lblWetOutDataTotalTubeLengthlabel.Text = "Total Tube Length " + tbxWetOutDataTotalTube.Text + " ft";
                    lblWetOutDataForColumnLabel.Text = tbxWetOutDataTubeForColumn.Text + " ft  for Column";
                    lblWetOutDataDryFtLabel.Text = "Dry " + tbxWetOutDataTubeForStartDry.Text + " ft";
                    lblWetOutDataWetOutLengthlabel.Text = "Wet-Out Length " + tbxWetOutDataLengthtToWetOut.Text + " ft";
                    lblWetOutDataDryFtEndLabel.Text = "Dry " + tbxWetOutDataTubeForColumn.Text + " ft";
                    lblWetOutDataTailEndlabel.Text = "Tail End";
                    lblWetOutDataColumnEndlabel.Text = "Column End";
                    lblWetOutDataRollerGapLabel.Text = "Roller Gap " + tbxWetOutDataRollerGap.Text + " mm";
                }
                else
                {
                    //  Wet Out Data
                    // ... Show current day for new sheets
                    DateTime sheetDate = DateTime.Now;
                    tbxWetOutDataDateOfSheet.Text = sheetDate.Month.ToString() + "/" + sheetDate.Day.ToString() + "/" + sheetDate.Year.ToString();

                    // Set default values.
                    tbxWetOutDataExcessResin.Text = "0.0";
                    ddlWetOutDataPoundsDrums.SelectedIndex = 1;
                    tbxWetOutDataDrumDiameter.Text = "22.5";
                    tbxWetOutDataHoistMaximumHeight.Text = "24";
                    tbxWetOutDataHoistMinimumHeight.Text = "5";
                    tbxWetOutDataDownDropTubeLength.Text = "19";
                    tbxWetOutDataPumpHeightAboveGround.Text = "6";
                    tbxWetOutDataTubeResinToFeltFactor.Text = "87";

                    tbxWetOutDataPlusExtra.Text = "3";
                    tbxWetOutDataForTurnOffset.Text = "0";

                    tbxWetOutDataExtraResinForMix.Text = "0";
                    tbxWetOutDataTubeForColumn.Text = "16";
                    tbxWetOutDataTubeForStartDry.Text = "3";
                    if (ddlWetOutDataInversionType.SelectedValue == "Top")
                    {
                        Distance usmhDepthDistance = new Distance(tbxM1DataUsmhDepth.Text);
                        tbxWetOutDataDepthOfInversionMH.Text = decimal.Round(decimal.Parse(usmhDepthDistance.ToStringInEng3()), 1).ToString();
                    }
                    else
                    {
                        if (ddlWetOutDataInversionType.SelectedValue == "Bottom")
                        {
                            Distance dsmhDepthDistance = new Distance(tbxM1DataDsmhDepth.Text);
                            tbxWetOutDataDepthOfInversionMH.Text = decimal.Round(decimal.Parse(dsmhDepthDistance.ToStringInEng3()), 1).ToString();
                        }
                        else
                        {
                            tbxWetOutDataDepthOfInversionMH.Text = "0";
                        }
                    }

                    tbxWetOutDataRollerGap.Text = "13";
                    tbxWetOutDataNotes.Text = fullLengthLiningWorkDetailsGateway.GetCommentsCipp(workId);

                    // ...Section values
                    // ... ... Length To Line = Steel Tape Length, the first section to consider is the work one in Xft Yin
                    Distance steelTapeLength = new Distance(tbxSteelTapeLength.Text);
                    tbxWetOutDataLengthToLine.Text = decimal.Round(decimal.Parse(steelTapeLength.ToStringInEng3()), 1).ToString();
                    tbxInversionDataRunLength.Text = decimal.Round(decimal.Parse(steelTapeLength.ToStringInEng3()),1).ToString();
                    double lengthToLine = double.Parse(steelTapeLength.ToStringInEng3());

                    // ... Run details
                    if (cbxlSectionId.Items.Count > 1)
                    {
                        hdfRunDetails.Value = hdfSectionId.Value;
                    }

                    // .... Install Date
                    tbxWetOutDataInstallDate.Text = "";
                    if (tkrdpInstallDataInstallDate.SelectedDate.ToString() != "")
                    {
                        DateTime? inversionDataInstalledOn = tkrdpInstallDataInstallDate.SelectedDate;
                        DateTime installedOnDateTime = (DateTime)inversionDataInstalledOn;

                        tbxWetOutDataInstallDate.Text = installedOnDateTime.Month.ToString() + "/" + installedOnDateTime.Day.ToString() + "/" + installedOnDateTime.Year.ToString();
                    }
                }

                // ... Verify if work has inversion information
                WorkFullLengthLiningInversionGateway workFullLengthLiningInversionGateway = new WorkFullLengthLiningInversionGateway();
                workFullLengthLiningInversionGateway.LoadByWorkId(workId, companyId);

                // ... Verify if work has inversion information
                if (workFullLengthLiningInversionGateway.Table.Rows.Count > 0)
                {
                    // ... Inversion data
                    lblInversionDataSubtitle.Text = fullLengthLiningWorkDetailsGateway.GetLinerTube(workId);

                    DateTime inversionDataDateOfSheet = fullLengthLiningWorkDetailsGateway.GetDateOfSheet(workId);
                    tbxInversionDataDateOfSheet.Text = inversionDataDateOfSheet.Month.ToString() + "/" + inversionDataDateOfSheet.Day.ToString() + "/" + inversionDataDateOfSheet.Year.ToString();

                    int employeeId = fullLengthLiningWorkDetailsGateway.GetEmployeeId(workId);
                    EmployeeGateway employeeGateway = new EmployeeGateway();
                    employeeGateway.LoadByEmployeeId(employeeId);
                    tbxInversionDataMadeBy.Text = employeeGateway.GetLastName(employeeId) + " " + employeeGateway.GetFirstName(employeeId);

                    tbxInversionDataInstalledOn.Text = "";
                    if (fullLengthLiningWorkDetailsGateway.GetWetOutInstallDate(workId).HasValue)
                    {
                        DateTime? inversionDataInstalledOn = fullLengthLiningWorkDetailsGateway.GetWetOutInstallDate(workId);
                        DateTime inversionDataInstalledOnDateTime = (DateTime)inversionDataInstalledOn;
                        tbxInversionDataInstalledOn.Text = inversionDataInstalledOnDateTime.Month.ToString() + "/" + inversionDataInstalledOnDateTime.Day.ToString() + "/" + inversionDataInstalledOnDateTime.Year.ToString();
                    }

                    tbxInversionDataRunDetails2.Text = fullLengthLiningWorkDetailsGateway.GetRunDetails2(workId);
                    tbxInversionDataCommentsEdit.Text = fullLengthLiningWorkDetailsGateway.GetInversionComment(workId);
                    tbxInversionDataLinerSize.Text = confirmedSizeString + " ins x" + fullLengthLiningWorkDetailsGateway.GetInversionThickness(workId);
                    tbxInversionDataRunLength.Text = decimal.Round(decimal.Parse(fullLengthLiningWorkDetailsGateway.GetLengthToLine(workId).ToString()), 1).ToString();
                    tbxInversionDataWetOutLenght.Text = fullLengthLiningWorkDetailsGateway.GetLengthToWetOut(workId).ToString();

                    ddlInversionDataInversionPipeType.SelectedValue = fullLengthLiningWorkDetailsGateway.GetPipeType(workId);
                    if (ddlInversionDataInversionPipeType.SelectedValue != "(Select)")
                    {
                        ckbxInversionDataIncludeInversionInformation.Checked = true;
                    }
                    else
                    {
                        ckbxInversionDataIncludeInversionInformation.Checked = false;
                    }

                    ddlInversionDataPipeCondition.SelectedValue = fullLengthLiningWorkDetailsGateway.GetPipeCondition(workId);
                    ddlInversionDataGroundMoisture.SelectedValue = fullLengthLiningWorkDetailsGateway.GetGroundMoisture(workId);
                    tbxInversionDataBoilerSize.Text = fullLengthLiningWorkDetailsGateway.GetBoilerSize(workId).ToString();
                    tbxInversionDataPumpsTotalCapacity.Text = fullLengthLiningWorkDetailsGateway.GetPumpTotalCapacity(workId).ToString();
                    tbxInversionDataLayflatSize.Text = fullLengthLiningWorkDetailsGateway.GetLayFlatSize(workId).ToString();
                    tbxInversionDataLayflatQuantityTotal.Text = fullLengthLiningWorkDetailsGateway.GetLayFlatQuantityTotal(workId).ToString();

                    tbxInversionDataWaterStartTempTs.Text = fullLengthLiningWorkDetailsGateway.GetWaterStartTemp(workId).ToString();
                    tbxInversionDataTempT1.Text = fullLengthLiningWorkDetailsGateway.GetTemp1(workId).ToString();
                    tbxInversionDataHoldAtT1For.Text = fullLengthLiningWorkDetailsGateway.GetHoldAtT1(workId).ToString();
                    tbxInversionDataTempT2.Text = fullLengthLiningWorkDetailsGateway.GetTempT2(workId).ToString();
                    tbxInversionDataCookAtT2For.Text = fullLengthLiningWorkDetailsGateway.GetCookAtT2(workId).ToString();
                    tbxInversionDataCoolDownFor.Text = fullLengthLiningWorkDetailsGateway.GetCoolDownFor(workId).ToString();

                    tbxInversionDataCoolToTemp.Text = fullLengthLiningWorkDetailsGateway.GetCoolToTemp(workId).ToString();
                    tbxInversionDataDropInPipeRun.Text = fullLengthLiningWorkDetailsGateway.GetDropInPipeRun(workId).ToString();
                    tbxInversionDataPipeSlopeOf.Text = fullLengthLiningWorkDetailsGateway.GetPipeSlopOf(workId).ToString();

                    lblInversionData45F120F.Text = tbxInversionDataWaterStartTempTs.Text + "°F-" + tbxInversionDataTempT1.Text + "°F (hr)";
                    tbxInversionData45F120F.Text = fullLengthLiningWorkDetailsGateway.GetF45F120(workId).ToString();
                    tbxInversionDataHold.Text = fullLengthLiningWorkDetailsGateway.GetHold(workId).ToString();
                    lblInversionData120F185F.Text = tbxInversionDataTempT1.Text + "°F-" + tbxInversionDataTempT2.Text + "°F (hr)";
                    tbxInversionData120F185F.Text = fullLengthLiningWorkDetailsGateway.GetF120F185(workId).ToString();
                    tbxInversionDataCookTime.Text = fullLengthLiningWorkDetailsGateway.GetCookTime(workId).ToString();
                    tbxInversionDataCoolTime.Text = fullLengthLiningWorkDetailsGateway.GetCoolTime(workId).ToString();
                    tbxInversionDataAproxTotal.Text = fullLengthLiningWorkDetailsGateway.GetAproxTotal(workId).ToString();

                    tbxInversionDataWaterChangesPerHour.Text = fullLengthLiningWorkDetailsGateway.GetWaterChangesPerHour(workId).ToString();
                    tbxInversionDataReturnWaterVelocity.Text = fullLengthLiningWorkDetailsGateway.GetReturnWaterVelocity(workId).ToString();
                    tbxInversionDataLayflatBackPressure.Text = fullLengthLiningWorkDetailsGateway.GetLayflatBackPressure(workId).ToString();
                    tbxInversionDataPumpLiftAtIdealHead.Text = fullLengthLiningWorkDetailsGateway.GetPumpLiftAtIdealHead(workId).ToString();
                    tbxInversionDataWaterToFillLinerColumn.Text = fullLengthLiningWorkDetailsGateway.GetWaterToFillLinerColumn(workId).ToString();
                    tbxInversionDataWaterPerFit.Text = fullLengthLiningWorkDetailsGateway.GetWaterPerFit(workId).ToString();

                    tbxInversionDataNotesAndInstallationResults.Text = fullLengthLiningWorkDetailsGateway.GetInstallationResults(workId);

                    lblInversionDataLinerInfoGrey.Text = fullLengthLiningWorkDetailsGateway.GetInversionLinerTubeLabel(workId);
                    lblInversionDataHeadsGrey.Text = fullLengthLiningWorkDetailsGateway.GetHeadsIdealLabel(workId);
                    lblInversionDataPumpingCirculationSubtitle.Text = fullLengthLiningWorkDetailsGateway.GetPumpingAndCirculationLabel(workId);

                    // ... ... graphic labels
                    lblInversionDataMaxColdForTubeLabel.Text = tbxWetOutDataTubeMaxColdHead.Text + " ft = Max Cold for tube";
                    lblInversionDataMaxHotForTubeLabel.Text = tbxWetOutDataTubeMaxHotHead.Text + " ft = Max Hot for tube";
                    lblInversionDataIdelForTubeLabel.Text = tbxWetOutDataTubeIdealHead.Text + " ft = Ideal for tube";

                    double maxColdForTubeEnd = double.Parse(tbxWetOutDataTubeMaxColdHead.Text) + double.Parse(tbxInversionDataDropInPipeRun.Text);
                    lblInversionDataMaxColdForTubeEndLabel.Text = decimal.Round(decimal.Parse(maxColdForTubeEnd.ToString()), 1).ToString() + " ft";

                    double maxHotForTubeEnd = double.Parse(tbxWetOutDataTubeMaxHotHead.Text) + double.Parse(tbxInversionDataDropInPipeRun.Text);
                    lblInversionDataMaxHotForTubeEndLabel.Text = decimal.Round(decimal.Parse(maxHotForTubeEnd.ToString()), 1).ToString() + " ft";

                    double idealForTubeEnd = double.Parse(tbxWetOutDataTubeIdealHead.Text) + double.Parse(tbxInversionDataDropInPipeRun.Text);
                    lblInversionDataIdelForTubeEndLabel.Text = decimal.Round(decimal.Parse(idealForTubeEnd.ToString()), 1).ToString() + " ft";

                    lblInversionDataPumpHeightLabel.Text = "   " + tbxWetOutDataPumpHeightAboveGround.Text + " ft";
                    lblInversionDataLinerSizeLabel.Text = confirmedSize.ToString() + " ins x" + fullLengthLiningWorkDetailsGateway.GetInversionThickness(workId) + " Liner";

                    lblInversionDataRunLengthLabel.Text = "Run Length: " + tbxInversionDataRunLength.Text + " ft; Fall: " + tbxInversionDataDropInPipeRun.Text + " ft";
                    lblInversionDataDepthOfInversionMHLabel.Text = "   " + tbxWetOutDataDepthOfInversionMH.Text + " ft";
                    lblInversionDataEndLabel.Text = "End";
                }
                else
                {
                    //  Wet Out Data
                    // ... Show current day for new sheets
                    DateTime sheetDate = DateTime.Now;
                    tbxInversionDataDateOfSheet.Text = sheetDate.Month.ToString() + "/" + sheetDate.Day.ToString() + "/" + sheetDate.Year.ToString();

                    // Set default values.
                    lblInversionData45F120F.Text = "";
                    lblInversionData120F185F.Text = "";
                    tbxInversionDataBoilerSize.Text = "7000000";
                    tbxInversionDataPumpsTotalCapacity.Text = "300";
                    tbxInversionDataLayflatSize.Text = "4";
                    tbxInversionDataLayflatQuantityTotal.Text = "1";

                    tbxInversionDataWaterStartTempTs.Text = "45";
                    tbxInversionDataTempT1.Text = "120";
                    tbxInversionDataHoldAtT1For.Text = "0.5";
                    tbxInversionDataTempT2.Text = "185";
                    tbxInversionDataCookAtT2For.Text = "2";
                    tbxInversionDataCoolDownFor.Text = "1";
                    tbxInversionDataCoolToTemp.Text = "85";

                    // ...Section values
                    // ... ... Length To Line = Steel Tape Length, the first section to consider is the work one in Xft Yin
                    Distance steelTapeLength = new Distance(tbxSteelTapeLength.Text);
                    tbxInversionDataRunLength.Text = decimal.Round(decimal.Parse(steelTapeLength.ToStringInEng3()), 1).ToString();
                    double lengthToLine = double.Parse(steelTapeLength.ToStringInEng3());

                    // ... Run details
                    if (cbxlSectionId.Items.Count > 1)
                    {
                        hdfRunDetails.Value = hdfSectionId.Value;
                    }

                    // .... Install Date
                    tbxInversionDataInstalledOn.Text = "";
                    if (tkrdpInstallDataInstallDate.SelectedDate.ToString() != "")
                    {
                        DateTime? inversionDataInstalledOn = tkrdpInstallDataInstallDate.SelectedDate;
                        DateTime installedOnDateTime = (DateTime)inversionDataInstalledOn;

                        tbxInversionDataInstalledOn.Text = installedOnDateTime.Month.ToString() + "/" + installedOnDateTime.Day.ToString() + "/" + installedOnDateTime.Year.ToString();
                    }
                 }

                // ... Show FLL Comments + RA Comments
                int flWorkId = workId;

                // ... ... Get raWorkId
                int raWorkId = 0;
                int projectId = Int32.Parse(hdfCurrentProjectId.Value);
                WorkGateway workGateway = new WorkGateway();
                workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Rehab Assessment", companyId);
                if (workGateway.Table.Rows.Count > 0)
                {
                    raWorkId = workGateway.GetWorkId(assetId, "Rehab Assessment", projectId);
                }

                // ... ... Get comments
                FullLengthLiningAllComments fullLengthLiningAllComments = new FullLengthLiningAllComments(fullLengthLiningTDS);
                fullLengthLiningAllComments.LoadAllByFlWorkIdRaWorkId(flWorkId, raWorkId, companyId);

                // ... ... Store datasets
                Session["fullLengthLiningTDS"] = fullLengthLiningTDS;

                // ... ... Show comments
                tbxCommentsDataComments.Text = fullLengthLiningAllComments.GetFLOrRAComments(companyId, fullLengthLiningAllComments.Table.Rows.Count, "\n");
            }
        }
        /// <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>
        /// Verify if section is in use
        /// </summary>
        /// <param name="assetId">assetId</param>
        /// <param name="companyId">companyId</param>
        /// <returns></returns>
        public bool InUse(int assetId, int companyId)
        {
            // Verify work
            WorkGateway workGateway = new WorkGateway(null);
            if (workGateway.InUseAssetId(assetId, companyId))
            {
                return true;
            }

            return false;
        }
        /// <summary>
        /// Save a Previous PR work
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="section_assetId">section_assetId</param>
        /// <param name="companyId">companyId</param>
        private void SavePreviousPRWork(int projectId, int section_assetId, int companyId)
        {
            // Load Previous work - Point Repairs data (last sections work)
            string workType = "Point Repairs";
            WorkPointRepairsGateway workPointRepairsGateway = new WorkPointRepairsGateway();
            workPointRepairsGateway.LoadTop1ByProjectIdAssetIdWorkType(projectId, section_assetId, workType, companyId);

            int workId = workPointRepairsGateway.GetWorkIdTop1();
            string clientId = ""; if (workPointRepairsGateway.GetClientId(workId) != "") clientId = workPointRepairsGateway.GetClientId(workId);
            string measurementTakenBy = ""; if (workPointRepairsGateway.GetMeasurementTakenBy(workId) != "") measurementTakenBy = workPointRepairsGateway.GetMeasurementTakenBy(workId);
            DateTime? repairConfirmationDate = null; if (workPointRepairsGateway.GetRepairConfirmationDate(workId).HasValue) repairConfirmationDate = workPointRepairsGateway.GetRepairConfirmationDate(workId);
            bool bypassRequired = workPointRepairsGateway.GetBypassRequired(workId);
            string roboticDistances = ""; if (workPointRepairsGateway.GetRoboticDistances(workId) != "") roboticDistances = workPointRepairsGateway.GetRoboticDistances(workId);
            DateTime? proposedLiningDate = null; if (workPointRepairsGateway.GetProposedLiningDate(workId).HasValue) proposedLiningDate = workPointRepairsGateway.GetProposedLiningDate(workId);
            DateTime? deadlineLiningDate = null; if (workPointRepairsGateway.GetDeadlineLiningDate(workId).HasValue) deadlineLiningDate = workPointRepairsGateway.GetDeadlineLiningDate(workId);
            DateTime? finalVideoDate = null; if (workPointRepairsGateway.GetFinalVideoDate(workId).HasValue) finalVideoDate = workPointRepairsGateway.GetFinalVideoDate(workId);
            int? estimatedJoints = null; if (workPointRepairsGateway.GetEstimatedJoints(workId).HasValue) estimatedJoints = workPointRepairsGateway.GetEstimatedJoints(workId);
            int? jointsTestSealed = null; if (workPointRepairsGateway.GetJointsTestSealed(workId).HasValue) jointsTestSealed = workPointRepairsGateway.GetJointsTestSealed(workId);
            bool issueIdentified = workPointRepairsGateway.GetIssueIdentified(workId);
            bool issueLfs = workPointRepairsGateway.GetIssueLFS(workId);
            bool issueClient = workPointRepairsGateway.GetIssueClient(workId);
            bool issueSales = workPointRepairsGateway.GetIssueSales(workId);
            bool issueGivenToClient = workPointRepairsGateway.GetIssueGivenToClient(workId);
            bool issueResolved = workPointRepairsGateway.GetIssueResolved(workId);
            bool issueInvestigation = workPointRepairsGateway.GetIssueInvestigation(workId);
            string repairId = ""; if (workPointRepairsGateway.GetRepairID(workId) != "") repairId = workPointRepairsGateway.GetRepairID(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
            WorkPointRepairs workPointRepairs = new WorkPointRepairs(null);
            int newSectionWorkId = workPointRepairs.InsertDirect(projectId, section_assetId, libraryCategoriesId, clientId, measurementTakenBy, repairConfirmationDate, bypassRequired, roboticDistances, proposedLiningDate, deadlineLiningDate, finalVideoDate, estimatedJoints, jointsTestSealed, issueIdentified, issueLfs, issueClient, issueSales, issueGivenToClient, issueResolved, issueInvestigation, repairId, false, companyId, comments, history);

            // Load Previous work  -  Save pr repair
            WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway();
            workPointRepairsRepairGateway.LoadByWorkId(workId, companyId);

            foreach (WorkTDS.LFS_WORK_POINT_REPAIRS_REPAIRRow row in (WorkTDS.LFS_WORK_POINT_REPAIRS_REPAIRDataTable)workPointRepairsRepairGateway.Table)
            {
                string repairPointId = row.RepairPointID;
                string type = ""; if (!row.IsTypeNull()) type = row.Type;
                string reamDistance = ""; if (!row.IsReamDistanceNull()) reamDistance = row.ReamDistance;
                DateTime? reamDate = null; if (!row.IsReamDateNull()) reamDate = row.ReamDate;
                string linerDistance = ""; if (!row.IsLinerDistanceNull()) linerDistance = row.LinerDistance;
                string direction = ""; if (!row.IsDirectionNull()) direction = row.Direction;
                int? reinstates = null; if (!row.IsReinstatesNull()) reinstates = row.Reinstates;
                string ltmh = ""; if (!row.IsLTMHNull()) ltmh = row.LTMH;
                string vtmh = ""; if (!row.IsVTMHNull()) vtmh = row.VTMH;
                string distance = ""; if (!row.IsDistanceNull()) distance = row.Distance;
                string size_ = ""; if (!row.IsSize_Null()) size_ = row.Size_;
                DateTime? installDate = null; if (!row.IsInstallDateNull()) installDate = row.InstallDate;
                string mhShot = ""; if (!row.IsMHShotNull()) mhShot = row.MHShot;
                string groutDistance = ""; if (!row.IsGroutDistanceNull()) groutDistance = row.GroutDistance;
                DateTime? groutDate = null; if (!row.IsGroutDateNull()) groutDate = row.GroutDate;
                string approval = ""; if (!row.IsApprovalNull()) approval = row.Approval;
                bool extraRepair = row.ExtraRepair;
                bool cancelled = row.Cancelled;
                string commentsRepair = ""; if (!row.IsCommentsNull()) commentsRepair = row.Comments;
                string defectQualifier = ""; if (!row.IsDefectQualifierNull()) defectQualifier = row.DefectQualifier;
                string defecDetails = ""; if (!row.IsDefectDetailsNull()) defecDetails = row.DefectDetails;
                string length = ""; if (!row.IsLengthNull()) length = row.Length;
                DateTime? reinstateDate = null; if (!row.IsReinstateDateNull()) reinstateDate = row.ReinstateDate;

                WorkPointRepairsRepair workPointRepairsRepair = new WorkPointRepairsRepair();
                workPointRepairsRepair.InsertDirect(newSectionWorkId, repairPointId, type, reamDistance, reamDate, linerDistance, direction, reinstates, ltmh, vtmh, distance, size_, installDate, mhShot, groutDistance, groutDate, approval, extraRepair, cancelled, commentsRepair, false, companyId, defectQualifier, defectQualifier, length, reinstateDate);
            }

            // Load Previous work  - Comments and History
            SavePreviousComments(workId, workType, companyId, newSectionWorkId);
            SavePreviousHistory(workId, workType, companyId, newSectionWorkId);
        }
        /// <summary>
        /// UpdateCommentsWetOutForSummaryEdit
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="companyId">companyId</param>
        public void UpdateCommentsWetOutForSummaryEdit(int workId, int companyId)
        {
            WorkFullLengthLiningWetOutCommentsGateway workFullLengthLiningWetOutCommentsGateway = new WorkFullLengthLiningWetOutCommentsGateway();
            WorkFullLengthLiningWetOutComments workFullLengthLiningWetOutComments = new WorkFullLengthLiningWetOutComments(workFullLengthLiningWetOutCommentsGateway.Data);
            WorkGateway workGateway = new WorkGateway();

            FullLengthLiningTDS.WorkDetailsRow row = GetRow(workId);

            workGateway.LoadByWorkId(workId, companyId);
            workFullLengthLiningWetOutCommentsGateway.LoadAllByWorkIdWorkType(workId, companyId, "Full Length Lining Wet Out");
            row.CommentsCipp = workFullLengthLiningWetOutComments.GetAllComments(workId, companyId, workFullLengthLiningWetOutCommentsGateway.Table.Rows.Count, "\n");
        }
        /// <summary>
        /// Save a Previous RA work
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="section_assetId">section_assetId</param>
        /// <param name="companyId">companyId</param>
        private void SavePreviousRAWork(int projectId, int section_assetId, int companyId)
        {
            // Load Previous work  - Rehab assessment data (last sections work)
            string workType = "Rehab Assessment";
            WorkRehabAssessmentGateway workRehabAssessmentGateway = new WorkRehabAssessmentGateway();
            workRehabAssessmentGateway.LoadTop1ByProjectIdAssetIdWorkType(projectId, section_assetId, workType, companyId);

            int workId = workRehabAssessmentGateway.GetWorkIdTop1();
            DateTime? preFlushDate = null; if (workRehabAssessmentGateway.GetPreFlushDateTop1().HasValue) preFlushDate = workRehabAssessmentGateway.GetPreFlushDateTop1();
            DateTime? preVideoDate = null; if (workRehabAssessmentGateway.GetPreVideoDateTop1().HasValue) preVideoDate = workRehabAssessmentGateway.GetPreVideoDateTop1();

            // 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
            WorkRehabAssessment workRehabAssessment = new WorkRehabAssessment(null);
            int newSectionWorkId = workRehabAssessment.InsertDirect(projectId, section_assetId, libraryCategoriesId, preFlushDate, preVideoDate, false, companyId, comments, history);

            // Load Previous work  - Comments and History
            SavePreviousComments(workId, workType, companyId, newSectionWorkId);
            SavePreviousHistory(workId, workType, companyId, newSectionWorkId);
        }
        // ////////////////////////////////////////////////////////////////////////
        // STEP5 - NEW INTERMEDIATE SECTIONS - AUXILIARY EVENTS
        //
        protected void cvSectionId_ServerValidate(object source, ServerValidateEventArgs args)
        {
            ProjectAddSectionsTDS dataSet = new ProjectAddSectionsTDS();
            dataSet.ProjectAddSectionsNew.Merge(projectAddSectionsNew, true);
            dataSet.ProjectAddSectionsTemp.Merge(projectAddSectionsTemp, true);

            ProjectAddSectionsNew projectAddSectionsNewModel = new ProjectAddSectionsNew(dataSet);
            ProjectAddSectionsTemp projectAddSectionsTempModel = new ProjectAddSectionsTemp(dataSet);

            // Initialize
            CustomValidator cvSectionId = (CustomValidator)source;
            args.IsValid = true;

            // verify in this step
            if (projectAddSectionsNewModel.ExistsBySectionId(args.Value))
            {
                cvSectionId.Text = "Duplicated section. (you already have this section here)";
                args.IsValid = false;
            }

            // verify before added or selected
            if (args.IsValid)
            {
                if (projectAddSectionsTempModel.ExistsBySectionId(args.Value))
                {
                    cvSectionId.Text = "Duplicated section. (this section was already created or added previously)";
                    args.IsValid = false;
                }
            }

            // verify in project with specific work
            if (args.IsValid)
            {
                string workType;
                switch (hdfWorkType.Value)
                {
                    case "All":
                        workType = "%";
                        break;

                    case "Rehab Assessment":
                        workType = "Rehab Assessment";
                        break;

                    case "Full Length Lining":
                        workType = "Full Length Lining";
                        break;

                    case "Point Repairs":
                        workType = "Point Repairs";
                        break;

                    case "Junction Lining":
                        workType = "Junction Lining Section";
                        break;

                    case "Manhole Rehabilitation":
                        workType = "%";
                        break;

                    default:
                        throw new Exception("Erroneus work type in Add Section query string.");
                }

                WorkGateway workGateway = new WorkGateway(null);
                if (workGateway.ExistsSectionByProjectIdSectionIdWorkType(int.Parse(hdfProjectId.Value), args.Value, workType, int.Parse(hdfCompanyId.Value)))
                {
                    cvSectionId.Text = "This section is already associated with this project. (if you would like to see it go to the Sections data of this project)";
                    args.IsValid = false;
                }
            }

            // verify in project general
            if (args.IsValid)
            {
                Int64? countryId = int.Parse(hdfCountryId.Value);
                Int64? provinceId = null; if (hdfProvinceId.Value != "") provinceId = Int64.Parse(hdfProvinceId.Value);
                Int64? countyId = null; if (hdfCountyId.Value != "") countyId = Int64.Parse(hdfCountyId.Value);
                Int64? cityId = null; if (hdfCityId.Value != "") cityId = Int64.Parse(hdfCityId.Value);
                int companyId = int.Parse(hdfCompanyId.Value);

                AssetSewerSectionGateway assetSewerSectionGateway = new AssetSewerSectionGateway(null);
                if (assetSewerSectionGateway.ExistsByCountryIdProvinceIdCountyIdCityIdSectionId(countryId, provinceId, countyId, cityId, args.Value, companyId))
                {
                    cvSectionId.Text = "This section is already in the database. (you can try adding it using the Add Existing Sections option)";
                    args.IsValid = false;
                }
            }
        }
        /// <summary>
        /// UpdateCommentsForSummaryEdit
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="companyId">companyId</param>
        public void UpdateCommentsForSummaryEdit(int workId, int companyId)
        {
            WorkCommentsGateway workComentsGateway = new WorkCommentsGateway();
            WorkComments workComments = new WorkComments(workComentsGateway.Data);
            WorkGateway workGateway = new WorkGateway();

            ManholeRehabilitationTDS.WorkDetailsRow row = GetRow(workId);

            workGateway.LoadByWorkId(workId, companyId);
            workComentsGateway.LoadByWorkIdWorkType(workId, companyId, "Manhole Rehabilitation");
            row.Comments = workComments.GetAllComments(workId, companyId, workComentsGateway.Table.Rows.Count, "\n");
        }
Ejemplo n.º 29
0
        private void workUpdate()
        {
            // Get general variables
            int workId = Int32.Parse(hdfWorkId.Value.Trim());
            int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim());
            int assetId = Int32.Parse(hdfAssetId.Value.Trim());
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value.Trim();

            // Update comments for rehab assessment
            // Get original variables
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByWorkId(workId, companyId);

            string originalWorkType = workGateway.GetWorkTypeOriginal(workId);
            int? originalLibraryCategoriesId = workGateway.GetLibraryCategoriesIdOriginal(workId);
            string originalComment = workGateway.GetCommentsOriginal(workId);
            string originalHistory = workGateway.GetHistoryOriginal(workId);

            //Get all new rehab assessment comments
            RehabAssessmentCommentDetailsGateway rehabAssessmentCommentDetailsGateway = new RehabAssessmentCommentDetailsGateway(rehabAssessmentTDS);
            rehabAssessmentCommentDetailsGateway.LoadAllByWorkIdWorkType(workId, companyId, workType);
            RehabAssessmentCommentDetails rehabAssessmentCommentDetails = new RehabAssessmentCommentDetails(rehabAssessmentCommentDetailsGateway.Data);
            string newComment = rehabAssessmentCommentDetails.GetAllRehabAssessmentComments(workId, companyId, rehabAssessmentCommentDetailsGateway.Table.Rows.Count, "\n");

            Work work = new Work(null);
            work.UpdateDirect(workId, projectId, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, originalComment, originalHistory, workId, projectId, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, newComment, originalHistory);

            // Update comments for full length lining
            int workIdFll = Int32.Parse(hdfWorkIdFll.Value.Trim());

            if (workIdFll != 0)
            {
                WorkGateway workGatewayForFll = new WorkGateway();
                workGatewayForFll.LoadByWorkId(workIdFll, companyId);

                string originalWorkTypeForFll = workGatewayForFll.GetWorkTypeOriginal(workIdFll);
                int? originalLibraryCategoriesIdForFll = workGatewayForFll.GetLibraryCategoriesIdOriginal(workIdFll);
                string originalCommentForFll = workGatewayForFll.GetCommentsOriginal(workIdFll);
                string originalHistoryForFll = workGatewayForFll.GetHistoryOriginal(workIdFll);

                //Get all new fulllengthlining comments
                FullLengthLiningCommentDetailsGateway fullLengthLiningCommentDetailsGateway = new FullLengthLiningCommentDetailsGateway();
                fullLengthLiningCommentDetailsGateway.LoadAllByWorkIdWorkType(workIdFll, companyId, "Full Length Lining");
                FullLengthLiningCommentDetails fullLengthLiningCommentDetails = new FullLengthLiningCommentDetails(fullLengthLiningCommentDetailsGateway.Data);
                string newCommentForFll = fullLengthLiningCommentDetails.GetAllFullLengthLiningComments(workIdFll, companyId, fullLengthLiningCommentDetailsGateway.Table.Rows.Count, "\n");

                // Save comments
                Work workForFll = new Work(null);
                workForFll.UpdateDirect(workIdFll, projectId, assetId, originalWorkTypeForFll, originalLibraryCategoriesIdForFll, false, companyId, originalCommentForFll, originalHistoryForFll, workIdFll, projectId, assetId, originalWorkTypeForFll, originalLibraryCategoriesIdForFll, false, companyId, newCommentForFll, originalHistoryForFll);
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // PRIVATE METHODS
        //
        /// <summary>
        /// UpdateWork
        /// </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="assetId">assetId</param>
        /// <param name="originalPreppedDate">originalPreppedDate</param>
        /// <param name="originalSprayedDate">originalSprayedDate</param>
        /// <param name="originalBatchId">originalBatchId</param>        
        /// <param name="originalComments">originalComments</param>
        /// <param name="originalDeleted">originalDeleted</param>
        /// <param name="originalCompanyId">originalCompanyId</param>
        /// 
        /// <param name="newPreppedDate">newPreppedDate</param>
        /// <param name="newSprayedDate">newSprayedDate</param>
        /// <param name="newBatchId">newBatchId</param>        
        /// <param name="newComments">newComments</param>
        /// <param name="newDeleted">newDeleted</param>
        private void UpdateWork(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int assetId, DateTime? originalPreppedDate, DateTime? originalSprayedDate, int originalBatchId, string originalComments, bool originalDeleted, int originalCompanyId, DateTime? newPreppedDate, DateTime? newSprayedDate, int newBatchId, string newComments, bool newDeleted)
        {
            int newWorkId = 0;

            // Loading workId
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByProjectIdAssetIdWorkType(projectId, assetId, "Manhole Rehabilitation", originalCompanyId);

            if (workGateway.Table.Rows.Count > 0)
            {
                newWorkId = workGateway.GetWorkId(assetId, "Manhole Rehabilitation", projectId);

                int? libraryCategoriesId = workGateway.GetLibraryCategoriesId(newWorkId);
                string history = workGateway.GetHistory(newWorkId);

                // Updating work
                Work work = new Work();
                work.UpdateDirect(newWorkId, projectId, assetId, "Manhole Rehabilitation", libraryCategoriesId, originalDeleted, originalCompanyId, originalComments, history, newWorkId, projectId, assetId, "Manhole Rehabilitation", libraryCategoriesId, originalDeleted, originalCompanyId, newComments, history);

                // Update manhole rehabilitation work
                WorkManholeRehabilitation workManholeRehabilitation = new WorkManholeRehabilitation();
                workManholeRehabilitation.UpdateDirect(newWorkId, originalPreppedDate, originalSprayedDate, originalBatchId, originalDeleted, originalCompanyId, newWorkId, newPreppedDate, newSprayedDate, newBatchId, newDeleted, originalCompanyId);
            }
        }