/// <summary> /// Save a section /// </summary> /// <param name="row">row</param> /// <param name="projectId">projectId</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> /// <returns>section_assetId</returns> private int SaveSection(DataMigrationTDS.JlDataMigrationRow row, int projectId, Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int companyId) { string street = ""; if (!row.IsStreetNull()) street = row.Street; string subArea = ""; if (!row.IsSubAreaNull()) subArea = row.SubArea; string usmh = ""; if (!row.IsUSMHNull()) usmh = row.USMH; string dsmh = ""; if (!row.IsDSMHNull()) dsmh = row.DSMH; string usmhAddress = ""; if (!row.IsUSMHMNNull()) usmhAddress = row.USMHMN; string dsmhAddress = ""; if (!row.IsDSMHMNNull()) dsmhAddress = row.DSMHMN; string mapLength = ""; if (!row.IsScaledLengthNull()) mapLength = row.ScaledLength; string actualLength = ""; if (!row.IsActualLengthNull()) actualLength = row.ActualLength; string mapSize = ""; if (!row.IsSize_Null()) mapSize = row.Size_; string confirmedSize = ""; if (!row.IsConfirmedSizeNull()) confirmedSize = row.ConfirmedSize; string usmhDepth = ""; if (!row.IsUSMHDepthNull()) usmhDepth = row.USMHDepth; string dsmhDepth = ""; if (!row.IsDSMHDepthNull()) dsmhDepth = row.DSMHDepth; string steelTapeThruPipe = ""; if (!row.IsSteelTapeThruPipeNull()) steelTapeThruPipe = row.SteelTapeThruPipe; string usmhMouth12 = ""; if (!row.IsUSMHAtMouth1200Null()) usmhMouth12 = row.USMHAtMouth1200; string usmhMouth1 = ""; if (!row.IsUSMHAtMouth100Null()) usmhMouth12 = row.USMHAtMouth100; string usmhMouth2 = ""; if (!row.IsUSMHAtMouth200Null()) usmhMouth12 = row.USMHAtMouth200; string usmhMouth3 = ""; if (!row.IsUSMHAtMouth300Null()) usmhMouth12 = row.USMHAtMouth300; string usmhMouth4 = ""; if (!row.IsUSMHAtMouth400Null()) usmhMouth12 = row.USMHAtMouth400; string usmhMouth5 = ""; if (!row.IsUSMHAtMouth500Null()) usmhMouth12 = row.USMHAtMouth500; string dsmhMouth12 = ""; if (!row.IsDSMHAtMouth1200Null()) dsmhMouth12 = row.DSMHAtMouth1200; string dsmhMouth1 = ""; if (!row.IsDSMHAtMouth100Null()) dsmhMouth12 = row.DSMHAtMouth100; string dsmhMouth2 = ""; if (!row.IsDSMHAtMouth200Null()) dsmhMouth12 = row.DSMHAtMouth200; string dsmhMouth3 = ""; if (!row.IsDSMHAtMouth300Null()) dsmhMouth12 = row.DSMHAtMouth300; string dsmhMouth4 = ""; if (!row.IsDSMHAtMouth400Null()) dsmhMouth12 = row.DSMHAtMouth400; string dsmhMouth5 = ""; if (!row.IsDSMHAtMouth500Null()) dsmhMouth12 = row.DSMHAtMouth500; string thickness = ""; if (!row.IsThicknessNull()) thickness = row.Thickness; // insert usmh (if not exists) int? usmh_assetId = null; if (usmh != "") { LfsAssetSewerMH lfsAssetSewerUsmh = new LfsAssetSewerMH(null); usmh_assetId = lfsAssetSewerUsmh.InsertDirect(countryId, provinceId, countyId, cityId, usmh, "", "", usmhAddress, false, companyId, "", "", null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", null, "", "", null); } // insert dsmh (if not exists) int? dsmh_assetId = null; if (dsmh != "") { LfsAssetSewerMH lfsAssetSewerDsmh = new LfsAssetSewerMH(null); dsmh_assetId = lfsAssetSewerDsmh.InsertDirect(countryId, provinceId, countyId, cityId, dsmh, "", "", dsmhAddress, false, companyId, "", "", null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", null, "", "", null); } // insert section LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(null); int section_assetId = lfsAssetSewerSection.InsertDirect(countryId, provinceId, countyId, cityId, row.OriginalSectionID, street, usmh_assetId, dsmh_assetId, mapSize, confirmedSize, mapLength, actualLength, null, null, "", usmhDepth, dsmhDepth, usmhAddress, dsmhAddress, steelTapeThruPipe, usmhMouth12, usmhMouth1, usmhMouth2, usmhMouth3, usmhMouth4, usmhMouth5, dsmhMouth12, dsmhMouth1, dsmhMouth2, dsmhMouth3, dsmhMouth4, dsmhMouth5, false, companyId, subArea, thickness, -1, "", DateTime.Now); return section_assetId; }
/// <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); } }