From d058fbdd3bfed7d9edfd6b5043ec5a1e4b630da5 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 21 Dec 2014 21:17:53 +0100 Subject: [PATCH] Added PostalCodeFormat (per db0008) to Country --- Basic/Types/Structure/BasicCountry.cs | 8 +++++--- Database/Database-Countries.cs | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Basic/Types/Structure/BasicCountry.cs b/Basic/Types/Structure/BasicCountry.cs index ac838bdb..b43a115e 100644 --- a/Basic/Types/Structure/BasicCountry.cs +++ b/Basic/Types/Structure/BasicCountry.cs @@ -14,19 +14,20 @@ namespace Swarmops.Basic.Types.Structure } public BasicCountry (int countryId, string name, string code, string defaultCulture, string currencyCode, - int geographyId, int postalCodeLength) + int geographyId, int postalCodeLength, string postalCodeFormat) : this (countryId, name, code) { this.Culture = defaultCulture; this.CurrencyCode = currencyCode; this.GeographyId = geographyId; this.PostalCodeLength = postalCodeLength; + this.PostalCodeFormat = postalCodeFormat; } public BasicCountry (BasicCountry original) : this ( original.CountryId, original.Name, original.Code, original.Culture, original.CurrencyCode, - original.GeographyId, original.PostalCodeLength) + original.GeographyId, original.PostalCodeLength, original.PostalCodeFormat) { } @@ -39,10 +40,11 @@ namespace Swarmops.Basic.Types.Structure public int CountryId { get; private set; } public string Name { get; protected set; } public string Code { get; protected set; } - public string Culture { get; protected set; } + public string Culture { get; protected set; } // may be overridden at geography level (multilinguality etc.) public string CurrencyCode { get; protected set; } public int GeographyId { get; protected set; } public int PostalCodeLength { get; protected set; } + public string PostalCodeFormat { get; protected set; } public int CurrencyId { diff --git a/Database/Database-Countries.cs b/Database/Database-Countries.cs index 22f8f77a..74a4df18 100644 --- a/Database/Database-Countries.cs +++ b/Database/Database-Countries.cs @@ -12,7 +12,7 @@ namespace Swarmops.Database #region Field reading code private const string countryFieldSequence = " CountryId,Name,Code,Culture,CurrencyCode," + // 0-4 - "GeographyId,PostalCodeLength FROM Countries "; // 5-6 + "GeographyId,PostalCodeLength,PostalCodeFormat FROM Countries "; // 5-7 private static BasicCountry ReadCountryFromDataReader (DbDataReader reader) @@ -24,8 +24,9 @@ namespace Swarmops.Database string currencyCode = reader.GetString (4); int geographyId = reader.GetInt32 (5); int postalCodeLength = reader.GetInt32 (6); + string postalCodeFormat = reader.GetString (7); - return new BasicCountry (countryId, name, code, culture, currencyCode, geographyId, postalCodeLength); + return new BasicCountry (countryId, name, code, culture, currencyCode, geographyId, postalCodeLength, postalCodeFormat); } #endregion