/// <summary> /// UpdateHistory /// </summary> /// <param name="id_">id_</param> public void UpdateHistory(string id_) { //// Updating history fields //JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(); //FlatSectionJlinerTDS.FlatSectionJlinerRow lfsJunctionLiner2Row = GetRow(id_); //jlinerHistoryGateway.LoadByIdRefIdCompanyId(lfsJunctionLiner2Row.ID, lfsJunctionLiner2Row.RefID, lfsJunctionLiner2Row.COMPANY_ID); //JlinerHistory jlinerHistory = new JlinerHistory(jlinerHistoryGateway.Data); //string history = jlinerHistory.GetAllHistory(lfsJunctionLiner2Row.ID, lfsJunctionLiner2Row.RefID, lfsJunctionLiner2Row.COMPANY_ID, jlinerHistoryGateway.Table.Rows.Count, "<br>"); //if (history.Length > 0) //{ // lfsJunctionLiner2Row.History = history; //} //else //{ // lfsJunctionLiner2Row.SetHistoryNull(); //} foreach (FlatSectionJlinerTDS.FlatSectionJlinerRow row in (FlatSectionJlinerTDS.FlatSectionJlinerDataTable)Table) { JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(); jlinerHistoryGateway.LoadByIdRefId(row.ID, row.RefID, row.COMPANY_ID); JlinerHistory jlinerHistory = new JlinerHistory(jlinerHistoryGateway.Data); string history = jlinerHistory.GetAllHistory(row.ID, row.RefID, row.COMPANY_ID, jlinerHistoryGateway.Table.Rows.Count, "<br>"); if (history.Length > 0) { row.History = history; } else { row.SetHistoryNull(); } } }
/// <summary> /// Save to Section and Jliner rows /// </summary> /// <param name="sectionTDS">sectionTDS</param> public void Save(SectionTDS sectionTDS) { FlatSectionJlinerTDS flatSectionJlinerChanges = (FlatSectionJlinerTDS)Data.GetChanges(); if (flatSectionJlinerChanges.FlatSectionJliner.Rows.Count > 0) { SectionGateway sectionGateway = new SectionGateway(sectionTDS); LiquiForce.LFSLive.BL.CWP.Section.Section section = new LiquiForce.LFSLive.BL.CWP.Section.Section(sectionTDS); JlinerGateway jlinerGateway = new JlinerGateway(sectionTDS); Jliner jliner = new Jliner(sectionTDS); JlinerCommentGateway jlinerCommentGateway = new JlinerCommentGateway(sectionTDS); JlinerComments jlinerComments = new JlinerComments(jlinerCommentGateway.Data); JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(sectionTDS); JlinerHistory jlinerHistory = new JlinerHistory(jlinerHistoryGateway.Data); sectionGateway.ClearBeforeFill = false; jlinerGateway.ClearBeforeFill = false; jlinerCommentGateway.ClearBeforeFill = false; jlinerHistoryGateway.ClearBeforeFill = false; foreach (FlatSectionJlinerTDS.FlatSectionJlinerRow flatSectionJlinerRow in (FlatSectionJlinerTDS.FlatSectionJlinerDataTable)flatSectionJlinerChanges.FlatSectionJliner) { // Load section and jliner // ... Load section try { //... Search section row sectionGateway.GetRow(flatSectionJlinerRow.ID); } catch { //... Load section and section's jliners sectionGateway.LoadById(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID); jlinerGateway.LoadByIdCompanyId(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID); jlinerCommentGateway.LoadById(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID); jlinerHistoryGateway.LoadById(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID); } // Update // ... Update jliner string address = ""; if (!flatSectionJlinerRow.IsNull("Address")) address = flatSectionJlinerRow.Address; DateTime? pipeLocated = null; if (!flatSectionJlinerRow.IsNull("PipeLocated")) pipeLocated = flatSectionJlinerRow.PipeLocated; DateTime? servicesLocated = null; if (!flatSectionJlinerRow.IsNull("ServicesLocated")) servicesLocated = flatSectionJlinerRow.ServicesLocated; DateTime? coInstalled = null; if (!flatSectionJlinerRow.IsNull("CoInstalled")) coInstalled = flatSectionJlinerRow.CoInstalled; DateTime? backfilledConcrete = null; if (!flatSectionJlinerRow.IsNull("BackfilledConcrete")) backfilledConcrete = flatSectionJlinerRow.BackfilledConcrete; DateTime? backfilledSoil = null; if (!flatSectionJlinerRow.IsNull("BackfilledSoil")) backfilledSoil = flatSectionJlinerRow.BackfilledSoil; DateTime? grouted = null; if (!flatSectionJlinerRow.IsNull("Grouted")) grouted = flatSectionJlinerRow.Grouted; DateTime? cored = null; if (!flatSectionJlinerRow.IsNull("Cored")) cored = flatSectionJlinerRow.Cored; DateTime? prepped = null; if (!flatSectionJlinerRow.IsNull("Prepped")) prepped = flatSectionJlinerRow.Prepped; DateTime? measured = null; if (!flatSectionJlinerRow.IsNull("Measured")) measured = flatSectionJlinerRow.Measured; string linerSize = ""; if (!flatSectionJlinerRow.IsNull("LinerSize")) linerSize = flatSectionJlinerRow.LinerSize; DateTime? inProcess = null; if (!flatSectionJlinerRow.IsNull("Inprocess")) inProcess = flatSectionJlinerRow.InProcess; DateTime? inStock = null; if (!flatSectionJlinerRow.IsNull("InStock")) inStock = flatSectionJlinerRow.InStock; DateTime? delivered = null; if (!flatSectionJlinerRow.IsNull("Delivered")) delivered = flatSectionJlinerRow.Delivered; DateTime? preVideo = null; if (!flatSectionJlinerRow.IsNull("PreVideo")) preVideo = flatSectionJlinerRow.PreVideo; DateTime? linerInstalled = null; if (!flatSectionJlinerRow.IsNull("LinerInstalled")) linerInstalled = flatSectionJlinerRow.LinerInstalled; DateTime? finalVideo = null; if (!flatSectionJlinerRow.IsNull("FinalVideo")) finalVideo = flatSectionJlinerRow.FinalVideo; double? distanceFromUSMH = null; if (!flatSectionJlinerRow.IsNull("DistanceFromUSMH")) distanceFromUSMH = flatSectionJlinerRow.DistanceFromUSMH; double? distanceFromDSMH = null; if (!flatSectionJlinerRow.IsNull("DistanceFromDSMH")) distanceFromDSMH = flatSectionJlinerRow.DistanceFromDSMH; string history = ""; if (!flatSectionJlinerRow.IsNull("History")) history = flatSectionJlinerRow.History; string map = ""; string issue = flatSectionJlinerRow.Issue; decimal? cost = null; if (!flatSectionJlinerRow.IsNull("Cost")) cost = flatSectionJlinerRow.Cost; bool deleted = flatSectionJlinerRow.Deleted; // ... Delete all comments and history for a jliner if (deleted) { jlinerComments.DeleteAllCommentsForAJliner(flatSectionJlinerRow.ID, flatSectionJlinerRow.RefID, flatSectionJlinerRow.COMPANY_ID); jlinerHistory.DeleteAllHistoryForAJliner(flatSectionJlinerRow.ID, flatSectionJlinerRow.RefID, flatSectionJlinerRow.COMPANY_ID); } DateTime? videoInspection = null; if (!flatSectionJlinerRow.IsNull("VideoInspection")) videoInspection = flatSectionJlinerRow.VideoInspection; bool coRequired = flatSectionJlinerRow.CoRequired; bool pitRequired = flatSectionJlinerRow.PitRequired; string coPitLocation = ""; if (!flatSectionJlinerRow.IsNull("CoPitLocation")) coPitLocation = flatSectionJlinerRow.CoPitLocation; bool postContractDigRequired = flatSectionJlinerRow.PostContractDigRequired; DateTime? coCutDown = null; if (!flatSectionJlinerRow.IsNull("CoCutDown")) coCutDown = flatSectionJlinerRow.CoCutDown; DateTime? finalRestoration = null; if (!flatSectionJlinerRow.IsNull("FinalRestoration")) finalRestoration = flatSectionJlinerRow.FinalRestoration; string clientLateralId = ""; if (!flatSectionJlinerRow.IsNull("ClientLateralID")) clientLateralId = flatSectionJlinerRow.ClientLateralID; string videoLengthToPropertyLine = ""; if (!flatSectionJlinerRow.IsNull("VideoLengthToPropertyLine")) videoLengthToPropertyLine = flatSectionJlinerRow.VideoLengthToPropertyLine; bool liningThruCo = flatSectionJlinerRow.LiningThruCo; string hamiltonInspectionNumber = ""; if (!flatSectionJlinerRow.IsNull("HamiltonInspectionNumber")) hamiltonInspectionNumber = flatSectionJlinerRow.HamiltonInspectionNumber; DateTime? noticeDelivered = null; if (!flatSectionJlinerRow.IsNull("NoticeDelivered")) noticeDelivered = flatSectionJlinerRow.NoticeDelivered; jliner.Update(flatSectionJlinerRow.ID, flatSectionJlinerRow.RefID, flatSectionJlinerRow.COMPANY_ID, flatSectionJlinerRow.DetailID, address, pipeLocated, servicesLocated, coInstalled, backfilledConcrete, backfilledSoil, grouted, cored, prepped, measured, linerSize, inProcess, inStock, delivered, preVideo, linerInstalled, finalVideo, distanceFromUSMH, distanceFromDSMH,map, issue, cost, deleted, videoInspection, coRequired, pitRequired, coPitLocation, postContractDigRequired, coCutDown, finalRestoration, clientLateralId, videoLengthToPropertyLine, liningThruCo, hamiltonInspectionNumber, noticeDelivered); // ... Update section section.UpdateJliners(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID); } } }
/// <summary> /// DeleteDirect /// </summary> /// <param name="id">id</param> /// <param name="refId">refId</param> /// <param name="companyId">companyId</param> /// <param name="historyId">historyId</param> public void DeleteDirect(Guid id, int refId, int companyId, int historyId) { JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(null); jlinerHistoryGateway.Delete(id, refId, companyId, historyId); }
/// <summary> /// Update direct /// </summary> /// <param name="originalId">originalId</param> /// <param name="originalRefId">originalRefId</param> /// <param name="originalCompanyId">originalCompanyId</param> /// <param name="originalHistoryId">originalHistoryId</param> /// <param name="originalDateTime">originalDateTime</param> /// <param name="originalLoginId">originalLoginId</param> /// <param name="originalHistory">originalHistory</param> /// <param name="originalDeleted">originalDeleted</param> /// /// <param name="newId">newId</param> /// <param name="newRefId">newRefId</param> /// <param name="newCompanyId">newCompanyId</param> /// <param name="originalHistoryId">originalHistoryId</param> /// <param name="newDateTime">newDateTime</param> /// <param name="newLoginId">newLoginId</param> /// <param name="newHistory">newHistory</param> /// <param name="newDeleted">newDeleted</param> public void UpdateDirect(Guid originalId, int originalRefId, int originalCompanyId, int originalHistoryId, DateTime? originalDateTime, int originalLoginId, string originalHistory, bool originalDeleted, Guid newId, int newRefId, int newCompanyId, int newHistoryId, DateTime? newDateTime, int newLoginId, string newHistory, bool newDeleted) { JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(null); jlinerHistoryGateway.Update(originalId, originalRefId, originalCompanyId, originalHistoryId, originalDateTime, originalLoginId, originalHistory, originalDeleted, newId, newRefId, newCompanyId, newHistoryId, newDateTime, newLoginId, newHistory, newDeleted); }
/// <summary> /// Insert a new comment to history (direct to DB) /// </summary> /// <param name="id">id</param> /// <param name="refId">refId</param> /// <param name="companyId">companyId</param> /// <param name="historyId">historyId</param> /// <param name="dateTime_">dateTime_</param> /// <param name="loginId">loginId</param> /// <param name="history">history</param> /// <param name="deleted">deleted</param> /// <returns></returns> public void InsertDirect(Guid id, int refId, int companyId, int historyId, DateTime? dateTime_, int loginId, string history, bool deleted) { JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(null); jlinerHistoryGateway.Insert(id, refId, companyId, historyId, dateTime_, loginId, history, deleted); }
/// <summary> /// Save a JL Work /// </summary> /// <param name="originalId">originalId</param> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="numLats">numLats</param> /// <param name="notLinedYet">notLinedYet</param> /// <param name="allMeasured">allMeasured</param> /// <param name="issueWithLaterals">issueWithLaterals</param> /// <param name="notMeasuredYet">notMeasuredYet</param> /// <param name="notDeliveredYet">notDeliveredYet</param> /// <param name="countryId">countryId</param> /// <param name="provinceId">provinceId</param> /// <param name="countyId">countyId</param> /// <param name="cityId">cityId</param> /// <param name="companyId">companyId</param> private void SaveJLWork(Guid originalId, int section_assetId, int numLats, int notLinedYet, bool allMeasured, string issueWithLaterals, int notMeasuredYet, int notDeliveredYet, int projectId, Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int companyId) { // Insert Junction Lining Section WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(null); int sectionWorkId = workJunctionLiningSection.InsertDirect(projectId, section_assetId, null, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, false, companyId, "", "", "", "", false, "", 0); // Insert Junction Lining Laterals SectionTDS sectionTDS = new SectionTDS(); SectionGateway sectionGateway = new SectionGateway(sectionTDS); sectionGateway.LoadById(originalId, companyId); JlinerGateway jlinerGateway = new JlinerGateway(sectionTDS); jlinerGateway.LoadByIdCompanyId(originalId, companyId); foreach (SectionTDS.LFS_JUNCTION_LINER2Row row in (SectionTDS.LFS_JUNCTION_LINER2DataTable)jlinerGateway.Table) { string lateralID = ""; if (!row.IsDetailIDNull()) lateralID = row.DetailID; string address = ""; if (!row.IsAddressNull()) address = row.Address; string distanceFromUSMH = ""; if (!row.IsDistanceFromUSMHNull()) distanceFromUSMH = row.DistanceFromUSMH.ToString(); string distanceFromDSMH = ""; if (!row.IsDistanceFromDSMHNull()) distanceFromDSMH = row.DistanceFromDSMH.ToString(); DateTime? pipeLocated = null; if (!row.IsPipeLocatedNull()) pipeLocated = row.PipeLocated; DateTime? servicesLocated = null; if (!row.IsServicesLocatedNull()) servicesLocated = row.ServicesLocated; DateTime? coInstalled = null; if (!row.IsCoInstalledNull()) coInstalled = row.CoInstalled; DateTime? backfilledConcrete = null; if (!row.IsBackfilledConcreteNull()) backfilledConcrete = row.BackfilledConcrete; DateTime? backfilledSoil = null; if (!row.IsBackfilledSoilNull()) backfilledSoil = row.BackfilledSoil; DateTime? grouted = null; if (!row.IsGroutedNull()) grouted = row.Grouted; DateTime? cored = null; if (!row.IsCoredNull()) cored = row.Cored; DateTime? prepped = null; if (!row.IsPreppedNull()) prepped = row.Prepped; DateTime? measured = null; if (!row.IsMeasuredNull()) measured = row.Measured; string linerSize = ""; if (!row.IsLinerSizeNull()) linerSize = row.LinerSize; DateTime? inProcess = null; if (!row.IsInProcessNull()) inProcess = row.InProcess; DateTime? inStock = null; if (!row.IsInStockNull()) inStock = row.InStock; DateTime? delivered = null; if (!row.IsDeliveredNull()) delivered = row.Delivered; int? buildRebuid = null; if (!row.IsBuildRebuildNull()) buildRebuid = row.BuildRebuild; DateTime? preVideo = null; if (!row.IsPreVideoNull()) preVideo = row.PreVideo; DateTime? linerInstalled = null; if (!row.IsLinerInstalledNull()) linerInstalled = row.LinerInstalled; DateTime? finalVideo = null; if (!row.IsFinalVideoNull()) finalVideo = row.FinalVideo; string map = ""; if (!row.IsMapNull()) map = row.Map; decimal? cost = null; if (!row.IsCostNull()) cost = row.Cost; DateTime? videoInspection = null; if (!row.IsVideoInspectionNull()) videoInspection = row.VideoInspection; bool coRequired = row.CoRequired; bool pitRequired = row.PitRequired; string coPitLocation = ""; if (!row.IsCoPitLocationNull()) coPitLocation = row.CoPitLocation; bool postContractDigRequired = row.PostContractDigRequired; string comments = ""; if (!row.IsCommentsNull()) comments = row.Comments; string history = ""; if (!row.IsHistoryNull()) history = row.History; DateTime? coCutDown = null; if (!row.IsCoCutDownNull()) coCutDown = row.CoCutDown; DateTime? finalRestoration = null; if (!row.IsFinalRestorationNull()) finalRestoration = row.FinalRestoration; string clientLateralId = ""; if (!row.IsClientLateralIDNull()) clientLateralId = row.ClientLateralID; string videoLengthToPropertyLine = ""; if (!row.IsVideoLengthToPropertyLineNull()) videoLengthToPropertyLine = row.VideoLengthToPropertyLine; bool liningThruCo = row.LiningThruCo; DateTime? noticeDelivered = null; if (!row.IsNoticeDeliveredNull()) noticeDelivered = row.NoticeDelivered; string hamiltonInspectionNumber = ""; if (!row.IsHamiltonInspectionNumberNull()) hamiltonInspectionNumber = row.HamiltonInspectionNumber; bool dyeTestReq = row.DyeTestReq; DateTime? dyeTestComplete = null; if (!row.IsDyeTestCompleteNull()) dyeTestComplete = row.DyeTestComplete; // Fields only presents in new Junction lining string flange = ""; string gasket = ""; string connectionType = ""; string depthOfLocated = ""; bool digRequiredPriorToLining = false; DateTime? digRequiredPriorToLiningCompleted = null; bool digRequiredAfterLining = false; DateTime? digRequiredAfterLiningCompleted = null; bool outOfScope = false; bool holdClientIssue = false; DateTime? holdClientIssueResolved = null; bool holdLFSIssue = false; DateTime? holdLFSIssueResolved = null; bool requiresRoboticPrep = false; DateTime? requiresRoboticPrepCompleted = null; ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); int clientId = projectGateway.GetClientID(projectId); // Insert into LFS Asset Lateral LfsAssetSewerLateral lfsAssetSewerLateral = new LfsAssetSewerLateral(null); int lateralAssetId = lfsAssetSewerLateral.InsertDirect(countryId, provinceId, countyId, cityId, section_assetId, address, lateralID, "", "", "", "", "Live", "", distanceFromUSMH, distanceFromDSMH, "", false, companyId, connectionType); // Insert into LFS Asset Lateral Client LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.InsertDirect(lateralAssetId, clientId, clientLateralId, false, companyId); // Insert into Work Junction Lining Lateral WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(null); int workLateral = workJunctionLiningLateral.InsertDirect(projectId, lateralAssetId, sectionWorkId, pipeLocated, servicesLocated, coInstalled, backfilledConcrete, backfilledSoil, grouted, cored, prepped, measured, linerSize, inProcess, inStock, delivered, buildRebuid, 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, "", "", dyeTestReq, dyeTestComplete, ""); // Insert into Work Comments JlinerCommentGateway jlinerCommentGateway = new JlinerCommentGateway(sectionTDS); jlinerCommentGateway.LoadByIdRefId(originalId, row.RefID, companyId); foreach (SectionTDS.LFS_JUNCTION_LINER2_COMMENTRow rowComment in (SectionTDS.LFS_JUNCTION_LINER2_COMMENTDataTable)jlinerCommentGateway.Table) { int loginId = rowComment.LoginID; DateTime dateTime_ = rowComment.DateTime_; string comment = rowComment.Comment; WorkCommentsGateway workCommentsGateway = new WorkCommentsGateway(); workCommentsGateway.LoadByWorkIdWorkType(workLateral, companyId, "Junction Lining Lateral"); WorkComments workComments = new WorkComments(workCommentsGateway.Data); workComments.Insert(workLateral, 0, "Junction Lining Lateral", "Bulk Upload Comments", loginId, dateTime_, comment, null, false, companyId, false, "Junction Lining"); // Update Comments workCommentsGateway.Update(); } // Insert into Work History JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(sectionTDS); jlinerHistoryGateway.LoadByIdRefId(originalId, row.RefID, companyId); foreach (SectionTDS.LFS_JUNCTION_LINER2_HISTORYRow rowHistory in (SectionTDS.LFS_JUNCTION_LINER2_HISTORYDataTable)jlinerHistoryGateway.Table) { int loginId = rowHistory.LoginID; DateTime dateTime_H = rowHistory.DateTime_; string history_ = rowHistory.History; WorkHistoryGateway workHistoryGateway = new WorkHistoryGateway(); workHistoryGateway.LoadByWorkIdWorkType(workLateral, companyId, "Junction Lining Lateral"); WorkHistory workHistory = new WorkHistory(workHistoryGateway.Data); workHistory.Insert(workLateral, 0, "Junction Lining Lateral", "Bulk Upload History", loginId, dateTime_H, history_, null, false, companyId, false, "Junction Lining"); // Update History workHistoryGateway.Update(); } } }