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