/// <summary> /// SaveFll /// </summary> /// <param name="workId">workId</param> /// <param name="assetIdLateral">assetIdLateral</param> /// <param name="companyId">companyId</param> /// <param name="opened">opened</param> /// <param name="brushed">brushed</param> public void SaveFll(int workId, int assetIdLateral, int companyId, DateTime? opened, DateTime? brushed) { // ... ... Modifications at M1 WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateway.LoadByWorkIdLateral(workId, assetIdLateral, companyId); if (workFullLengthLiningM1LateralGateway.Table.Rows.Count > 0) { // ... .... ... Load original data string originalVideoDistance = workFullLengthLiningM1LateralGateway.GetVideoDistance(workId, assetIdLateral); string originalClockPosition = workFullLengthLiningM1LateralGateway.GetClockPosition(workId, assetIdLateral); string originalDistanceToCentre = workFullLengthLiningM1LateralGateway.GetDistanceToCentre(workId, assetIdLateral); string originalTimeOpened = workFullLengthLiningM1LateralGateway.GetTimeOpened(workId, assetIdLateral); string originalReverseSetup = workFullLengthLiningM1LateralGateway.GetReverseSetup(workId, assetIdLateral); DateTime? originalReinstate = workFullLengthLiningM1LateralGateway.GetReinstate(workId, assetIdLateral); string originalComments = workFullLengthLiningM1LateralGateway.GetComments(workId, assetIdLateral); bool originalDeleted = workFullLengthLiningM1LateralGateway.GetDeleted(workId, assetIdLateral); int originalCompanyId = workFullLengthLiningM1LateralGateway.GetCompanyId(workId, assetIdLateral); string originalClientInspectionNo = workFullLengthLiningM1LateralGateway.GetClientInspectionNo(workId, assetIdLateral); DateTime? originalV1Inspection = workFullLengthLiningM1LateralGateway.GetV1Inspection(workId, assetIdLateral); bool originalRequiresRoboticPrep = workFullLengthLiningM1LateralGateway.GetRequiresRoboticPrep(workId, assetIdLateral); DateTime? originalRequiresRoboticPrepDate = workFullLengthLiningM1LateralGateway.GetRequiresRoboticPrepDate(workId, assetIdLateral); bool originalHoldClientIssue = workFullLengthLiningM1LateralGateway.GetHoldClientIssue(workId, assetIdLateral); bool originalHoldLFSIssue = workFullLengthLiningM1LateralGateway.GetHoldLFSIssue(workId, assetIdLateral); bool originalLinelateral = workFullLengthLiningM1LateralGateway.GetLineLateral(workId, assetIdLateral); bool originalDyeTestReq = workFullLengthLiningM1LateralGateway.GetDyeTestReq(workId, assetIdLateral); DateTime? originalDyeTestComplete = null; if (workFullLengthLiningM1LateralGateway.GetDyeTestComplete(workId, assetIdLateral).HasValue) originalDyeTestComplete = workFullLengthLiningM1LateralGateway.GetDyeTestComplete(workId, assetIdLateral); string originalContractYear = workFullLengthLiningM1LateralGateway.GetContractYear(workId, assetIdLateral); // New data string newTimeOpened = ""; if (opened.HasValue) newTimeOpened = opened.Value.ToString(); DateTime? newReinstate = null; if (brushed.HasValue) newReinstate = brushed; // Update work WorkFullLengthLiningM1Lateral workFullLengthLiningM1Lateral = new WorkFullLengthLiningM1Lateral(null); workFullLengthLiningM1Lateral.UpdateDirect(workId, assetIdLateral, originalVideoDistance, originalClockPosition, originalDistanceToCentre, originalTimeOpened, originalReverseSetup, originalReinstate, originalComments, originalDeleted, originalCompanyId, originalClientInspectionNo, originalV1Inspection, originalRequiresRoboticPrep, originalRequiresRoboticPrepDate, originalHoldClientIssue, originalHoldLFSIssue, originalLinelateral, originalDyeTestReq, originalDyeTestComplete, originalContractYear, workId, assetIdLateral, originalVideoDistance, originalClockPosition, originalDistanceToCentre, newTimeOpened, originalReverseSetup, newReinstate, originalComments, originalDeleted, originalCompanyId, originalClientInspectionNo, originalV1Inspection, originalRequiresRoboticPrep, originalRequiresRoboticPrepDate, originalHoldClientIssue, originalHoldLFSIssue, originalLinelateral, originalDyeTestReq, originalDyeTestComplete, originalContractYear); } }
/// <summary> /// UpdateFieldsForSections /// </summary> /// <param name="projectId">projectId</param> /// <param name="companyId">companyId</param> private void UpdateFieldsForSections(int projectId, int companyId) { foreach (FlatSectionJlTDS.FlatSectionJlRow row in (FlatSectionJlTDS.FlatSectionJlDataTable)Table) { int jlWorkId = row.WorkID; // ... Get raWorkId int raWorkId = 0; WorkGateway raWorkGateway = new WorkGateway(); raWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Rehab Assessment", companyId); if (raWorkGateway.Table.Rows.Count > 0) { raWorkId = raWorkGateway.GetWorkId(row.Section_, "Rehab Assessment", projectId); } // ... Get flWorkId int flWorkId = 0; WorkGateway flWorkGateway = new WorkGateway(); flWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Full Length Lining", companyId); if (flWorkGateway.Table.Rows.Count > 0) { flWorkId = flWorkGateway.GetWorkId(row.Section_, "Full Length Lining", projectId); } // ... Load All Comments FlatSectionJLAllComments flatSectionJLAllComments = new FlatSectionJLAllComments(); flatSectionJLAllComments.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId); row.Comments = flatSectionJLAllComments.GetJLOrFLOrRAComments(companyId, flatSectionJLAllComments.Table.Rows.Count, "\n"); // Add M1 comments WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateway.LoadByWorkIdLateral(flWorkId, row.AssetID, companyId); if (workFullLengthLiningM1LateralGateway.Table.Rows.Count > 0) { string m1LateralComments = workFullLengthLiningM1LateralGateway.GetComments(flWorkId, row.AssetID); if (m1LateralComments != "") { row.Comments = row.Comments + "\n\nType: M1 Lateral Comments\nComment: " + m1LateralComments ; } } WorkFullLengthLiningM1Gateway workFullLengthLiningM1Gateway = new WorkFullLengthLiningM1Gateway(); workFullLengthLiningM1Gateway.LoadByWorkId(flWorkId, companyId); if (workFullLengthLiningM1Gateway.Table.Rows.Count > 0) { string trafficControlDetails = workFullLengthLiningM1Gateway.GetTrafficControlDetails(flWorkId); if (trafficControlDetails != "") { row.Comments = row.Comments + "\n\nType: Traffic Control Details\nComment: " + trafficControlDetails; } string standardByPassComments = workFullLengthLiningM1Gateway.GetStandardBypassComments(flWorkId); if (standardByPassComments != "") { row.Comments = row.Comments + "\n\nType: Standard Bypass Comments\nComment: " + standardByPassComments ; } string measurementFromMH = "USMH"; if (workFullLengthLiningM1Gateway.GetMeasurementFromMh(flWorkId) != "") measurementFromMH = workFullLengthLiningM1Gateway.GetMeasurementFromMh(flWorkId); if (measurementFromMH == "DSMH") { string auxDistanceFromUSMH = row.DistanceFromUSMH; row.DistanceFromUSMH = row.DistanceFromDSMH; row.DistanceFromDSMH = auxDistanceFromUSMH; } } if (!row.IsCommentsNull()) { row.Comments = row.Comments.Replace("<br>", "\n"); } // Update History FlatSectionJLAllHistory flatSectionJLAllHistory = new FlatSectionJLAllHistory(); flatSectionJLAllHistory.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId); row.History = flatSectionJLAllHistory.GetJLOrFLOrRAHistory(companyId, flatSectionJLAllHistory.Table.Rows.Count, "\n"); if (!row.IsHistoryNull()) { row.History = row.History.Replace("<br>", "\n"); } // Update FlowOrderID if (!row.IsFlowOrderIDNull()) { row.LateralID = row.FlowOrderID + "-JL-" + row.LateralID; } else { row.LateralID = "JL-" + row.LateralID; } // Update MainSize if (!row.IsMainSizeNull()) { try { if (Distance.IsValidDistance(row.MainSize)) { Distance distance = new Distance(row.MainSize); switch (distance.DistanceType) { case 2: row.MainSize = distance.ToStringInEng1(); break; case 3: if (Convert.ToDouble(row.MainSize) > 99) { double newMainSize = 0; newMainSize = Convert.ToDouble(row.MainSize) * 0.03937; row.MainSize = Convert.ToString(Math.Ceiling(newMainSize)) + "\""; } else { row.MainSize = row.MainSize + "\""; } break; case 4: row.MainSize = distance.ToStringInEng1(); break; case 5: row.MainSize = distance.ToStringInEng1(); break; } } } catch { } } } }
/// <summary> /// UpdateFLLaterals /// </summary> /// <param name="currentProjectId">currentProjectId</param> /// <param name="lateral_assetId">lateral_assetId</param> /// <param name="companyId">companyId</param> /// <param name="v1Inspection">v1Inspection</param> /// <param name="clientInspectionNo">clientInspectionNo</param> /// <param name="section_">section_</param> /// <param name="requiresRoboticPrep">requiresRoboticPrep</param> /// <param name="requiresRoboticPrepCompleted">requiresRoboticPrepCompleted</param> /// <param name="holdClientIssue">holdClientIssue</param> /// <param name="holdLFSIssue">holdLFSIssue</param> /// <param name="dyeTestReq">dyeTestReq</param> /// <param name="dyeTestComplete">dyeTestComplete</param> private void UpdateFLLaterals(int currentProjectId, int lateral_assetId, int companyId, DateTime? v1Inspection, string clientInspectionNo, int section_, bool requiresRoboticPrep, DateTime? requiresRoboticPrepCompleted, bool holdClientIssue, bool holdLFSIssue, bool dyeTestReq, DateTime? dyeTestComplete, string contractYear) { // Load work id WorkGateway workGateway = new WorkGateway(); workGateway.LoadByProjectIdAssetIdWorkType(currentProjectId, section_, "Full Length Lining", companyId); if (workGateway.Table.Rows.Count > 0) { // ... ... Get WorkId for Full Length Lining int workIdFll = workGateway.GetWorkId(section_, "Full Length Lining", currentProjectId); // ... ... Modifications at M1 WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateway.LoadByWorkIdLateral(workIdFll, lateral_assetId, companyId); if (workFullLengthLiningM1LateralGateway.Table.Rows.Count > 0) { // ... .... ... Load original data string originalVideoDistance = workFullLengthLiningM1LateralGateway.GetVideoDistance(workIdFll, lateral_assetId); string originalClockPosition = workFullLengthLiningM1LateralGateway.GetClockPosition(workIdFll, lateral_assetId); string originalDistanceToCentre = workFullLengthLiningM1LateralGateway.GetDistanceToCentre(workIdFll, lateral_assetId); string originalTimeOpened = workFullLengthLiningM1LateralGateway.GetTimeOpened(workIdFll, lateral_assetId); string originalReverseSetup = workFullLengthLiningM1LateralGateway.GetReverseSetup(workIdFll, lateral_assetId); DateTime? originalReinstate = workFullLengthLiningM1LateralGateway.GetReinstate(workIdFll, lateral_assetId); string originalComments = workFullLengthLiningM1LateralGateway.GetComments(workIdFll, lateral_assetId); bool originalDeleted = workFullLengthLiningM1LateralGateway.GetDeleted(workIdFll, lateral_assetId); int originalCompanyId = workFullLengthLiningM1LateralGateway.GetCompanyId(workIdFll, lateral_assetId); string originalClientInspectionNo = workFullLengthLiningM1LateralGateway.GetClientInspectionNo(workIdFll, lateral_assetId); DateTime? originalV1Inspection = workFullLengthLiningM1LateralGateway.GetV1Inspection(workIdFll, lateral_assetId); bool originalRequiresRoboticPrep = workFullLengthLiningM1LateralGateway.GetRequiresRoboticPrep(workIdFll, lateral_assetId); DateTime? originalRequiresRoboticPrepDate = workFullLengthLiningM1LateralGateway.GetRequiresRoboticPrepDate(workIdFll, lateral_assetId); bool originalHoldClientIssue = workFullLengthLiningM1LateralGateway.GetHoldClientIssue(workIdFll, lateral_assetId); bool originalHoldLFSIssue = workFullLengthLiningM1LateralGateway.GetHoldLFSIssue(workIdFll, lateral_assetId); bool originalLinelateral = workFullLengthLiningM1LateralGateway.GetLineLateral(workIdFll, lateral_assetId); bool originalDyeTestReq = workFullLengthLiningM1LateralGateway.GetDyeTestReq(workIdFll, lateral_assetId); DateTime? originalDyeTestComplete = null; if (workFullLengthLiningM1LateralGateway.GetDyeTestComplete(workIdFll, lateral_assetId).HasValue) originalDyeTestComplete = workFullLengthLiningM1LateralGateway.GetDyeTestComplete(workIdFll, lateral_assetId); string originalContractYear = workFullLengthLiningM1LateralGateway.GetContractYear(workIdFll, lateral_assetId); // New data DateTime? newV1Inspection = v1Inspection; string newClientInspectionNo = clientInspectionNo; bool newRequiresRoboticPrep = requiresRoboticPrep; bool newHoldClientIssue = holdClientIssue; bool newHoldLFSIssue = holdLFSIssue; DateTime? newRequiresRoboticPrepCompleted = null; if (requiresRoboticPrepCompleted.HasValue) newRequiresRoboticPrepCompleted = requiresRoboticPrepCompleted; bool newDyeTestReq = dyeTestReq; DateTime? newDyeTestComplete = null; if (dyeTestComplete.HasValue) newDyeTestComplete = dyeTestComplete; string newContractYear = contractYear; // Update work WorkFullLengthLiningM1Lateral workFullLengthLiningM1Lateral = new WorkFullLengthLiningM1Lateral(null); workFullLengthLiningM1Lateral.UpdateDirect(workIdFll, lateral_assetId, originalVideoDistance, originalClockPosition, originalDistanceToCentre, originalTimeOpened, originalReverseSetup, originalReinstate, originalComments, originalDeleted, originalCompanyId, originalClientInspectionNo, originalV1Inspection, originalRequiresRoboticPrep, originalRequiresRoboticPrepDate, originalHoldClientIssue, originalHoldLFSIssue, originalLinelateral, originalDyeTestReq, originalDyeTestComplete, originalContractYear, workIdFll, lateral_assetId, originalVideoDistance, originalClockPosition, originalDistanceToCentre, originalTimeOpened, originalReverseSetup, originalReinstate, originalComments, originalDeleted, originalCompanyId, newClientInspectionNo, newV1Inspection, newRequiresRoboticPrep, newRequiresRoboticPrepCompleted, newHoldClientIssue, newHoldLFSIssue, originalLinelateral, newDyeTestReq, newDyeTestComplete, newContractYear); } } }
/// <summary> /// UpdateCommentsHistoryForSummaryEdit /// </summary> /// <param name="jlWorkId">jlWorkId</param> /// <param name="workType">workType</param> /// <param name="companyId">companyId</param> /// <returns>comments</returns> public void UpdateCommentsHistoryForSummaryEdit(int jlWorkId, string workType, int companyId) { foreach (FlatSectionJlTDS.FlatSectionJlRow row in (FlatSectionJlTDS.FlatSectionJlDataTable)Table) { WorkGateway workGateway = new WorkGateway(); workGateway.LoadByWorkId(jlWorkId, companyId); int assetId = workGateway.GetAssetId(jlWorkId); int projectId = workGateway.GetProjectId(jlWorkId); if (row.AssetID == assetId) { // Update Comments // ... Get raWorkId int raWorkId = 0; WorkGateway raWorkGateway = new WorkGateway(); raWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Rehab Assessment", companyId); if (raWorkGateway.Table.Rows.Count > 0) { raWorkId = raWorkGateway.GetWorkId(row.Section_, "Rehab Assessment", projectId); } // ... Get flWorkId int flWorkId = 0; WorkGateway flWorkGateway = new WorkGateway(); flWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Full Length Lining", companyId); if (flWorkGateway.Table.Rows.Count > 0) { flWorkId = flWorkGateway.GetWorkId(row.Section_, "Full Length Lining", projectId); } // ... Load All Comments FlatSectionJLAllComments flatSectionJLAllComments = new FlatSectionJLAllComments(); flatSectionJLAllComments.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId); row.Comments = flatSectionJLAllComments.GetJLOrFLOrRAComments(companyId, flatSectionJLAllComments.Table.Rows.Count, "\n"); // Add M1 comments WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateway.LoadByWorkIdLateral(flWorkId, row.AssetID, companyId); if (workFullLengthLiningM1LateralGateway.Table.Rows.Count > 0) { string m1LateralComments = workFullLengthLiningM1LateralGateway.GetComments(flWorkId, row.AssetID); if (m1LateralComments != "") { row.Comments = row.Comments + "\n\nType: M1 Lateral Comments\nComment: " + m1LateralComments; } } WorkFullLengthLiningM1Gateway workFullLengthLiningM1Gateway = new WorkFullLengthLiningM1Gateway(); workFullLengthLiningM1Gateway.LoadByWorkId(flWorkId, companyId); if (workFullLengthLiningM1Gateway.Table.Rows.Count > 0) { string trafficControlDetails = workFullLengthLiningM1Gateway.GetTrafficControlDetails(flWorkId); if (trafficControlDetails != "") { row.Comments = row.Comments + "\n\nType: Traffic Control Details\nComment: " + trafficControlDetails ; } string standardByPassComments = workFullLengthLiningM1Gateway.GetStandardBypassComments(flWorkId); if (standardByPassComments != "") { row.Comments = row.Comments + "\n\nType: Standard Bypass Comments\nComment: " + standardByPassComments ; } } if (!row.IsCommentsNull()) { row.Comments = row.Comments.Replace("<br>", "\n"); } // Update History FlatSectionJLAllHistory flatSectionJLAllHistory = new FlatSectionJLAllHistory(); flatSectionJLAllHistory.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId); row.History = flatSectionJLAllHistory.GetJLOrFLOrRAHistory(companyId, flatSectionJLAllHistory.Table.Rows.Count, "\n"); if (!row.IsHistoryNull()) { row.History = row.History.Replace("<br>", "\n"); } } } }
/// <summary> /// UpdateForReport /// </summary> /// <param name="companyId">companyId</param> public void UpdateForReport(int companyId) { foreach (JlLiningPlanTDS.JlLiningPlanJlinerRow row in (JlLiningPlanTDS.JlLiningPlanJlinerDataTable)Table) { // Update comments int jlWorkId = row.SectionWorkID; WorkGateway workGateway = new WorkGateway(); workGateway.LoadByWorkId(jlWorkId, companyId); int assetId = workGateway.GetAssetId(jlWorkId); int projectId = workGateway.GetProjectId(jlWorkId); // ... Get raWorkId int raWorkId = 0; WorkGateway raWorkGateway = new WorkGateway(); raWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Rehab Assessment", companyId); if (raWorkGateway.Table.Rows.Count > 0) { raWorkId = raWorkGateway.GetWorkId(row.Section_, "Rehab Assessment", projectId); } // ... Get raWorkId int flWorkId = 0; WorkGateway flWorkGateway = new WorkGateway(); flWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Full Length Lining", companyId); if (flWorkGateway.Table.Rows.Count > 0) { flWorkId = flWorkGateway.GetWorkId(row.Section_, "Full Length Lining", projectId); } // ... Load All Comments FlatSectionJLAllComments flatSectionJLAllComments = new FlatSectionJLAllComments(); flatSectionJLAllComments.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId); row.Comments = flatSectionJLAllComments.GetJLOrFLOrRAComments(companyId, flatSectionJLAllComments.Table.Rows.Count, "\n"); // Add M1 comments WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateway.LoadByWorkIdLateral(flWorkId, row.AssetID, companyId); if (workFullLengthLiningM1LateralGateway.Table.Rows.Count > 0) { string m1LateralComment = workFullLengthLiningM1LateralGateway.GetComments(flWorkId, row.AssetID); if (m1LateralComment != "") { row.Comments = row.Comments + "\n\nType: M1 Lateral Comments\nComment: " + m1LateralComment; } } if (!row.IsCommentsNull()) { row.Comments = row.Comments.Replace("<br>", "\n"); } // Round PullInDistance if (Validator.IsValidDecimal(row.PullInDistance)) { row.PullInDistance = decimal.Round(decimal.Parse(row.PullInDistance), 1).ToString(); } else { row.PullInDistance = "0"; } // Update Main size if (!row.IsMainSizeNull()) { if (Distance.IsValidDistance(row.MainSize)) { Distance distance = new Distance(row.MainSize); switch (distance.DistanceType) { case 2: row.MainSize = distance.ToStringInEng1(); break; case 3: if (Convert.ToDouble(row.MainSize) > 99) { double newMainSize = 0; newMainSize = Convert.ToDouble(row.MainSize) * 0.03937; row.MainSize = Convert.ToString(Math.Ceiling(newMainSize)) + "\""; } else { row.MainSize = row.MainSize + "\""; } break; case 4: row.MainSize = distance.ToStringInEng1(); break; case 5: row.MainSize = distance.ToStringInEng1(); break; } } } } }