/// <summary> /// DeleteDirect /// </summary> /// <param name="workId">workId</param> /// <param name="assetId">assetId</param> /// <param name="companyId">companyId</param> public void DeleteDirect(int workId, int assetId, int companyId) { // Delete work WorkPointRepairs workPointRepairs = new WorkPointRepairs(null); workPointRepairs.DeleteDirect(workId, companyId); // Delete section LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(null); lfsAssetSewerSection.DeleteDirect(assetId, companyId); }
/// <summary> /// Save a PR work /// </summary> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="companyId">companyId</param> /// <param name="rehabAssessmentPrevWork">rehabAssessmentPrevWork</param> /// <param name="fullLengthLiningPrevWork">fullLengthLiningPrevWork</param> /// <param name="pointRepairsPrevWork">pointRepairsPrevWork</param> /// <param name="junctionLiningPrevWork">junctionLiningPrevWork</param> /// <param name="rehabAssessmentNewWork">rehabAssessmentNewWork</param> /// <param name="fullLengthLiningNewWork">fullLengthLiningNewWork</param> /// <param name="junctionLiningNewWork">junctionLiningNewWork</param> /// <param name="pointRepairsNewWork">pointRepairsNewWork</param> /// <param name="clientId">clientId</param> private void SavePRWork(int projectId, int section_assetId, int companyId, bool rehabAssessmentPrevWork, bool fullLengthLiningPrevWork, bool pointRepairsPrevWork, bool junctionLiningPrevWork, bool rehabAssessmentNewWork, bool fullLengthLiningNewWork, bool pointRepairsNewWork, bool junctionLiningNewWork, string clientId) { // If there is no previous work if (!pointRepairsPrevWork) { WorkPointRepairs workPointRepairs = new WorkPointRepairs(null); workPointRepairs.InsertDirect(projectId, section_assetId, null, clientId, "", null, false, "", null, null, null, null, null, false, false, false, false, false, false, false, "", false, companyId, "", ""); } else { // Copy selected works if (rehabAssessmentPrevWork && !rehabAssessmentNewWork) SavePreviousRAWork(projectId, section_assetId, companyId); if (fullLengthLiningPrevWork && !fullLengthLiningNewWork) SavePreviousFLWork(projectId, section_assetId, companyId); SavePreviousPRWork(projectId, section_assetId, companyId); if (junctionLiningPrevWork && !junctionLiningNewWork) SavePreviousJLWork(projectId, section_assetId, companyId); } }
/// <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> /// UpdateDirect /// </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> public void Save(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int sectionAssetId, int companyId) { PointRepairsTDS pointRepairsChanges = (PointRepairsTDS)Data.GetChanges(); if (pointRepairsChanges.WorkDetails.Rows.Count > 0) { PointRepairsWorkDetailsGateway pointRepairsWorkDetailsGateway = new PointRepairsWorkDetailsGateway(pointRepairsChanges); // Update sections foreach (PointRepairsTDS.WorkDetailsRow workDetailsRow in (PointRepairsTDS.WorkDetailsDataTable)pointRepairsChanges.WorkDetails) { // Unchanged values int workId = workDetailsRow.WorkID; // Original values string originalClientId = pointRepairsWorkDetailsGateway.GetClientIdOriginal(workId); string originalMeasurementTakenBy = pointRepairsWorkDetailsGateway.GetMeasurementTakenByOriginal(workId); DateTime? originalRepairConfirmationDate = pointRepairsWorkDetailsGateway.GetRepairConfirmationDateOriginal(workId); bool originalBypassRequired = pointRepairsWorkDetailsGateway.GetBypassRequiredOriginal(workId); string originalRoboticDistances = pointRepairsWorkDetailsGateway.GetRoboticDistancesOriginal(workId); DateTime? originalProposedLiningDate = pointRepairsWorkDetailsGateway.GetProposedLiningDateOriginal(workId); DateTime? originalDeadlineLiningDate = pointRepairsWorkDetailsGateway.GetDeadlineLiningDateOriginal(workId); DateTime? originalFinalVideoDate = pointRepairsWorkDetailsGateway.GetFinalVideoDateOriginal(workId); int? originalEstimatedJoints = pointRepairsWorkDetailsGateway.GetEstimatedJointsOriginal(workId); int? originalJointsTestSealed = pointRepairsWorkDetailsGateway.GetJointsTestSealedOriginal(workId); bool originalIssueIdentified = pointRepairsWorkDetailsGateway.GetIssueIdentifiedOriginal(workId); bool originalIssueLFS = pointRepairsWorkDetailsGateway.GetIssueLFSOriginal(workId); bool originalIssueClient = pointRepairsWorkDetailsGateway.GetIssueClientOriginal(workId); bool originalIssueSales = pointRepairsWorkDetailsGateway.GetIssueSalesOriginal(workId); bool originalIssueGivenToClient = pointRepairsWorkDetailsGateway.GetIssueGivenToClientOriginal(workId); bool originalIssueResolved = pointRepairsWorkDetailsGateway.GetIssueResolvedOriginal(workId); bool originalIssueInvestigation = pointRepairsWorkDetailsGateway.GetIssueInvestigationOriginal(workId); // New variables string newClientId = pointRepairsWorkDetailsGateway.GetClientId(workId); string newMeasurementTakenBy = pointRepairsWorkDetailsGateway.GetMeasurementTakenBy(workId); DateTime? newRepairConfirmationDate = pointRepairsWorkDetailsGateway.GetRepairConfirmationDate(workId); bool newBypassRequired = pointRepairsWorkDetailsGateway.GetBypassRequired(workId); string newRoboticDistances = pointRepairsWorkDetailsGateway.GetRoboticDistances(workId); DateTime? newProposedLiningDate = pointRepairsWorkDetailsGateway.GetProposedLiningDate(workId); DateTime? newDeadlineLiningDate = pointRepairsWorkDetailsGateway.GetDeadlineLiningDate(workId); DateTime? newFinalVideoDate = pointRepairsWorkDetailsGateway.GetFinalVideoDate(workId); int? newEstimatedJoints = pointRepairsWorkDetailsGateway.GetEstimatedJoints(workId); int? newJointsTestSealed = pointRepairsWorkDetailsGateway.GetJointsTestSealed(workId); bool newIssueIdentified = pointRepairsWorkDetailsGateway.GetIssueIdentified(workId); bool newIssueLFS = pointRepairsWorkDetailsGateway.GetIssueLFS(workId); bool newIssueClient = pointRepairsWorkDetailsGateway.GetIssueClient(workId); bool newIssueSales = pointRepairsWorkDetailsGateway.GetIssueSales(workId); bool newIssueGivenToClient = pointRepairsWorkDetailsGateway.GetIssueGivenToClient(workId); bool newIssueResolved = pointRepairsWorkDetailsGateway.GetIssueResolved(workId); bool newIssueInvestigation = pointRepairsWorkDetailsGateway.GetIssueInvestigation(workId); // ... RA DateTime? originalPreFlushDate = pointRepairsWorkDetailsGateway.GetPreFlushDateOriginal(workId); DateTime? originalPreVideoDate = pointRepairsWorkDetailsGateway.GetPreVideoDateOriginal(workId); // ... FLL P1 DateTime? originalP1Date = pointRepairsWorkDetailsGateway.GetP1DateOriginal(workId); int? originalCxisRemoved = pointRepairsWorkDetailsGateway.GetCxisRemovedOriginal(workId); // ... FLL M1 string originalTrafficControl = pointRepairsWorkDetailsGateway.GetTrafficControlOriginal(workId); string originalMaterial = pointRepairsWorkDetailsGateway.GetMaterialOriginal(workId); // ... FLL M2 string originalVideoLength = pointRepairsWorkDetailsGateway.GetVideoLengthOriginal(workId); // ... P1 DateTime? newP1Date = pointRepairsWorkDetailsGateway.GetP1Date(workId); int? newCxisRemoved = pointRepairsWorkDetailsGateway.GetCxisRemoved(workId); string newTrafficControl = pointRepairsWorkDetailsGateway.GetTrafficControl(workId); string newMaterial = pointRepairsWorkDetailsGateway.GetMaterial(workId); // ... M2 string newVideoLength = pointRepairsWorkDetailsGateway.GetVideoLength(workId); // ... RA DateTime? newPreFlushDate = pointRepairsWorkDetailsGateway.GetPreFlushDate(workId); DateTime? newPreVideoDate = pointRepairsWorkDetailsGateway.GetPreVideoDate(workId); // ... FLL WorkID int workIdFll = 0; if (!workDetailsRow.IsWorkIDFLLNull()) workIdFll = workDetailsRow.WorkIDFLL; int workIdRa = 0; if (!workDetailsRow.IsWorkIDRANull()) workIdRa = workDetailsRow.WorkIDRA; if (workIdFll != 0) // ... Has Fll work { FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway(); fullLengthLiningWorkDetailsGateway.LoadByWorkIdAssetId(workIdFll, sectionAssetId, companyId); // Original values string originalClientIdFLL = fullLengthLiningWorkDetailsGateway.GetClientIdOriginal(workIdFll); DateTime? originalProposedLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetProposedLiningDateOriginal(workIdFll); DateTime? originalDeadlineLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDateOriginal(workIdFll); DateTime? originalM1Date = fullLengthLiningWorkDetailsGateway.GetM1DateOriginal(workIdFll); DateTime? originalM2Date = fullLengthLiningWorkDetailsGateway.GetM2DateOriginal(workIdFll); DateTime? originalInstallDate = fullLengthLiningWorkDetailsGateway.GetInstallDateOriginal(workIdFll); DateTime? originalFinalVideoDateFLL = fullLengthLiningWorkDetailsGateway.GetFinalVideoDateOriginal(workIdFll); bool originalIssueIdentifiedFLL = fullLengthLiningWorkDetailsGateway.GetIssueIdentifiedOriginal(workIdFll); bool originalIssueLFSFLL = fullLengthLiningWorkDetailsGateway.GetIssueLFSOriginal(workIdFll); bool originalIssueClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueClientOriginal(workIdFll); bool originalIssueSalesFLL = fullLengthLiningWorkDetailsGateway.GetIssueSalesOriginal(workIdFll); bool originalIssueGivenToClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueGivenToClientOriginal(workIdFll); bool originalIssueResolvedFLL = fullLengthLiningWorkDetailsGateway.GetIssueResolvedOriginal(workIdFll); bool originalIssueInvestigationFLL = fullLengthLiningWorkDetailsGateway.GetIssueInvestigationOriginal(workIdFll); bool originalRoboticPrepCompleted = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedOriginal(workIdFll); DateTime? originalRoboticPrepCompletedDate = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDateOriginal(workIdFll); bool originalP1Completed = fullLengthLiningWorkDetailsGateway.GetP1CompletedOriginal(workIdFll); // M1 data string originalMeasurementTakenByFLL = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByOriginal(workIdFll); string originalSiteDetails = fullLengthLiningWorkDetailsGateway.GetSiteDetailsOriginal(workIdFll); bool originalPipeSizeChange = fullLengthLiningWorkDetailsGateway.GetPipeSizeChangeOriginal(workIdFll); bool originalStandardBypass = fullLengthLiningWorkDetailsGateway.GetStandardBypassOriginal(workIdFll); string originalStandardBypassComments = fullLengthLiningWorkDetailsGateway.GetStandardBypassCommentsOriginal(workIdFll); string originalTrafficControlDetails = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetailsOriginal(workIdFll); string originalMeasurementType = fullLengthLiningWorkDetailsGateway.GetMeasurementTypeOriginal(workIdFll); string originalMeasurementFromMh = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMhOriginal(workIdFll); string originalVideoDoneFromMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMhOriginal(workIdFll); string originalVideoDoneToMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMhOriginal(workIdFll); string originalAccessType = fullLengthLiningWorkDetailsGateway.GetAccessTypeOriginal(workIdFll); // M2 data string originalMeasurementTakenByM2 = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2Original(workIdFll); bool originalDropPipe = fullLengthLiningWorkDetailsGateway.GetDropPipeOriginal(workIdFll); string originalDropPipeInvertDepth = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepthOriginal(workIdFll); int? originalCappedLaterals = fullLengthLiningWorkDetailsGateway.GetCappedLateralsOriginal(workIdFll); string originalLineWithId = fullLengthLiningWorkDetailsGateway.GetLineWithIdOriginal(workIdFll); string originalHydrantAddress = fullLengthLiningWorkDetailsGateway.GetHydrantAddressOriginal(workIdFll); string originalHydroWireWithin10FtOfInversionMH = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMHOriginal(workIdFll); string originalDistanceToInversionMh = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMhOriginal(workIdFll); string originalSurfaceGrade = fullLengthLiningWorkDetailsGateway.GetSurfaceGradeOriginal(workIdFll); bool originalHydroPulley = fullLengthLiningWorkDetailsGateway.GetHydroPulleyOriginal(workIdFll); bool originalFridgeCart = fullLengthLiningWorkDetailsGateway.GetFridgeCartOriginal(workIdFll); bool originalTwoPump = fullLengthLiningWorkDetailsGateway.GetTwoPumpOriginal(workIdFll); bool originalSixBypass = fullLengthLiningWorkDetailsGateway.GetSixBypassOriginal(workIdFll); bool originalScaffolding = fullLengthLiningWorkDetailsGateway.GetScaffoldingOriginal(workIdFll); bool originalWinchExtension = fullLengthLiningWorkDetailsGateway.GetWinchExtensionOriginal(workIdFll); bool originalExtraGenerator = fullLengthLiningWorkDetailsGateway.GetExtraGeneratorOriginal(workIdFll); bool originalGreyCableExtension = fullLengthLiningWorkDetailsGateway.GetGreyCableExtensionOriginal(workIdFll); bool originalEasementMats = fullLengthLiningWorkDetailsGateway.GetEasementMatsOriginal(workIdFll); bool originalRampRequired = fullLengthLiningWorkDetailsGateway.GetRampRequiredOriginal(workIdFll); bool originalCameraSkid = fullLengthLiningWorkDetailsGateway.GetCameraSkidOriginal(workIdFll); // Comments string originalComments = fullLengthLiningWorkDetailsGateway.GetCommentsOriginal(workIdFll); // New variables string newClientIdFLL = fullLengthLiningWorkDetailsGateway.GetClientId(workIdFll); DateTime? newProposedLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetProposedLiningDate(workIdFll); DateTime? newDeadlineLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDate(workIdFll); DateTime? newM1Date = fullLengthLiningWorkDetailsGateway.GetM1Date(workIdFll); DateTime? newM2Date = fullLengthLiningWorkDetailsGateway.GetM2Date(workIdFll); DateTime? newInstallDate = fullLengthLiningWorkDetailsGateway.GetInstallDate(workIdFll); DateTime? newFinalVideoDateFLL = fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workIdFll); bool newIssueIdentifiedFLL = fullLengthLiningWorkDetailsGateway.GetIssueIdentified(workIdFll); bool newIssueLFSFLL = fullLengthLiningWorkDetailsGateway.GetIssueLFS(workIdFll); bool newIssueClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueClient(workIdFll); bool newIssueSalesFLL = fullLengthLiningWorkDetailsGateway.GetIssueSales(workIdFll); bool newIssueGivenToClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueGivenToClient(workIdFll); bool newIssueResolvedFLL = fullLengthLiningWorkDetailsGateway.GetIssueResolved(workIdFll); bool newIssueInvestigationFLL = fullLengthLiningWorkDetailsGateway.GetIssueInvestigation(workIdFll); bool newRoboticPrepCompleted = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompleted(workIdFll); DateTime? newRoboticPrepCompletedDate = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDate(workIdFll); bool newP1Completed = fullLengthLiningWorkDetailsGateway.GetP1Completed(workIdFll); // M1 string newMeasurementTakenByFLL = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenBy(workIdFll); string newSiteDetails = fullLengthLiningWorkDetailsGateway.GetSiteDetails(workIdFll); bool newPipeSizeChange = fullLengthLiningWorkDetailsGateway.GetPipeSizeChange(workIdFll); bool newStandardBypass = fullLengthLiningWorkDetailsGateway.GetStandardBypass(workIdFll); string newStandardBypassComments = fullLengthLiningWorkDetailsGateway.GetStandardBypassComments(workIdFll); string newTrafficControlDetails = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetails(workIdFll); string newMeasurementType = fullLengthLiningWorkDetailsGateway.GetMeasurementType(workIdFll); string newMeasurementFromMh = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workIdFll); string newVideoDoneFromMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMh(workIdFll); string newVideoDoneToMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMh(workIdFll); string newAccessType = fullLengthLiningWorkDetailsGateway.GetAccessType(workIdFll); // M2 string newMeasurementTakenByM2 = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2(workIdFll); bool newDropPipe = fullLengthLiningWorkDetailsGateway.GetDropPipe(workIdFll); string newDropPipeInvertDepth = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepth(workIdFll); int? newCappedLaterals = fullLengthLiningWorkDetailsGateway.GetCappedLaterals(workIdFll); string newLineWithId = fullLengthLiningWorkDetailsGateway.GetLineWithId(workIdFll); string newHydrantAddress = fullLengthLiningWorkDetailsGateway.GetHydrantAddress(workIdFll); string newHydroWireWithin10FtOfInversionMH = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMH(workIdFll); string newDistanceToInversionMh = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMh(workIdFll); string newSurfaceGrade = fullLengthLiningWorkDetailsGateway.GetSurfaceGrade(workIdFll); bool newHydroPulley = fullLengthLiningWorkDetailsGateway.GetHydroPulley(workIdFll); bool newFridgeCart = fullLengthLiningWorkDetailsGateway.GetFridgeCart(workIdFll); bool newTwoPump = fullLengthLiningWorkDetailsGateway.GetTwoPump(workIdFll); bool newSixBypass = fullLengthLiningWorkDetailsGateway.GetSixBypass(workIdFll); bool newScaffolding = fullLengthLiningWorkDetailsGateway.GetScaffolding(workIdFll); bool newWinchExtension = fullLengthLiningWorkDetailsGateway.GetWinchExtension(workIdFll); bool newExtraGenerator = fullLengthLiningWorkDetailsGateway.GetExtraGenerator(workIdFll); bool newGreyCableExtension = fullLengthLiningWorkDetailsGateway.GetGreyCableExtension(workIdFll); bool newEasementMats = fullLengthLiningWorkDetailsGateway.GetEasementMats(workIdFll); bool newRampRequired = fullLengthLiningWorkDetailsGateway.GetRampRequired(workIdFll); bool newCameraSkid = fullLengthLiningWorkDetailsGateway.GetCameraSkid(workIdFll); // comments string newComments = fullLengthLiningWorkDetailsGateway.GetComments(workIdFll); // ... Update work UpdateFllWork(sectionAssetId, countryId, provinceId, countyId, cityId, workIdFll, originalClientIdFLL, originalProposedLiningDateFLL, originalDeadlineLiningDateFLL, originalP1Date, originalM1Date, originalM2Date, originalInstallDate, originalFinalVideoDateFLL, originalIssueIdentifiedFLL, originalIssueLFSFLL, originalIssueClientFLL, originalIssueSalesFLL, originalIssueGivenToClientFLL, originalIssueResolvedFLL, originalIssueInvestigationFLL, originalCxisRemoved, originalRoboticPrepCompleted, originalRoboticPrepCompletedDate, originalMeasurementTakenByFLL, originalTrafficControl, originalSiteDetails, originalPipeSizeChange, originalStandardBypass, originalStandardBypassComments, originalTrafficControlDetails, originalMeasurementType, originalMeasurementFromMh, originalVideoDoneFromMh, originalVideoDoneToMh, originalVideoLength, originalComments, false, companyId, originalMaterial, originalAccessType, originalP1Completed, newClientIdFLL, originalProposedLiningDateFLL, originalDeadlineLiningDateFLL, newP1Date, newM1Date, originalM2Date, originalInstallDate, originalFinalVideoDateFLL, originalIssueIdentifiedFLL, originalIssueLFSFLL, originalIssueClientFLL, originalIssueSalesFLL, originalIssueGivenToClientFLL, originalIssueResolvedFLL, originalIssueInvestigationFLL, newCxisRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementTakenByFLL, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardBypass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasurementFromMh, newVideoDoneFromMh, newVideoDoneToMh, newVideoLength, newComments, false, companyId, newAccessType, newP1Completed); } else { if (newP1Date.HasValue || newCxisRemoved.HasValue || newMaterial != "" || newTrafficControl != "" || newVideoLength != "") // Insert Fll work { WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(null); workIdFll = workFullLengthLining.InsertDirectEmptyWorks(projectId, sectionAssetId, null, "", null, null, null, null, null, null, null, false, false, false, false, false, false, false, companyId, false, "", ""); FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway(); fullLengthLiningWorkDetailsGateway.LoadByWorkIdAssetId(workIdFll, sectionAssetId, companyId); // Original values string originalClientIdFLL = fullLengthLiningWorkDetailsGateway.GetClientIdOriginal(workIdFll); DateTime? originalProposedLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetProposedLiningDateOriginal(workIdFll); DateTime? originalDeadlineLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDateOriginal(workIdFll); DateTime? originalM1Date = fullLengthLiningWorkDetailsGateway.GetM1DateOriginal(workIdFll); DateTime? originalM2Date = fullLengthLiningWorkDetailsGateway.GetM2DateOriginal(workIdFll); DateTime? originalInstallDate = fullLengthLiningWorkDetailsGateway.GetInstallDateOriginal(workIdFll); DateTime? originalFinalVideoDateFLL = fullLengthLiningWorkDetailsGateway.GetFinalVideoDateOriginal(workIdFll); bool originalIssueIdentifiedFLL = fullLengthLiningWorkDetailsGateway.GetIssueIdentifiedOriginal(workIdFll); bool originalIssueLFSFLL = fullLengthLiningWorkDetailsGateway.GetIssueLFSOriginal(workIdFll); bool originalIssueClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueClientOriginal(workIdFll); bool originalIssueSalesFLL = fullLengthLiningWorkDetailsGateway.GetIssueSalesOriginal(workIdFll); bool originalIssueGivenToClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueGivenToClientOriginal(workIdFll); bool originalIssueResolvedFLL = fullLengthLiningWorkDetailsGateway.GetIssueResolvedOriginal(workIdFll); bool originalIssueInvestigationFLL = fullLengthLiningWorkDetailsGateway.GetIssueInvestigationOriginal(workIdFll); bool originalRoboticPrepCompleted = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedOriginal(workIdFll); DateTime? originalRoboticPrepCompletedDate = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDateOriginal(workIdFll); bool originalP1Completed = fullLengthLiningWorkDetailsGateway.GetP1CompletedOriginal(workIdFll); // M1 data string originalMeasurementTakenByFLL = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByOriginal(workIdFll); string originalSiteDetails = fullLengthLiningWorkDetailsGateway.GetSiteDetailsOriginal(workIdFll); bool originalPipeSizeChange = fullLengthLiningWorkDetailsGateway.GetPipeSizeChangeOriginal(workIdFll); bool originalStandardBypass = fullLengthLiningWorkDetailsGateway.GetStandardBypassOriginal(workIdFll); string originalStandardBypassComments = fullLengthLiningWorkDetailsGateway.GetStandardBypassCommentsOriginal(workIdFll); string originalTrafficControlDetails = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetailsOriginal(workIdFll); string originalMeasurementType = fullLengthLiningWorkDetailsGateway.GetMeasurementTypeOriginal(workIdFll); string originalMeasurementFromMh = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMhOriginal(workIdFll); string originalVideoDoneFromMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMhOriginal(workIdFll); string originalVideoDoneToMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMhOriginal(workIdFll); string originalAccessType = fullLengthLiningWorkDetailsGateway.GetAccessTypeOriginal(workIdFll); // M2 data string originalMeasurementTakenByM2 = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2Original(workIdFll); bool originalDropPipe = fullLengthLiningWorkDetailsGateway.GetDropPipeOriginal(workIdFll); string originalDropPipeInvertDepth = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepthOriginal(workIdFll); int? originalCappedLaterals = fullLengthLiningWorkDetailsGateway.GetCappedLateralsOriginal(workIdFll); string originalLineWithId = fullLengthLiningWorkDetailsGateway.GetLineWithIdOriginal(workIdFll); string originalHydrantAddress = fullLengthLiningWorkDetailsGateway.GetHydrantAddressOriginal(workIdFll); string originalHydroWireWithin10FtOfInversionMH = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMHOriginal(workIdFll); string originalDistanceToInversionMh = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMhOriginal(workIdFll); string originalSurfaceGrade = fullLengthLiningWorkDetailsGateway.GetSurfaceGradeOriginal(workIdFll); bool originalHydroPulley = fullLengthLiningWorkDetailsGateway.GetHydroPulleyOriginal(workIdFll); bool originalFridgeCart = fullLengthLiningWorkDetailsGateway.GetFridgeCartOriginal(workIdFll); bool originalTwoPump = fullLengthLiningWorkDetailsGateway.GetTwoPumpOriginal(workIdFll); bool originalSixBypass = fullLengthLiningWorkDetailsGateway.GetSixBypassOriginal(workIdFll); bool originalScaffolding = fullLengthLiningWorkDetailsGateway.GetScaffoldingOriginal(workIdFll); bool originalWinchExtension = fullLengthLiningWorkDetailsGateway.GetWinchExtensionOriginal(workIdFll); bool originalExtraGenerator = fullLengthLiningWorkDetailsGateway.GetExtraGeneratorOriginal(workIdFll); bool originalGreyCableExtension = fullLengthLiningWorkDetailsGateway.GetGreyCableExtensionOriginal(workIdFll); bool originalEasementMats = fullLengthLiningWorkDetailsGateway.GetEasementMatsOriginal(workIdFll); bool originalRampRequired = fullLengthLiningWorkDetailsGateway.GetRampRequiredOriginal(workIdFll); bool originalCameraSkid = fullLengthLiningWorkDetailsGateway.GetCameraSkidOriginal(workIdFll); // Comments string originalComments = fullLengthLiningWorkDetailsGateway.GetCommentsOriginal(workIdFll); // New variables string newClientIdFLL = fullLengthLiningWorkDetailsGateway.GetClientId(workIdFll); DateTime? newProposedLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetProposedLiningDate(workIdFll); DateTime? newDeadlineLiningDateFLL = fullLengthLiningWorkDetailsGateway.GetDeadlineLiningDate(workIdFll); DateTime? newM1Date = fullLengthLiningWorkDetailsGateway.GetM1Date(workIdFll); DateTime? newM2Date = fullLengthLiningWorkDetailsGateway.GetM2Date(workIdFll); DateTime? newInstallDate = fullLengthLiningWorkDetailsGateway.GetInstallDate(workIdFll); DateTime? newFinalVideoDateFLL = fullLengthLiningWorkDetailsGateway.GetFinalVideoDate(workIdFll); bool newIssueIdentifiedFLL = fullLengthLiningWorkDetailsGateway.GetIssueIdentified(workIdFll); bool newIssueLFSFLL = fullLengthLiningWorkDetailsGateway.GetIssueLFS(workIdFll); bool newIssueClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueClient(workIdFll); bool newIssueSalesFLL = fullLengthLiningWorkDetailsGateway.GetIssueSales(workIdFll); bool newIssueGivenToClientFLL = fullLengthLiningWorkDetailsGateway.GetIssueGivenToClient(workIdFll); bool newIssueResolvedFLL = fullLengthLiningWorkDetailsGateway.GetIssueResolved(workIdFll); bool newIssueInvestigationFLL = fullLengthLiningWorkDetailsGateway.GetIssueInvestigation(workIdFll); bool newRoboticPrepCompleted = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompleted(workIdFll); DateTime? newRoboticPrepCompletedDate = fullLengthLiningWorkDetailsGateway.GetRoboticPrepCompletedDate(workIdFll); bool newP1Completed = fullLengthLiningWorkDetailsGateway.GetP1Completed(workIdFll); // M1 string newMeasurementTakenByFLL = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenBy(workIdFll); string newSiteDetails = fullLengthLiningWorkDetailsGateway.GetSiteDetails(workIdFll); bool newPipeSizeChange = fullLengthLiningWorkDetailsGateway.GetPipeSizeChange(workIdFll); bool newStandardBypass = fullLengthLiningWorkDetailsGateway.GetStandardBypass(workIdFll); string newStandardBypassComments = fullLengthLiningWorkDetailsGateway.GetStandardBypassComments(workIdFll); string newTrafficControlDetails = fullLengthLiningWorkDetailsGateway.GetTrafficControlDetails(workIdFll); string newMeasurementType = fullLengthLiningWorkDetailsGateway.GetMeasurementType(workIdFll); string newMeasurementFromMh = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workIdFll); string newVideoDoneFromMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneFromMh(workIdFll); string newVideoDoneToMh = fullLengthLiningWorkDetailsGateway.GetVideoDoneToMh(workIdFll); string newAccessType = fullLengthLiningWorkDetailsGateway.GetAccessType(workIdFll); // M2 string newMeasurementTakenByM2 = fullLengthLiningWorkDetailsGateway.GetMeasurementTakenByM2(workIdFll); bool newDropPipe = fullLengthLiningWorkDetailsGateway.GetDropPipe(workIdFll); string newDropPipeInvertDepth = fullLengthLiningWorkDetailsGateway.GetDropPipeInvertDepth(workIdFll); int? newCappedLaterals = fullLengthLiningWorkDetailsGateway.GetCappedLaterals(workIdFll); string newLineWithId = fullLengthLiningWorkDetailsGateway.GetLineWithId(workIdFll); string newHydrantAddress = fullLengthLiningWorkDetailsGateway.GetHydrantAddress(workIdFll); string newHydroWireWithin10FtOfInversionMH = fullLengthLiningWorkDetailsGateway.GetHydroWiredWithin10FtOfInversionMH(workIdFll); string newDistanceToInversionMh = fullLengthLiningWorkDetailsGateway.GetDistanceToInversionMh(workIdFll); string newSurfaceGrade = fullLengthLiningWorkDetailsGateway.GetSurfaceGrade(workIdFll); bool newHydroPulley = fullLengthLiningWorkDetailsGateway.GetHydroPulley(workIdFll); bool newFridgeCart = fullLengthLiningWorkDetailsGateway.GetFridgeCart(workIdFll); bool newTwoPump = fullLengthLiningWorkDetailsGateway.GetTwoPump(workIdFll); bool newSixBypass = fullLengthLiningWorkDetailsGateway.GetSixBypass(workIdFll); bool newScaffolding = fullLengthLiningWorkDetailsGateway.GetScaffolding(workIdFll); bool newWinchExtension = fullLengthLiningWorkDetailsGateway.GetWinchExtension(workIdFll); bool newExtraGenerator = fullLengthLiningWorkDetailsGateway.GetExtraGenerator(workIdFll); bool newGreyCableExtension = fullLengthLiningWorkDetailsGateway.GetGreyCableExtension(workIdFll); bool newEasementMats = fullLengthLiningWorkDetailsGateway.GetEasementMats(workIdFll); bool newRampRequired = fullLengthLiningWorkDetailsGateway.GetRampRequired(workIdFll); bool newCameraSkid = fullLengthLiningWorkDetailsGateway.GetCameraSkid(workIdFll); // comments string newComments = fullLengthLiningWorkDetailsGateway.GetComments(workIdFll); // ... Update work UpdateFllWork(sectionAssetId, countryId, provinceId, countyId, cityId, workIdFll, originalClientIdFLL, originalProposedLiningDateFLL, originalDeadlineLiningDateFLL, originalP1Date, originalM1Date, originalM2Date, originalInstallDate, originalFinalVideoDateFLL, originalIssueIdentifiedFLL, originalIssueLFSFLL, originalIssueClientFLL, originalIssueSalesFLL, originalIssueGivenToClientFLL, originalIssueResolvedFLL, originalIssueInvestigationFLL, originalCxisRemoved, originalRoboticPrepCompleted, originalRoboticPrepCompletedDate, originalMeasurementTakenByFLL, originalTrafficControl, originalSiteDetails, originalPipeSizeChange, originalStandardBypass, originalStandardBypassComments, originalTrafficControlDetails, originalMeasurementType, originalMeasurementFromMh, originalVideoDoneFromMh, originalVideoDoneToMh, originalVideoLength, originalComments, false, companyId, originalMaterial, originalAccessType, originalP1Completed, newClientIdFLL, originalProposedLiningDateFLL, originalDeadlineLiningDateFLL, newP1Date, newM1Date, originalM2Date, originalInstallDate, originalFinalVideoDateFLL, originalIssueIdentifiedFLL, originalIssueLFSFLL, originalIssueClientFLL, originalIssueSalesFLL, originalIssueGivenToClientFLL, originalIssueResolvedFLL, originalIssueInvestigationFLL, newCxisRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementTakenByFLL, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardBypass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasurementFromMh, newVideoDoneFromMh, newVideoDoneToMh, newVideoLength, newComments, false, companyId, newAccessType, newP1Completed); } } if (workIdRa != 0) // ... Has Fll work { UpdateRaWork(workIdRa, originalPreFlushDate, originalPreVideoDate, newPreFlushDate, newPreVideoDate, companyId); } else { if (newPreFlushDate.HasValue || newPreVideoDate.HasValue) // Insert RA work { WorkRehabAssessment workRehabAssessment = new WorkRehabAssessment(null); workIdRa = workRehabAssessment.InsertDirect(projectId, sectionAssetId, null, newPreFlushDate, newPreVideoDate, false, companyId, "", ""); UpdateRaWork(workIdRa, originalPreFlushDate, originalPreVideoDate, newPreFlushDate, newPreVideoDate, companyId); } } // Update work WorkPointRepairs workPointRepairs = new WorkPointRepairs(null); workPointRepairs.UpdateDirect(sectionAssetId, workId, originalClientId, originalMeasurementTakenBy, originalRepairConfirmationDate, originalBypassRequired, originalRoboticDistances, originalProposedLiningDate, originalDeadlineLiningDate, originalFinalVideoDate, originalEstimatedJoints, originalJointsTestSealed, originalIssueIdentified, originalIssueLFS, originalIssueClient, originalIssueSales, originalIssueGivenToClient, originalIssueResolved, originalIssueInvestigation, "", false, companyId, workId, newClientId, newMeasurementTakenBy, newRepairConfirmationDate, newBypassRequired, newRoboticDistances, newProposedLiningDate, newDeadlineLiningDate, newFinalVideoDate, newEstimatedJoints, newJointsTestSealed, newIssueIdentified, newIssueLFS, newIssueClient, newIssueSales, newIssueGivenToClient, newIssueResolved, newIssueInvestigation, "", false, companyId); // 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 new comment WorkCommentsGateway workCommentsGateway = new WorkCommentsGateway(); workCommentsGateway.LoadByAssetIdWorkTypeProjectId(sectionAssetId, companyId, "Point Repairs", projectId); WorkComments workComments = new WorkComments(workCommentsGateway.Data); string newComment = workComments.GetCommentsSummary(companyId, workCommentsGateway.Table.Rows.Count, "\n"); Work work = new Work(null); work.UpdateDirect(workId, projectId, sectionAssetId, originalWorkType, originalLibraryCategoriesId, false, companyId, originalComment, originalHistory, workId, projectId, sectionAssetId, originalWorkType, originalLibraryCategoriesId, false, companyId, newComment, originalHistory); } } }