Added PostalCodeFormat (per db0008) to Country

This commit is contained in:
Rick Falkvinge
2014-12-21 21:17:53 +01:00
parent f156549f84
commit d058fbdd3b
2 changed files with 8 additions and 5 deletions
+5 -3
View File
@@ -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
{
+3 -2
View File
@@ -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