/// <summary> /// DeleteDirect /// </summary> /// <param name="assetId">assetId</param> /// <param name="companyId">companyId</param> /// <returns></returns> public bool DeleteDirect(int assetId, int companyId) { // Verify in use if (!InUse(assetId, companyId)) { // Delete laterals // ... Define initial models LfsAssetSewerLateral lfsAssetSewerLateral = new LfsAssetSewerLateral(null); // ... Load laterals AssetSewerLateralGateway assetSewerLateralGateway = new AssetSewerLateralGateway(); assetSewerLateralGateway.LoadBySectionId(assetId, companyId); // ... Delete laterals foreach (AssetsTDS.AM_ASSET_SEWER_LATERALRow rowLateral in (AssetsTDS.AM_ASSET_SEWER_LATERALDataTable)assetSewerLateralGateway.Table) { lfsAssetSewerLateral.DeleteDirect(rowLateral.AssetID, companyId); } // Get MHs for deleted AssetSewerSectionGateway assetSewerSectionGateway = new AssetSewerSectionGateway(); assetSewerSectionGateway.LoadByAssetId(assetId, companyId); int? usmh_assetId = assetSewerSectionGateway.GetUSMH(assetId); int? dsmh_assetId = assetSewerSectionGateway.GetDSMH(assetId); // Delete section LfsAssetSewerSectionGateway lfsAssetSewerSectionGateway = new LfsAssetSewerSectionGateway(null); lfsAssetSewerSectionGateway.Delete(assetId, companyId); LfsAssetSewer lfsAssetSewer = new LfsAssetSewer(null); lfsAssetSewer.DeleteDirect(assetId, companyId); LfsAsset lfsAsset = new LfsAsset(null); lfsAsset.DeleteDirect(assetId, companyId); // delete section in AM tables AssetSewerSection assetSewerSection = new AssetSewerSection(null); assetSewerSection.DeleteDirect(assetId, companyId); // Delete USMH (if not in use) if (usmh_assetId.HasValue) { LfsAssetSewerMH lfsAssetSewerUsmh = new LfsAssetSewerMH(null); lfsAssetSewerUsmh.DeleteDirect((int)usmh_assetId, companyId); } // Delete DSMH (if not in use) if (dsmh_assetId.HasValue) { LfsAssetSewerMH lfsAssetSewerDsmh = new LfsAssetSewerMH(null); lfsAssetSewerDsmh.DeleteDirect((int)dsmh_assetId, companyId); } return true; } else { return false; } }
// //////////////////////////////////////////////////////////////////////// // PRIVATE METHODS // /// <summary> /// Update /// </summary> /// <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="originalWorkId">originalWorkId</param> /// <param name="originalAssetId">originalAssetId</param> /// <param name="originalSectionId">originalSectionId</param> /// <param name="originalStreet">originalStreet</param> /// <param name="originalUsmh">originalUsmh</param> /// <param name="originalUsmhId">originalUsmhId</param> /// <param name="originalDsmh">originalDsmh</param> /// <param name="originalDsmhId">originalDsmhId</param> /// <param name="originalMapSize">originalMapSize</param> /// <param name="originalSize">originalSize</param> /// <param name="originalMapLength">originalMapLength</param> /// <param name="originalLength">originalLength</param> /// <param name="originalLaterals">laterals</param> /// <param name="originalLiveLaterals">liveLaterals</param> /// <param name="originalUsmhDepth">originalUsmhDepth</param> /// <param name="originalDsmhDepth">originalDsmhDepth</param> /// <param name="originalSteelTapeThroughSewer">originalSteelTapeThroughSewer</param> /// <param name="originalSubArea">originalSubArea</param> /// <param name="originalUsmhMouth12">originalUsmhMouth12</param> /// <param name="originalUsmhMouth1">originalUsmhMouth1</param> /// <param name="originalUsmhMouth2">originalUsmhMouth2</param> /// <param name="originalUsmhMouth3">originalUsmhMouth3</param> /// <param name="originalUsmhMouth4">originalUsmhMouth4</param> /// <param name="originalUsmhMouth5">originalUsmhMouth5</param> /// <param name="originalDsmhMouth12">originalDsmhMouth12</param> /// <param name="originalDsmhMouth1">originalDsmhMouth1</param> /// <param name="originalDsmhMouth2">originalDsmhMouth2</param> /// <param name="originalDsmhMouth3">originalDsmhMouth3</param> /// <param name="originalDsmhMouth4">originalDsmhMouth4</param> /// <param name="originalDsmhMouth5">originalDsmhMouth5</param> /// <param name="originalDeleted">originalDeleted</param> /// <param name="originalCompanyId">originalCompanyId</param> /// <param name="originalUsmhAddress">originalUsmhAddress</param> /// <param name="originalDsmhAddress">originalDsmhAddress</param> /// <param name="originalThickness">originalThickness</param> /// /// <param name="newWorkId">newWorkId</param> /// <param name="newAssetId">newAssetId</param> /// <param name="newSectionId">newSectionId</param> /// <param name="newStreet">newStreet</param> /// <param name="newUsmhId">newUsmhId</param> /// <param name="newDsmhId">newDsmhId</param> /// <param name="newMapSize">newMapSize</param> /// <param name="newSize">newSize</param> /// <param name="newMapLength">newMapLength</param> /// <param name="newLength">newLength</param> /// <param name="newMapLength">newMapLength</param> /// <param name="newLaterals">newLaterals</param> /// <param name="newLiveLaterals">newLiveLaterals</param> /// <param name="newUsmhDepth">newUsmhDepth</param> /// <param name="newDsmhDepth">newDsmhDepth</param> /// <param name="newSteelTapeThroughSewer">newSteelTapeThroughSewer</param> /// <param name="newSubArea">newSubArea</param> /// <param name="newUsmhMouth12">newUsmhMouth12</param> /// <param name="newUsmhMouth1">newUsmhMouth1</param> /// <param name="newUsmhMouth2">newUsmhMouth2</param> /// <param name="newUsmhMouth3">newUsmhMouth3</param> /// <param name="newUsmhMouth4">newUsmhMouth4</param> /// <param name="newUsmhMouth5">newUsmhMouth5</param> /// <param name="newDsmhMouth12">newDsmhMouth12</param> /// <param name="newDsmhMouth1">newDsmhMouth1</param> /// <param name="newDsmhMouth2">newDsmhMouth2</param> /// <param name="newDsmhMouth3">newDsmhMouth3</param> /// <param name="newDsmhMouth4">newDsmhMouth4</param> /// <param name="newDsmhMouth5">newDsmhMouth5</param> /// <param name="newDeleted">newDeleted</param> /// <param name="newCompanyId">newCompanyId</param> /// <param name="newUsmhAddress">newUsmhAddress</param> /// <param name="newDsmhAddress">newDsmhAddress</param> /// <param name="newThickness">newThickness</param> private void Update(int projectId, Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int originalWorkId, int originalAssetId, string originalSectionId, string originalStreet, int? originalUsmh, string originalUsmhId, int? originalDsmh, string originalDsmhId, string originalMapSize, string originalSize, string originalMapLength, string originalLength, int? originalLaterals, int? originalLiveLaterals, string originalUsmhDepth, string originalDsmhDepth, string originalSteelTapeThroughSewer, string originalSubArea, string originalUsmhMouth12, string originalUsmhMouth1, string originalUsmhMouth2, string originalUsmhMouth3, string originalUsmhMouth4, string originalUsmhMouth5, string originalDsmhMouth12, string originalDsmhMouth1, string originalDsmhMouth2, string originalDsmhMouth3, string originalDsmhMouth4, string originalDsmhMouth5, bool originalDeleted, int originalCompanyId, string originalUsmhAddress, string originalDsmhAddress, string originalThickness, int newWorkId, int newAssetId, string newSectionId, string newStreet, string newUsmhId, string newDsmhId, string newMapSize, string newSize, string newMapLength, string newLength, int? newLaterals, int? newLiveLaterals, string newUsmhDepth, string newDsmhDepth, string newSteelTapeThroughSewer, string newSubArea, string newUsmhMouth12, string newUsmhMouth1, string newUsmhMouth2, string newUsmhMouth3, string newUsmhMouth4, string newUsmhMouth5, string newDsmhMouth12, string newDsmhMouth1, string newDsmhMouth2, string newDsmhMouth3, string newDsmhMouth4, string newDsmhMouth5, bool newDeleted, int newCompanyId, string newUsmhAddress, string newDsmhAddress, string newThickness) { // insert USMH if data change (only if not exists) int? newUsmh = originalUsmh; if (originalUsmhId != newUsmhId) { if (newUsmhId.Trim() != "") { LfsAssetSewerMH lfsAssetSewerUsmh = new LfsAssetSewerMH(null); newUsmh = lfsAssetSewerUsmh.InsertDirect(countryId, provinceId, countyId, cityId, newUsmhId, "", "", newUsmhAddress, false, originalCompanyId, "", "", null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", null, "", "", null); } else { newUsmh = null; } } else { // Update existing mh UpdateMH(countryId, provinceId, countyId, cityId, originalUsmhId, originalUsmhAddress, newUsmhAddress, originalCompanyId); } // insert DSMH if data change (only if not exists) int? newDsmh = originalDsmh; if (originalDsmhId != newDsmhId) { if (newDsmhId.Trim() != "") { LfsAssetSewerMH lfsAssetSewerDsmh = new LfsAssetSewerMH(null); newDsmh = lfsAssetSewerDsmh.InsertDirect(countryId, provinceId, countyId, cityId, newDsmhId, "", "", newDsmhAddress, false, originalCompanyId, "", "", null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", null, "", "", null); } else { newDsmh = null; } } else { // Update existing mh UpdateMH(countryId, provinceId, countyId, cityId, originalDsmhId, originalDsmhAddress, newDsmhAddress, originalCompanyId); } // update section UpdateSection(originalWorkId, originalAssetId, originalSectionId, originalStreet, originalUsmh, originalDsmh, originalMapSize, originalSize, originalMapLength, originalLength, originalLaterals, originalLiveLaterals, originalUsmhDepth, originalDsmhDepth, originalSteelTapeThroughSewer, originalSubArea, originalUsmhMouth12, originalUsmhMouth1, originalUsmhMouth2, originalUsmhMouth3, originalUsmhMouth4, originalUsmhMouth5, originalDsmhMouth12, originalDsmhMouth1, originalDsmhMouth2, originalDsmhMouth3, originalDsmhMouth4, originalDsmhMouth5, originalDeleted, originalCompanyId, originalUsmhAddress, originalDsmhAddress, originalThickness, newWorkId, newAssetId, newSectionId, newStreet, newUsmh, newDsmh, newMapSize, newSize, newMapLength, newLength, newLaterals, newLiveLaterals, newUsmhDepth, newDsmhDepth, newSteelTapeThroughSewer, newSubArea, newUsmhMouth12, newUsmhMouth1, newUsmhMouth2, newUsmhMouth3, newUsmhMouth4, newUsmhMouth5, newDsmhMouth12, newDsmhMouth1, newDsmhMouth2, newDsmhMouth3, newDsmhMouth4, newDsmhMouth5, newDeleted, newCompanyId, newUsmhAddress, newDsmhAddress, newThickness, projectId); }
/// <summary> /// UpdateDirect /// </summary> /// <param name="originalAssetId">originalAssetId</param> /// <param name="originalSectionId">originalSectionId</param> /// <param name="originalStreet">originalStreet</param> /// <param name="originalUsmh">originalUsmh</param> /// <param name="originalDsmh">originalDsmh</param> /// <param name="originalMapSize">originalMapSize</param> /// <param name="originalSize">originalSize</param> /// <param name="originalMapLength">originalMapLength</param> /// <param name="originalLength">originalLength</param> /// <param name="originalLaterals">originalLaterals</param> /// <param name="originalLiveLaterals">originalLiveLaterals</param> /// <param name="originalFlowDirection">originalFlowDirection</param> /// <param name="originalUsmhDepth">originalUsmhDepth</param> /// <param name="originalDsmhDepth">originalDsmhDepth</param> /// <param name="originalSteelTapeThroughSewer">originalSteelTapeThroughSewer</param> /// <param name="originalUsmhMouth12">originalUsmhMouth12</param> /// <param name="originalUsmhMouth1">originalUsmhMouth1</param> /// <param name="originalUsmhMouth2">originalUsmhMouth2</param> /// <param name="originalUsmhMouth3">originalUsmhMouth3</param> /// <param name="originalUsmhMouth4">originalUsmhMouth4</param> /// <param name="originalUsmhMouth5">originalUsmhMouth5</param> /// <param name="originalDsmhMouth12">originalDsmhMouth12</param> /// <param name="originalDsmhMouth1">originalDsmhMouth1</param> /// <param name="originalDsmhMouth2">originalDsmhMouth2</param> /// <param name="originalDsmhMouth3">originalDsmhMouth3</param> /// <param name="originalDsmhMouth4">originalDsmhMouth4</param> /// <param name="originalDsmhMouth5">originalDsmhMouth5</param> /// <param name="originalDeleted">originalDeleted</param> /// <param name="originalCompanyId">originalCompanyId</param> /// <param name="originalSubArea">originalSubArea</param> /// <param name="originalThickness">originalThickness</param> /// /// <param name="newAssetId">newAssetId</param> /// <param name="newSectionId">newSectionId</param> /// <param name="newStreet">newStreet</param> /// <param name="newUsmh">newUsmh</param> /// <param name="newDsmh">newDsmh</param> /// <param name="newMapSize">newMapSize</param> /// <param name="newSize">newSize</param> /// <param name="newMapLength">newMapLength</param> /// <param name="newLength">newLength</param> /// <param name="newLaterals">newLaterals</param> /// <param name="newLiveLaterals">newLiveLaterals</param> /// <param name="newFlowDirection">newFlowDirection</param> /// <param name="newUsmhDepth">newUsmhDepth</param> /// <param name="newDsmhDepth">newDsmhDepth</param> /// <param name="newSteelTapeThroughSewer">newSteelTapeThroughSewer</param> /// <param name="newUsmhMouth12">newUsmhMouth12</param> /// <param name="newUsmhMouth1">newUsmhMouth1</param> /// <param name="newUsmhMouth2">newUsmhMouth2</param> /// <param name="newUsmhMouth3">newUsmhMouth3</param> /// <param name="newUsmhMouth4">newUsmhMouth4</param> /// <param name="newUsmhMouth5">newUsmhMouth5</param> /// <param name="newDsmhMouth12">newDsmhMouth12</param> /// <param name="newDsmhMouth1">newDsmhMouth1</param> /// <param name="newDsmhMouth2">newDsmhMouth2</param> /// <param name="newDsmhMouth3">newDsmhMouth3</param> /// <param name="newDsmhMouth4">newDsmhMouth4</param> /// <param name="newDsmhMouth5">newDsmhMouth5</param> /// <param name="newDeleted">newDeleted</param> /// <param name="newCompanyId">newCompanyId</param> /// <param name="newSubArea">newSubArea</param> /// <param name="newThickness">newThickness</param> public void UpdateDirect(int originalAssetId, string originalSectionId, string originalStreet, int? originalUsmh, int? originalDsmh, string originalMapSize, string originalSize, string originalMapLength, string originalLength, int? originalLaterals, int? originalLiveLaterals, string originalFlowDirection, string originalUsmhDepth, string originalDsmhDepth, string originalSteelTapeThroughSewer, string originalUsmhMouth12, string originalUsmhMouth1, string originalUsmhMouth2, string originalUsmhMouth3, string originalUsmhMouth4, string originalUsmhMouth5, string originalDsmhMouth12, string originalDsmhMouth1, string originalDsmhMouth2, string originalDsmhMouth3, string originalDsmhMouth4, string originalDsmhMouth5, bool originalDeleted, int originalCompanyId, string originalSubArea, string originalThickness, int newAssetId, string newSectionId, string newStreet, int? newUsmh, int? newDsmh, string newMapSize, string newSize, string newMapLength, string newLength, int? newLaterals, int? newLiveLaterals, string newFlowDirection, string newUsmhDepth, string newDsmhDepth, string newSteelTapeThroughSewer, string newUsmhMouth12, string newUsmhMouth1, string newUsmhMouth2, string newUsmhMouth3, string newUsmhMouth4, string newUsmhMouth5, string newDsmhMouth12, string newDsmhMouth1, string newDsmhMouth2, string newDsmhMouth3, string newDsmhMouth4, string newDsmhMouth5, bool newDeleted, int newCompanyId, string newSubArea, string newThickness) { // update AM Section AssetSewerSection assetSewerSection = new AssetSewerSection(null); string originalFlowOrderId = ""; string newFlowOrderId = ""; // Verify sectionId string[] secuentialPart = originalSectionId.Split('-'); if (secuentialPart[1].Contains(".")) { // ... Flow order for intermediate section Id originalFlowOrderId = secuentialPart[1]; newFlowOrderId = secuentialPart[1]; } else { // ... Flow Order of section Id originalFlowOrderId = originalSectionId.Substring(originalSectionId.Length - 6, 6); newFlowOrderId = newSectionId.Substring(newSectionId.Length - 6, 6); } assetSewerSection.UpdateDirect(originalAssetId, originalSectionId, originalStreet, originalUsmh, originalDsmh, originalMapSize, originalSize, originalMapLength, originalLength, originalLaterals, originalLiveLaterals, originalFlowDirection, originalUsmhDepth, originalDsmhDepth, originalDeleted, originalCompanyId, originalFlowOrderId, newAssetId, newSectionId, newStreet, newUsmh, newDsmh, newMapSize, newSize, newMapLength, newLength, newLaterals, newLiveLaterals, newFlowDirection, newUsmhDepth, newDsmhDepth, newDeleted, newCompanyId, newFlowOrderId); // update LFS section if (originalLength != newLength) { newSteelTapeThroughSewer = newLength; } LfsAssetSewerSectionGateway lfsAssetSewerSectionGateway = new LfsAssetSewerSectionGateway(null); lfsAssetSewerSectionGateway.Update(originalAssetId, originalSteelTapeThroughSewer, originalUsmhMouth12, originalUsmhMouth1, originalUsmhMouth2, originalUsmhMouth3, originalUsmhMouth4, originalUsmhMouth5, originalDsmhMouth12, originalDsmhMouth1, originalDsmhMouth2, originalDsmhMouth3, originalDsmhMouth4, originalDsmhMouth5, originalDeleted, originalCompanyId, originalSubArea, originalThickness, newAssetId, newSteelTapeThroughSewer, newUsmhMouth12, newUsmhMouth1, newUsmhMouth2, newUsmhMouth3, newUsmhMouth4, newUsmhMouth5, newDsmhMouth12, newDsmhMouth1, newDsmhMouth2, newDsmhMouth3, newDsmhMouth4, newDsmhMouth5, newDeleted, newCompanyId, newSubArea, newThickness); // delete original usmh (if not in use) if ((newUsmh != originalUsmh) && (originalUsmh.HasValue)) { LfsAssetSewerMH lfsAssetSewerUsmh = new LfsAssetSewerMH(null); lfsAssetSewerUsmh.DeleteDirect((int)originalUsmh, originalCompanyId); } // delete original dsmh (if not in use) if ((newDsmh != originalDsmh) && (originalDsmh.HasValue)) { LfsAssetSewerMH lfsAssetSewerDsmh = new LfsAssetSewerMH(null); lfsAssetSewerDsmh.DeleteDirect((int)originalDsmh, originalCompanyId); } }
/// <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> /// 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(ProjectAddSectionsTDS.ProjectAddSectionsTempRow row, int projectId, Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int companyId) { string street = ""; if (!row.IsStreetNull()) street = row.Street; string usmh = ""; if (!row.IsUSMHNull()) usmh = row.USMH; string dsmh = ""; if (!row.IsDSMHNull()) dsmh = row.DSMH; string usmhStreet = ""; if (!row.IsUsmhStreetNull()) usmhStreet = row.UsmhStreet; string usmhLatitude = ""; if (!row.IsUsmhLatitudeNull()) usmhLatitude = row.UsmhLatitude; string usmhLongitude = ""; if (!row.IsUsmhLongitudeNull()) usmhLongitude = row.UsmhLongitude; string usmhShape = ""; if (!row.IsUsmhShapeNull()) usmhShape = row.UsmhShape; string usmhLocation = ""; if (!row.IsUsmhLocationNull()) usmhLocation = row.UsmhLocation; int? usmhConditionRating = null; if (!row.IsUsmhConditionRatingNull()) usmhConditionRating = row.UsmhConditionRating; int? usmhMaterialId = null; if (!row.IsUsmhMaterialIdNull()) usmhMaterialId = row.UsmhMaterialId; string usmhTopDiameter = ""; if (!row.IsUsmhTopDiameterNull()) usmhTopDiameter = row.UsmhTopDiameter; string usmhTopDepth = ""; if (!row.IsUsmhTopDepthNull()) usmhTopDepth = row.UsmhTopDepth; string usmhDownDiameter = ""; if (!row.IsUsmhDownDiameterNull()) usmhDownDiameter = row.UsmhDownDiameter; string usmhDownDepth = ""; if (!row.IsUsmhDownDepthNull()) usmhDownDepth = row.UsmhDownDepth; int? usmhManholeRugs = null; if (!row.IsUsmhManholeRugsNull()) usmhManholeRugs = row.UsmhManholeRugs; string usmhRectangle1LongSide = ""; if (!row.IsUsmhRectangle1LongSideNull()) usmhRectangle1LongSide = row.UsmhRectangle1LongSide; string usmhRectangle1ShortSide = ""; if (!row.IsUsmhRectangle1ShortSideNull()) usmhRectangle1ShortSide = row.UsmhRectangle1ShortSide; string usmhRectangle2LongSide = ""; if (!row.IsUsmhRectangle2LongSideNull()) usmhRectangle2LongSide = row.UsmhRectangle2LongSide; string usmhRectangle2ShortSide = ""; if (!row.IsUsmhRectangle2ShortSideNull()) usmhRectangle2ShortSide = row.UsmhRectangle2ShortSide; string usmhTotalSurfaceArea = ""; if (!row.IsUsmhTotalSurfaceAreaNull()) usmhTotalSurfaceArea = row.UsmhTotalSurfaceArea; string dsmhStreet = ""; if (!row.IsDsmhStreetNull()) dsmhStreet = row.DsmhStreet; string dsmhLatitude = ""; if (!row.IsDsmhLatitudeNull()) dsmhLatitude = row.DsmhLatitude; string dsmhLongitude = ""; if (!row.IsDsmhLongitudeNull()) dsmhLongitude = row.DsmhLongitude; string dsmhShape = ""; if (!row.IsDsmhShapeNull()) dsmhShape = row.DsmhShape; string dsmhLocation = ""; if (!row.IsDsmhLocationNull()) dsmhLocation = row.DsmhLocation; int? dsmhConditionRating = null; if (!row.IsDsmhConditionRatingNull()) dsmhConditionRating = row.DsmhConditionRating; int? dsmhMaterialId = null; if (!row.IsDsmhMaterialIdNull()) dsmhMaterialId = row.DsmhMaterialId; string dsmhTopDiameter = ""; if (!row.IsDsmhTopDiameterNull()) dsmhTopDiameter = row.DsmhTopDiameter; string dsmhTopDepth = ""; if (!row.IsDsmhTopDepthNull()) dsmhTopDepth = row.DsmhTopDepth; string dsmhDownDiameter = ""; if (!row.IsDsmhDownDiameterNull()) dsmhDownDiameter = row.DsmhDownDiameter; string dsmhDownDepth = ""; if (!row.IsDsmhDownDepthNull()) dsmhDownDepth = row.DsmhDownDepth; int? dsmhManholeRugs = null; if (!row.IsDsmhManholeRugsNull()) dsmhManholeRugs = row.DsmhManholeRugs; string dsmhRectangle1LongSide = ""; if (!row.IsDsmhRectangle1LongSideNull()) dsmhRectangle1LongSide = row.DsmhRectangle1LongSide; string dsmhRectangle1ShortSide = ""; if (!row.IsDsmhRectangle1ShortSideNull()) dsmhRectangle1ShortSide = row.DsmhRectangle1ShortSide; string dsmhRectangle2LongSide = ""; if (!row.IsDsmhRectangle2LongSideNull()) dsmhRectangle2LongSide = row.DsmhRectangle2LongSide; string dsmhRectangle2ShortSide = ""; if (!row.IsDsmhRectangle2ShortSideNull()) dsmhRectangle2ShortSide = row.DsmhRectangle2ShortSide; string dsmhTotalSurfaceArea = ""; if (!row.IsDsmhTotalSurfaceAreaNull()) dsmhTotalSurfaceArea = row.DsmhTotalSurfaceArea; // 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, usmhLatitude, usmhLongitude, usmhStreet, false, companyId, usmhShape, usmhLocation, usmhMaterialId, usmhTopDiameter, usmhTopDepth, "", "", "", usmhDownDiameter, usmhDownDepth, "", "", "", usmhRectangle1LongSide, usmhRectangle1ShortSide, usmhRectangle2LongSide, usmhRectangle2ShortSide, "", "", usmhManholeRugs, "", usmhTotalSurfaceArea, usmhConditionRating); // insert in LFS tables (only if not exists) AssetSewerMHGateway assetSewerMHGateway = new AssetSewerMHGateway(); if (!assetSewerMHGateway.IsUsedInMHProject(projectId, usmh_assetId.Value)) { AssetSewerMHGateway assetSewerMhGatewayForUSMH = new AssetSewerMHGateway(null); assetSewerMhGatewayForUSMH.InsertMHProject(usmh_assetId.Value, projectId, DateTime.Now, false, companyId); } if (row.MHRehabUsmh) { //TODO MH SaveMHRehabWork(projectId, usmh_assetId.Value, companyId); } } // 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, dsmhLatitude, dsmhLongitude, dsmhStreet, false, companyId, dsmhShape, dsmhLocation, dsmhMaterialId, dsmhTopDiameter, dsmhTopDepth, "", "", "", dsmhDownDiameter, dsmhDownDepth, "", "", "", dsmhRectangle1LongSide, dsmhRectangle1ShortSide, dsmhRectangle2LongSide, dsmhRectangle2ShortSide, "", "", dsmhManholeRugs, "", dsmhTotalSurfaceArea, dsmhConditionRating); // insert in LFS tables (only if not exists) AssetSewerMHGateway assetSewerMHGateway = new AssetSewerMHGateway(); if (!assetSewerMHGateway.IsUsedInMHProject(projectId, dsmh_assetId.Value)) { AssetSewerMHGateway assetSewerMhGatewayForDSMH = new AssetSewerMHGateway(null); assetSewerMhGatewayForDSMH.InsertMHProject(dsmh_assetId.Value, projectId, DateTime.Now, false, companyId); } if (row.MHRehabDsmh) { //TODO MH SaveMHRehabWork(projectId, dsmh_assetId.Value, companyId); } } // insert section LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(null); string mapSize = ""; if (!row.IsMapSizeNull()) mapSize = row.MapSize; string mapLength = ""; if (!row.IsMapLengthNull()) mapLength = row.MapLength; int sectionMaterialRefId = 1; // first material when adding new section string sectionMaterial = ""; if (!row.IsSectionMaterialNull()) sectionMaterial = row.SectionMaterial; DateTime sectionMaterialDate = DateTime.Now; int section_assetId = lfsAssetSewerSection.InsertDirect(countryId, provinceId, countyId, cityId, row.SectionID, street, usmh_assetId, dsmh_assetId, mapSize, "", mapLength, "", null, null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", false, companyId, "", "", sectionMaterialRefId, sectionMaterial, sectionMaterialDate); return section_assetId; }
/// <summary> ///Save /// </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="companyId">companyId</param> public void Save(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int companyId) { //Update Section ManholeRehabilitationTDS manholeChanges = (ManholeRehabilitationTDS)Data.GetChanges(); if (manholeChanges.ManholeDetails.Rows.Count > 0) { ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway = new ManholeRehabilitationManholeDetailsGateway(manholeChanges); // Update sections foreach (ManholeRehabilitationTDS.ManholeDetailsRow manholeDetailsRow in (ManholeRehabilitationTDS.ManholeDetailsDataTable)manholeChanges.ManholeDetails) { // Unchanged values int assetId = manholeDetailsRow.AssetID; string mhId = manholeDetailsRow.MHID; // Original values string originalLatitud = manholeRehabilitationManholeDetailsGateway.GetLatitudOriginal(assetId); string originalLongitude = manholeRehabilitationManholeDetailsGateway.GetLongitudeOriginal(assetId); string originalAddress = manholeRehabilitationManholeDetailsGateway.GetAddressOriginal(assetId); string originalManholeShape = manholeRehabilitationManholeDetailsGateway.GetManholeShapeOriginal(assetId); string originalLocation = manholeRehabilitationManholeDetailsGateway.GetLocationOriginal(assetId); int? originalMaterialID = manholeRehabilitationManholeDetailsGateway.GetMaterialIDOriginal(assetId); string originalTopDiameter = manholeRehabilitationManholeDetailsGateway.GetTopDiameterOriginal(assetId); string originalTopDepth = manholeRehabilitationManholeDetailsGateway.GetTopDepthOriginal(assetId); string originalTopFloor = manholeRehabilitationManholeDetailsGateway.GetTopFloorOriginal(assetId); string originalTopCeiling = manholeRehabilitationManholeDetailsGateway.GetTopCeilingOriginal(assetId); string originalTopBenching = manholeRehabilitationManholeDetailsGateway.GetTopBenchingOriginal(assetId); string originalDownDiameter = manholeRehabilitationManholeDetailsGateway.GetDownDiameterOriginal(assetId); string originalDownDepth = manholeRehabilitationManholeDetailsGateway.GetDownDepthOriginal(assetId); string originalDownFloor = manholeRehabilitationManholeDetailsGateway.GetDownFloorOriginal(assetId); string originalDownCeiling = manholeRehabilitationManholeDetailsGateway.GetDownCeilingOriginal(assetId); string originalDownBenching = manholeRehabilitationManholeDetailsGateway.GetDownBenchingOriginal(assetId); string originalRectangle1LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1LongSideOriginal(assetId); string originalRectangle1ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1ShortSideOriginal(assetId); string originalRectangle2LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSideOriginal(assetId); string originalRectangle2ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSideOriginal(assetId); string originalTopSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTopSurfaceAreaOriginal(assetId); string originalDownSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetDownSurfaceAreaOriginal(assetId); int? originalManholeRugs = manholeRehabilitationManholeDetailsGateway.GetManholeRugsOriginal(assetId); string originalTotalDepth = manholeRehabilitationManholeDetailsGateway.GetTotalDepthOriginal(assetId); string originalTotalSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceAreaOriginal(assetId); int? originalConditionRating = manholeRehabilitationManholeDetailsGateway.GetConditionRatingOriginal(assetId); // New variables string newLatitud = manholeRehabilitationManholeDetailsGateway.GetLatitud(assetId); string newLongitude = manholeRehabilitationManholeDetailsGateway.GetLongitude(assetId); string newAddress = manholeRehabilitationManholeDetailsGateway.GetAddress(assetId); string newManholeShape = manholeRehabilitationManholeDetailsGateway.GetManholeShape(assetId); string newLocation = manholeRehabilitationManholeDetailsGateway.GetLocation(assetId); int? newMaterialID = manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId); string newTopDiameter = manholeRehabilitationManholeDetailsGateway.GetTopDiameter(assetId); string newTopDepth = manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId); string newTopFloor = manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId); string newTopCeiling = manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId); string newTopBenching = manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId); string newDownDiameter = manholeRehabilitationManholeDetailsGateway.GetDownDiameter(assetId); string newDownDepth = manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId); string newDownFloor = manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId); string newDownCeiling = manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId); string newDownBenching = manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId); string newRectangle1LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1LongSide(assetId); string newRectangle1ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1ShortSide(assetId); string newRectangle2LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSide(assetId); string newRectangle2ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSide(assetId); string newTopSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId); string newDownSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId); int? newManholeRugs = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId); string newTotalDepth = manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId); string newTotalSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId); int? newConditionRating = manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId); // Update AssetSewerMHGateway assetSewerMHGateway = new AssetSewerMHGateway(); assetSewerMHGateway.LoadByAssetId(assetId, companyId); if (assetSewerMHGateway.Table.Rows.Count > 0) { // ... update asset manhole AssetSewerMH assetSewerMH = new AssetSewerMH(assetSewerMHGateway.Data); assetSewerMH.UpdateDirect(assetId, mhId, originalLatitud, originalLongitude, originalAddress, originalManholeShape, originalLocation, originalMaterialID, originalTopDiameter, originalTopDepth, originalTopFloor, originalTopCeiling, originalTopBenching, originalDownDiameter, originalDownDepth, originalDownFloor, originalDownCeiling, originalDownBenching, originalRectangle1LongSide, originalRectangle1ShortSide, originalRectangle2LongSide, originalRectangle2ShortSide, originalTopSurfaceArea, originalDownSurfaceArea, originalManholeRugs, originalTotalDepth, originalTotalSurfaceArea, false, companyId, assetId, mhId, newLatitud, newLongitude, newAddress, newManholeShape, newLocation, newMaterialID, newTopDiameter, newTopDepth, newTopFloor, newTopCeiling, newTopBenching, newDownDiameter, newDownDepth, newDownFloor, newDownCeiling, newDownBenching, newRectangle1LongSide, newRectangle1ShortSide, newRectangle2LongSide, newRectangle2ShortSide, newTopSurfaceArea, newDownSurfaceArea, newManholeRugs, newTotalDepth, newTotalSurfaceArea, false, companyId); // ... update lfs manhole LfsAssetSewerMH lfsAssetSewerMH = new LfsAssetSewerMH(null); lfsAssetSewerMH.UpdateDirect(assetId, false, companyId, originalConditionRating, false, companyId, newConditionRating); } } } }
/// <summary> /// Save all manhole to database (direct) /// </summary> /// <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> public void Save(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int companyId, int projectId) { AddManholeTDS mrManholesAddChanges = (AddManholeTDS)Data.GetChanges(); if (mrManholesAddChanges.AddManholeNew.Rows.Count > 0) { AddManholeNewGateway addManholeNewGateway = new AddManholeNewGateway(mrManholesAddChanges); foreach (AddManholeTDS.AddManholeNewRow row in (AddManholeTDS.AddManholeNewDataTable)mrManholesAddChanges.AddManholeNew) { // Insert new manhole if ((!row.Deleted) && (!row.InDatabase)) { // ... Insert manhole int? manholeRugs = null; if (!row.IsManholeRugsNull()) manholeRugs = row.ManholeRugs; int? conditionRating = null; if (!row.IsConditionRatingNull()) conditionRating = row.ConditionRating; int? materialId = null; if (!row.IsMaterialIDNull()) materialId = row.MaterialID; LfsAssetSewerMH lfsAssetSewerMH = new LfsAssetSewerMH(); int assetId = lfsAssetSewerMH.InsertDirect(countryId, provinceId, countyId, cityId, row.MHID, row.Latitud, row.Longitude, row.Address, row.Deleted, companyId, row.ManholeShape, row.Location, materialId, row.TopDiameter, row.TopDepth, row.TopFloor, row.TopCeiling, row.TopBenching, row.DownDiameter, row.DownDepth, row.DownFloor, row.DownCeiling, row.DownBenching, row.Rectangle1LongSide, row.Rectangle1ShortSide, row.Rectangle2LongSide, row.Rectangle2ShortSide, row.TopSurfaceArea, row.DownSurfaceArea, manholeRugs, row.TotalDepth, row.TotalSurfaceArea, conditionRating); // insert in LFS tables (only if not exists) AssetSewerMHGateway assetSewerMHGateway = new AssetSewerMHGateway(); if (!assetSewerMHGateway.IsUsedInMHProject(projectId, assetId)) { AssetSewerMHGateway assetSewerMhGateway = new AssetSewerMHGateway(null); assetSewerMhGateway.InsertMHProject(assetId, projectId, DateTime.Now, false, companyId); } } } } }
private void UpdateDatabase() { // Get ids int workId = Int32.Parse(hdfWorkId.Value); int assetId = Int32.Parse(hdfAssetId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); // Delete DB.Open(); DB.BeginTransaction(); try { LfsAssetSewerMH lfsAssetSewerMH = new LfsAssetSewerMH(); lfsAssetSewerMH.DeleteDirect(assetId, companyId); ManholeRehabilitationWorkDetails manholeRehabilitationWorkDetails = new ManholeRehabilitationWorkDetails(manholeRehabilitationTDS); manholeRehabilitationWorkDetails.DeleteDirect(workId, companyId); DB.CommitTransaction(); // Store datasets Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
/// <summary> /// Update /// </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="workId">workId</param> /// <param name="assetId">assetId</param> /// <param name="sectionId">sectionId</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="originalUsmh">originalUsmh</param> /// <param name="originalUsmhId">originalUsmhId</param> /// <param name="originalDsmh">originalDsmh</param> /// <param name="originalDsmhId">originalDsmhId</param> /// <param name="originalStreet">originalStreet</param> /// <param name="originalSize_">originalSize_</param> /// <param name="originalLength">originalLength</param> /// <param name="originalSubArea">originalSubArea</param> /// <param name="originalTrafficControl">originalTrafficControl</param> /// <param name="originalTrafficControlDetails">originalTrafficControlDetails</param> /// <param name="originalStandardBypass">originalStandardBypass</param> /// <param name="originalStandardBypassComments">originalStandardBypassComments</param> /// <param name="availableToLine">availableToLine</param> /// /// <param name="newUsmhId">newUsmhId</param> /// <param name="newDsmhId">newDsmhId</param> /// <param name="newStreet">newStreet</param> /// <param name="newSize_">newSize_</param> /// <param name="newLength">newLength</param> /// <param name="newSubArea">newSubArea</param> /// <param name="newTrafficControl">newTrafficControl</param> /// <param name="newTrafficControlDetails">newTrafficControlDetails</param> /// <param name="newStandardBypass">newStandardBypass</param> /// <param name="newStandardBypassComments">newStandardBypassComments</param> /// <param name="companyId">companyId</param> private void Update(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int workId, int assetId, string sectionId, int numLats, int notLinedYet, bool allMeasured, string issueWithLaterals, int notMeasuredYet, int notDeliveredYet, int? originalUsmh, string originalUsmhId, int? originalDsmh, string originalDsmhId, string originalStreet, string originalSize_, string originalLength, string originalSubArea, string originalTrafficControl, string originalTrafficControlDetails, bool originalStandardBypass, string originalStandardBypassComments, int availableToLine, string newUsmhId, string newDsmhId, string newStreet, string newSize_, string newLength, string newSubArea, string newTrafficControl, string newTrafficControlDetails, bool newStandardBypass, string newStandardBypassComments, int companyId) { // insert USMH if data change (only if not exists) int? newUsmh = originalUsmh; if (originalUsmhId != newUsmhId) { if (newUsmhId.Trim() != "") { LfsAssetSewerMH lfsAssetSewerUsmh = new LfsAssetSewerMH(null); newUsmh = lfsAssetSewerUsmh.InsertDirect(countryId, provinceId, countyId, cityId, newUsmhId, "", "", "", false, companyId, "", "", null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", null, "", "", null); } else { newUsmh = null; } } // insert DSMH if data change (only if not exists) int? newDsmh = originalDsmh; if (originalDsmhId != newDsmhId) { if (newDsmhId.Trim() != "") { LfsAssetSewerMH lfsAssetSewerDsmh = new LfsAssetSewerMH(null); newDsmh = lfsAssetSewerDsmh.InsertDirect(countryId, provinceId, countyId, cityId, newDsmhId, "", "", "", false, companyId, "", "", null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", null, "", "", null); } else { newDsmh = null; } } // update section UpdateSection(countryId, provinceId, countyId, cityId, assetId, sectionId, originalStreet, originalUsmh, originalDsmh, originalSize_, originalLength, originalSubArea, newStreet, newUsmh, newDsmh, newSize_, newLength, newSubArea, companyId, projectId, workId); // update work UpdateWork(workId, numLats, notLinedYet, allMeasured, issueWithLaterals, notMeasuredYet, notDeliveredYet, originalTrafficControl, originalTrafficControlDetails, originalStandardBypass, originalStandardBypassComments, availableToLine, newTrafficControl, newTrafficControlDetails, newStandardBypass, newStandardBypassComments, companyId, availableToLine); // update fll work UpdateFllWork(assetId, projectId, originalTrafficControl, originalTrafficControlDetails, originalStandardBypass, originalStandardBypassComments, newTrafficControl, newTrafficControlDetails, newStandardBypass, newStandardBypassComments, companyId); }
/// <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(BulkUploadTDS.BulkUploadRow 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 mapLength = ""; if (!row.IsMapLengthNull()) mapLength = row.MapLength; string actualLength = ""; if (!row.IsActualLengthNull()) actualLength = row.ActualLength; string mapSize = ""; if (!row.IsMapSizeNull()) mapSize = row.MapSize; string confirmedSize = ""; if (!row.IsConfirmedSizeNull()) confirmedSize = row.ConfirmedSize; string 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, "", "", "", 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, "", "", "", false, companyId, "", "", null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", null, "", "", null); } // insert section LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(null); int section_assetId = lfsAssetSewerSection.InsertDirect(countryId, provinceId, countyId, cityId, row.ID, street, usmh_assetId, dsmh_assetId, mapSize, confirmedSize, mapLength, actualLength, null, null, "", "", "", "", "", actualLength, "", "", "", "", "", "", "", "", "", "", "", "", false, companyId, subArea, thickness, -1, "", DateTime.Now); return section_assetId; }