// //////////////////////////////////////////////////////////////////////// // PRIVATE METHODS // /// <summary> /// GetSectionNextId /// </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> /// <returns>nextSectionId</returns> private string GetSectionNextId(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int companyId) { string nextSectionId = ""; // Locations string string location = ""; if (!countryId.HasValue) location = location + "0."; else location = location + countryId.ToString() + "."; if (!provinceId.HasValue) location = location + "0."; else location = location + provinceId.ToString() + "."; if (!countyId.HasValue) location = location + "0."; else location = location + countyId.ToString() + "."; if (!cityId.HasValue) location = location + "0"; else location = location + cityId.ToString(); location = location + "-"; // AutoIncrement part // ... load lastSectionId AssetSewerSectionGateway assetSewerSectionGateway = new AssetSewerSectionGateway(); string lastSectionId = ""; if (assetSewerSectionGateway.GetLastSectionId(countryId, provinceId, countyId, cityId, companyId) != "") { lastSectionId = assetSewerSectionGateway.GetLastSectionId(countryId, provinceId, countyId, cityId, companyId); } // ... Get next secuential number string newSecuentialNumber = ""; int lastSectionId_ = 0; // ... If there is a last section id if (lastSectionId != "") { string[] lastSectionIdSplit = lastSectionId.Split('-'); if (lastSectionIdSplit.Length >= 2) { lastSectionId_ = Int32.Parse(lastSectionIdSplit[1]); } } newSecuentialNumber = GetSectionIncrement(lastSectionId_); // next sectionId nextSectionId = location + newSecuentialNumber; return nextSectionId; }