/// <summary> /// DeleteDirect including comments & history /// </summary> /// <param name="workId">workId</param> /// <param name="companyId">companyId</param> public void DeleteDirect(int workId, int companyId) { // Delete comments WorkComments workComments = new WorkComments(null); workComments.DeleteAllDirect(workId, companyId); // Delete History WorkHistory workHistory = new WorkHistory(null); workHistory.DeleteAllDirect(workId, companyId); // delete Work WorkGateway workGateway = new WorkGateway(Data); workGateway.Delete(workId, companyId); }
/// <summary> /// DeleteDirect /// </summary> /// <param name="workId">workId</param> /// <param name="companyId">companyId</param> public void DeleteDirect(int workId, int companyId) { WorkFullLengthLiningGateway workFullLengthLiningGateway = new WorkFullLengthLiningGateway(); workFullLengthLiningGateway.LoadByWorkId(workId, companyId); if (workFullLengthLiningGateway.Table.Rows.Count > 0) { // Delete P1 WorkFullLengthLiningP1 workFullLengthLiningP1 = new WorkFullLengthLiningP1(null); workFullLengthLiningP1.DeleteDirect(workId, companyId); // Delete M1 WorkFullLengthLiningM1 workFullLengthLiningM1 = new WorkFullLengthLiningM1(null); workFullLengthLiningM1.DeleteDirect(workId, companyId); // Delete M2 WorkFullLengthLiningM2 workFullLengthLiningM2 = new WorkFullLengthLiningM2(null); workFullLengthLiningM2.DeleteDirect(workId, companyId); // Delete WorkComments WorkComments workComments = new WorkComments(null); workComments.DeleteAllDirect(workId, companyId); // Delete Catalysts // Delete wet out data // delete inversion data // Delete WorkFullLengthLining workFullLengthLiningGateway.Delete(workId, companyId); // Delete work Work work = new Work(null); work.DeleteDirect(workId, companyId); } }
/// <summary> /// UpdateCommentsForSummaryEdit /// </summary> /// <param name="workId">workId</param> /// <param name="companyId">companyId</param> public void UpdateCommentsForSummaryEdit(int workId, int companyId) { WorkCommentsGateway workComentsGateway = new WorkCommentsGateway(); WorkComments workComments = new WorkComments(workComentsGateway.Data); WorkGateway workGateway = new WorkGateway(); FullLengthLiningTDS.WorkDetailsRow row = GetRow(workId); workGateway.LoadByWorkId(workId, companyId); workComentsGateway.LoadByWorkIdWorkType(workId, companyId, "Full Length Lining"); row.Comments = workComments.GetAllComments(workId, companyId, workComentsGateway.Table.Rows.Count, "\n"); }
/// <summary> /// Save all comments to database (direct) /// </summary> /// <param name="originalWorkId">originalWorkId</param> /// <param name="companyId">companyId</param> public void Save(int originalWorkId, int companyId) { RehabAssessmentTDS rehabAssessmentCommentDetailsChanges = (RehabAssessmentTDS)Data.GetChanges(); if (rehabAssessmentCommentDetailsChanges.CommentDetails.Rows.Count > 0) { RehabAssessmentCommentDetailsGateway rehabAssessmentCommentDetailsGateway = new RehabAssessmentCommentDetailsGateway(rehabAssessmentCommentDetailsChanges); foreach (RehabAssessmentTDS.CommentDetailsRow row in (RehabAssessmentTDS.CommentDetailsDataTable)rehabAssessmentCommentDetailsChanges.CommentDetails) { // Insert new comment if ((!row.Deleted) && (!row.InDatabase)) { WorkComments workComments = new WorkComments(null); int? libraryFilesId = null; if (!row.IsLIBRARY_FILES_IDNull()) libraryFilesId = row.LIBRARY_FILES_ID; workComments.InsertDirect(row.WorkID, row.RefID, row.Type, row.Subject, row.UserID, row.DateTime_, row.Comment, libraryFilesId, row.Deleted, row.COMPANY_ID, row.WorkType); } // Update comment if ((!row.Deleted) && (row.InDatabase)) { int workId = row.WorkID; int refId = row.RefID; bool originalDeleted = false; int originalCompanyId = companyId; // original values string originalType = rehabAssessmentCommentDetailsGateway.GetTypeOriginal(workId, refId); string originalSubject = rehabAssessmentCommentDetailsGateway.GetSubjectOriginal(workId, refId); int originalUserId = rehabAssessmentCommentDetailsGateway.GetUserIdOriginal(workId, refId); DateTime? originalDateTime = null; if (rehabAssessmentCommentDetailsGateway.GetDateTime_Original(workId, refId) != null) originalDateTime = rehabAssessmentCommentDetailsGateway.GetDateTime_Original(workId, refId); string originalComment = rehabAssessmentCommentDetailsGateway.GetCommentOriginal(workId, refId); int? originalLibraryFilesId = null; if (rehabAssessmentCommentDetailsGateway.GetLIBRARY_FILES_IDOriginal(workId, refId) != null) originalLibraryFilesId = rehabAssessmentCommentDetailsGateway.GetLIBRARY_FILES_IDOriginal(workId, refId); string originalWorkType = rehabAssessmentCommentDetailsGateway.GetWorkTypeOriginal(workId, refId); // new values string newType = rehabAssessmentCommentDetailsGateway.GetType(workId, refId); string newSubject = rehabAssessmentCommentDetailsGateway.GetSubject(workId, refId); string newComment = rehabAssessmentCommentDetailsGateway.GetComment(workId, refId); int? newLibraryFilesId = null; if (rehabAssessmentCommentDetailsGateway.GetLIBRARY_FILES_IDOriginal(workId, refId) != null) originalLibraryFilesId = rehabAssessmentCommentDetailsGateway.GetLIBRARY_FILES_ID(workId, refId); WorkComments workComments = new WorkComments(null); workComments.UpdateDirect(workId, refId, originalType, originalSubject, originalUserId, originalDateTime, originalComment, originalLibraryFilesId, originalDeleted, originalCompanyId, originalWorkType, workId, refId, newType, newSubject, originalUserId, originalDateTime, newComment, newLibraryFilesId, originalDeleted, originalCompanyId, originalWorkType); } // Deleted comment if ((row.Deleted) && (row.InDatabase)) { WorkComments workComments = new WorkComments(null); workComments.DeleteDirect(row.WorkID, row.RefID, row.COMPANY_ID); } } } }
/// <summary> /// UpdateCommentsForSummaryEdit /// </summary> /// <param name="workId">workId</param> /// <param name="companyId">companyId</param> public void UpdateCommentsForSummaryEdit(int workId, int companyId) { WorkCommentsGateway workComentsGateway = new WorkCommentsGateway(); WorkComments workComments = new WorkComments(workComentsGateway.Data); WorkGateway workGateway = new WorkGateway(); ManholeRehabilitationTDS.WorkDetailsRow row = GetRow(workId); workGateway.LoadByWorkId(workId, companyId); workComentsGateway.LoadByWorkIdWorkType(workId, companyId, "Manhole Rehabilitation"); row.Comments = workComments.GetAllComments(workId, companyId, workComentsGateway.Table.Rows.Count, "\n"); }
/// <summary> /// Save Previous Comments /// </summary> /// <param name="workId">workId</param> /// <param name="workType">workType</param> /// <param name="companyId">companyId</param> /// <param name="newSectionWorkId">newSectionWorkId</param> private void SavePreviousComments(int workId, string workType, int companyId, int newSectionWorkId) { WorkCommentsGateway workCommentsGateway = new WorkCommentsGateway(); workCommentsGateway.LoadAllByWorkIdWorkType(workId, companyId, workType); foreach (WorkTDS.LFS_WORK_COMMENTRow commentRow in (WorkTDS.LFS_WORK_COMMENTDataTable)workCommentsGateway.Table) { int refId = commentRow.RefID; string type = ""; if (!commentRow.IsTypeNull()) type = commentRow.Type; string subject = commentRow.Subject; int userId = commentRow.UserID; DateTime? dateTime_ = null; if (!commentRow.IsDateTime_Null()) dateTime_ = commentRow.DateTime_; string comment = ""; if (!commentRow.IsCommentNull()) comment = commentRow.Comment; int? libraryFilesId = null; if (!commentRow.IsLIBRARY_FILES_IDNull()) libraryFilesId = commentRow.LIBRARY_FILES_ID; WorkComments workComments = new WorkComments(); workComments.InsertDirect(newSectionWorkId, refId, type, subject, userId, dateTime_, comment, libraryFilesId, false, companyId, workType); } }
/// <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(); } } }
/// <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); } } }
private void workUpdate(int workId, int projectId, int assetId, int companyId, string workType) { // 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(assetId, companyId, workType, 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, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, originalComment, originalHistory, workId, projectId, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, newComment, originalHistory); }
private void WorkUpdate() { // Get general variables int projectId = Int32.Parse(hdfCurrentProject.Value.Trim()); int companyId = Convert.ToInt32(Session["companyID"]); FlatSectionJl flatSectionJl = new FlatSectionJl(flatSectionJlTDS); DataView dataViewFlatSectionJl = new DataView(flatSectionJlTDS.FlatSectionJl); dataViewFlatSectionJl.RowFilter = "(Selected = 1) AND (Deleted = 0)"; foreach (DataRowView row in dataViewFlatSectionJl) { int workId = Int32.Parse(row["WorkID"].ToString()); int assetId = Int32.Parse(row["AssetID"].ToString()); string workType = "Junction Lining Lateral"; // 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.LoadByWorkIdWorkType(workId, companyId, "Junction Lining Lateral"); WorkComments workComments = new WorkComments(workCommentsGateway.Data); string newComments = workComments.GetAllComments(workId, companyId, workCommentsGateway.Table.Rows.Count, "\n"); // Get new history WorkHistoryGateway workHistoryGateway = new WorkHistoryGateway(); workHistoryGateway.LoadByWorkIdWorkType(workId, companyId, "Junction Lining Lateral"); WorkHistory workHistory = new WorkHistory(workHistoryGateway.Data); string newHistory = workHistory.GetAllHistory(workId, companyId, workHistoryGateway.Table.Rows.Count, "\n"); Work work = new Work(null); work.UpdateDirect(workId, projectId, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, originalComment, originalHistory, workId, projectId, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, newComments, newHistory); flatSectionJl.UpdateCommentsHistoryForSummaryEdit(workId, workType, companyId); } }
/// <summary> /// Save Previous Comments /// </summary> /// <param name="workId">workId</param> /// <param name="workType">workType</param> /// <param name="companyId">companyId</param> /// <param name="newSectionWorkId">newSectionWorkId</param> private void SavePreviousComments(int parentWorkId, string workType, int companyId, int childWorkId) { WorkCommentsGateway parentWorkCommentsGateway = new WorkCommentsGateway(); parentWorkCommentsGateway.LoadAllByWorkIdWorkType(parentWorkId, companyId, workType); WorkCommentsGateway childWorkCommentsGateway = new WorkCommentsGateway(); childWorkCommentsGateway.LoadAllByWorkIdWorkType(childWorkId, companyId, workType); WorkComments childWorkComments = new WorkComments(childWorkCommentsGateway.Data); int lastRefId = childWorkComments.GetNewRefId(); foreach (WorkTDS.LFS_WORK_COMMENTRow commentRow in (WorkTDS.LFS_WORK_COMMENTDataTable)parentWorkCommentsGateway.Table) { WorkComments workComments = new WorkComments(); int refId = lastRefId; string type = ""; if (!commentRow.IsTypeNull()) type = commentRow.Type; string subject = commentRow.Subject; int userId = commentRow.UserID; DateTime? dateTime_ = null; if (!commentRow.IsDateTime_Null()) dateTime_ = commentRow.DateTime_; string comment = ""; if (!commentRow.IsCommentNull()) comment = commentRow.Comment; int? libraryFilesId = null; if (!commentRow.IsLIBRARY_FILES_IDNull()) libraryFilesId = commentRow.LIBRARY_FILES_ID; workComments.InsertDirect(childWorkId, refId, type, subject, userId, dateTime_, comment, libraryFilesId, false, companyId, workType); lastRefId++; } }
/// <summary> /// Save all comments to database (direct) /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { PointRepairsTDS pointRepairsChanges = (PointRepairsTDS)Data.GetChanges(); if (pointRepairsChanges.CommentDetails.Rows.Count > 0) { PointRepairsCommentDetailsGateway pointRepairsCommentDetailsGateway = new PointRepairsCommentDetailsGateway(pointRepairsChanges); foreach (PointRepairsTDS.CommentDetailsRow row in (PointRepairsTDS.CommentDetailsDataTable)pointRepairsChanges.CommentDetails) { // Insert new comment if ((!row.Deleted) && (!row.InDatabase)) { int workId = row.WorkID; int refId = row.RefID; int? libraryFilesId = null; if (!row.IsLIBRARY_FILES_IDNull()) libraryFilesId = row.LIBRARY_FILES_ID; WorkComments workComments = new WorkComments(null); workComments.InsertDirect(workId, refId, row.Type, row.Subject, row.UserID, row.DateTime_, row.Comment, libraryFilesId, row.Deleted, row.COMPANY_ID, row.WorkType); } // Update comment if ((!row.Deleted) && (row.InDatabase)) { int workId = row.WorkID; int refId = row.RefID; int originalCompanyId = companyId; string type = row.Type; int? libraryFilesId = null; if (!row.IsLIBRARY_FILES_IDNull()) libraryFilesId = row.LIBRARY_FILES_ID; string workType = row.WorkType; // Original values string originalSubject = pointRepairsCommentDetailsGateway.GetSubjectOriginal(workId, refId); int originalUserId = pointRepairsCommentDetailsGateway.GetUserIdOriginal(workId, refId); DateTime originalDateTime_ = pointRepairsCommentDetailsGateway.GetDateTime_Original(workId, refId); string originalComment = pointRepairsCommentDetailsGateway.GetCommentOriginal(workId, refId); bool originalDeleted = pointRepairsCommentDetailsGateway.GetDeletedOriginal(workId, refId); // New values string newSubject = pointRepairsCommentDetailsGateway.GetSubject(workId, refId); string newComment = pointRepairsCommentDetailsGateway.GetComment(workId, refId); WorkComments workComments = new WorkComments(null); workComments.UpdateDirect(workId, refId, type, originalSubject, originalUserId, originalDateTime_, originalComment, libraryFilesId, originalDeleted, originalCompanyId, workType, workId, refId, type, newSubject, originalUserId, originalDateTime_, newComment, libraryFilesId, originalDeleted, companyId, workType); } // Delete comment if ((row.Deleted) && (row.InDatabase)) { int workId = row.WorkID; int refId = row.RefID; WorkComments workComments = new WorkComments(null); workComments.DeleteDirect(workId, refId, row.COMPANY_ID); } } } }
/// <summary> /// SaveRAWork /// </summary> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="companyId">companyId</param> /// <param name="subArea">subArea</param> /// <param name="comments">comments</param> /// <param name="loginId">loginId</param> private void SaveRAWork(DataMigrationTDS.DataMigrationRow row, int projectId, int section_assetId, int companyId, string comments, int loginId) { DateTime dateTime_ = DateTime.Now; string commentsToWork = ""; DateTime? preFlushDate = null; if (!row.IsPreFlushDateNull()) preFlushDate = row.PreFlushDate; DateTime? preVideoDate = null; if (!row.IsPreVideoDateNull()) preVideoDate = row.PreVideoDate; if (comments != "") { // ... Get user name LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); // ... Form the comment string commentsToWork = commentsToWork + dateTime_ + "\n" + "(" + user.Trim() + ") \n Subject: Bulk Upload Comments \n Comment: " + comments; } WorkRehabAssessment workRehabAssessment = new WorkRehabAssessment(null); int workId = workRehabAssessment.InsertDirect(projectId, section_assetId, null, preFlushDate, preVideoDate, false, companyId, commentsToWork, ""); if (comments != "") { WorkCommentsGateway workCommentsGateway = new WorkCommentsGateway(); workCommentsGateway.LoadByWorkIdWorkType(workId, companyId, "Rehab Assessment"); WorkComments workComments = new WorkComments(workCommentsGateway.Data); workComments.Insert(workId, 0, "Rehab Assessment", "Bulk Upload Comments", loginId, DateTime.Now, comments, null, false, companyId, false, "Rehab Assessment"); // UpdateComments workCommentsGateway.Update(); } }
/// <summary> /// SaveFLLWork /// </summary> /// <param name="projectId"></param> /// <param name="section_assetId"></param> /// <param name="companyId"></param> /// <param name="comments"></param> /// <param name="loginId"></param> private void SaveFLLWork(DataMigrationTDS.DataMigrationRow row, int projectId, int section_assetId, int companyId, string comments, int loginId) { DateTime dateTime_ = DateTime.Now; string commentsToWork = ""; string clientId = ""; if (!row.IsClientIDNull()) clientId = row.ClientID; DateTime? proposedLiningDate = null; if (!row.IsProposedLiningDateNull()) proposedLiningDate = row.ProposedLiningDate; DateTime? deadLineLiningDate = null; if (!row.IsDeadlineDateNull()) deadLineLiningDate = row.DeadlineDate; DateTime? p1Date = null; if (!row.IsP1DateNull()) p1Date = row.P1Date; DateTime? m1Date = null; if (!row.IsM1DateNull()) m1Date = row.M1Date; DateTime? m2Date = null; if (!row.IsM2DateNull()) m2Date = row.M2Date; DateTime? installDate = null; if (!row.IsInstallDateNull()) installDate = row.InstallDate; DateTime? finalVideoDate = null; if (!row.IsFinalVideoNull()) finalVideoDate = row.FinalVideo; bool issueIdentified = row.IssueIdentified; bool issueLFS = row.LFSIssue; bool issueClient = row.ClientIssue; bool issueSales = row.SalesIssue; bool issueGivenToClient = row.IssueGivenToBayCity; bool issueResolved = row.IssueResolved; bool issueInvestigation = row.InvestigationIssue; int? cxisRemoved = null; if (!row.IsCXIsRemovedNull()) cxisRemoved = int.Parse(row.CXIsRemoved); string lineWidthId = ""; if (!row.IsLineWithIDNull()) lineWidthId = row.LineWithID; string measurementsTakenBy = ""; if (!row.IsMeasurementsTakenByNull()) measurementsTakenBy = row.MeasurementsTakenBy; string hydrantAddress = ""; if (!row.IsHydrantAddressNull()) hydrantAddress = row.HydrantAddress; string distanceToInversionMh = ""; if (!row.IsDistanceToInversionMHNull()) distanceToInversionMh = row.DistanceToInversionMH; string trafficControl = ""; if (!row.IsDegreeOfTrafficControlNull()) trafficControl = row.DegreeOfTrafficControl; string hydroWireDetails = ""; if (!row.IsHydroWireDetailsNull()) hydroWireDetails = row.HydroWireDetails; bool rampsRequired = row.RampsRequired; bool pipeSizeChanges = row.PipeSizeChange; bool standarBypass = row.StandarBypass; bool roboticPrepRequired = row.RoboticPrepRequired; bool schoolZone = row.SchoolZone; bool restaurantArea = row.RestaurantArea; bool carswashLaundromat = row.CarwashLaundromat; bool hydroPulley = row.HydroPulley; bool fridgeCart = row.FridgeCart; bool twoPump = row.TwoInchPump; bool sixBypass = row.SixInchBypass; bool scaffolding = row.Scaffolding; bool winchExtension = row.WinchExtension; bool extraGenerator = row.ExtraGenerator; bool greyCableExtension = row.GreyCableExtension; bool easementMats = row.EasementMats; string measurementType = ""; if (!row.IsMeasurementTypeNull()) measurementType = row.MeasurementType; string measurementFromMh = ""; if (!row.IsMeasuredFromManholeNull()) measurementFromMh = row.MeasuredFromManhole; string videoDoneFromMh = ""; if (!row.IsVideoDoneFromNull()) videoDoneFromMh = row.VideoDoneFrom; string videoDoneToMh = ""; if (!row.IsToManholeNull()) videoDoneToMh = row.ToManhole; string videoDistance = ""; if (!row.IsCutterDescriptionDuringMeasuringNull()) videoDistance = row.CutterDescriptionDuringMeasuring; bool dropPipe = row.DropPipe; string dropPipeInvertDepth = ""; if (!row.IsDropPipeInvertDepthNull()) dropPipeInvertDepth = row.DropPipeInvertDepth; int? cappedLaterals = null; if (!row.IsCappedLateralsNull()) cappedLaterals = row.CappedLaterals; string materialType = ""; if (!row.IsPipeMaterialTypeNull()) materialType = row.PipeMaterialType; string usmh = ""; if (!row.IsUSMHNull()) usmh = row.USMH; string dsmh = ""; if (!row.IsDSMHNull()) dsmh = row.DSMH; if (comments != "") { // ... Get user name LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); // ... Form the comment string commentsToWork = commentsToWork + dateTime_ + "\n" + "(" + user.Trim() + ") \n Subject: Bulk Upload Comments \n Comment: " + comments; } if (measurementFromMh != "") { if (measurementFromMh.ToUpper() == "USMH" || usmh.Contains(measurementFromMh)) { measurementFromMh = "USMH"; } if (measurementFromMh.ToUpper() == "DSMH" || dsmh.Contains(measurementFromMh)) { measurementFromMh = "DSMH"; } if (measurementFromMh != "USMH" && measurementFromMh != "DSMH") { measurementFromMh = ""; } } if (videoDoneFromMh != "") { if (videoDoneFromMh.ToUpper() == "USMH" || usmh.Contains(videoDoneFromMh)) { videoDoneFromMh = "USMH"; } if (videoDoneFromMh.ToUpper() == "DSMH" || dsmh.Contains(videoDoneFromMh)) { videoDoneFromMh = "DSMH"; } if (videoDoneFromMh != "USMH" && videoDoneFromMh != "DSMH") { videoDoneFromMh = ""; } } if (videoDoneToMh != "") { if (videoDoneToMh.ToUpper() == "USMH" || usmh.Contains(videoDoneToMh)) { videoDoneToMh = "USMH"; } if (videoDoneToMh.ToUpper() == "DSMH" || dsmh.Contains(videoDoneToMh)) { videoDoneToMh = "DSMH"; } if (videoDoneToMh != "USMH" && videoDoneToMh != "DSMH") { videoDoneToMh = ""; } } WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(null); int workId = workFullLengthLining.InsertDirectEmptyWorks(projectId, section_assetId, null, clientId, proposedLiningDate, deadLineLiningDate, p1Date, m1Date, m2Date, installDate, finalVideoDate, issueIdentified, issueLFS, issueClient, issueSales, issueGivenToClient, issueResolved, false, companyId, issueInvestigation, commentsToWork, ""); if (comments != "") { WorkCommentsGateway workCommentsGateway = new WorkCommentsGateway(); workCommentsGateway.LoadByWorkIdWorkType(workId, companyId, "Full Length Lining"); WorkComments workComments = new WorkComments(workCommentsGateway.Data); workComments.Insert(workId, 0, "Other", "Bulk Upload Comments", loginId, dateTime_, comments, null, false, companyId, false, "Full Length Lining"); // UpdateComments workCommentsGateway.Update(); } if (materialType != "") { DataMigrationGateway dataMigrationGateway = new DataMigrationGateway(null); dataMigrationGateway.InsertMaterial(section_assetId, 1, materialType, dateTime_, false, companyId); } }
/// <summary> /// SaveFLLWork /// </summary> /// <param name="projectId">projectId</param> /// <param name="section_assetId">section_assetId</param> /// <param name="companyId">companyId</param> /// <param name="comments">comments</param> /// <param name="loginId">loginId</param> /// <param name="clientId">clientId</param> private void SaveFLLWork(int projectId, int section_assetId, int companyId, string comments, int loginId, string clientId) { DateTime dateTime_ = DateTime.Now; string commentsToWork = ""; if (comments != "") { // ... Get user name LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); // ... Form the comment string commentsToWork = commentsToWork + dateTime_ + "\n" + "(" + user.Trim() + ") \n Subject: Bulk Upload Comments \n Comment: " + comments; } WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(null); int workId = workFullLengthLining.InsertDirectEmptyWorks(projectId, section_assetId, null, clientId, null, null, null, null, null, null, null, false, false, false, false, false, false, false, companyId, false, commentsToWork, ""); if (comments != "") { WorkCommentsGateway workCommentsGateway = new WorkCommentsGateway(); workCommentsGateway.LoadByWorkIdWorkType(workId, companyId, "Full Length Lining"); WorkComments workComments = new WorkComments(workCommentsGateway.Data); workComments.Insert(workId, 0, "Other", "Bulk Upload Comments", loginId, dateTime_, comments, null, false, companyId, false, "Full Length Lining"); // UpdateComments workCommentsGateway.Update(); } }