diff --git a/Basic/Types/BasicCountry.cs b/Basic/Types/BasicCountry.cs
index f11bf2db..d1da2151 100644
--- a/Basic/Types/BasicCountry.cs
+++ b/Basic/Types/BasicCountry.cs
@@ -13,21 +13,17 @@ namespace Swarmops.Basic.Types
this.Code = code;
}
- public BasicCountry (int countryId, string name, string code, string defaultCulture)
+ public BasicCountry (int countryId, string name, string code, string defaultCulture, string currencyCode, int geographyId, int postalCodeLength)
: this(countryId, name, code)
{
this.Culture = defaultCulture;
- }
-
- public BasicCountry (int countryId, string name, string code, string defaultCulture, int geographyId, int postalCodeLength)
- : this(countryId, name, code, defaultCulture)
- {
+ this.CurrencyCode = currencyCode;
this.GeographyId = geographyId;
this.PostalCodeLength = postalCodeLength;
}
public BasicCountry (BasicCountry original)
- : this(original.CountryId, original.Name, original.Code, original.Culture, original.GeographyId, original.PostalCodeLength )
+ : this(original.CountryId, original.Name, original.Code, original.Culture, original.CurrencyCode, original.GeographyId, original.PostalCodeLength )
{
}
@@ -41,6 +37,7 @@ namespace Swarmops.Basic.Types
public string Name { get; protected set; }
public string Code { get; protected set; }
public string Culture { get; protected set; }
+ public string CurrencyCode { get; protected set; }
public int GeographyId { get; protected set; }
public int PostalCodeLength { get; protected set; }
diff --git a/Database/Configuration.cs b/Database/Configuration.cs
index 3584997f..ac866296 100644
--- a/Database/Configuration.cs
+++ b/Database/Configuration.cs
@@ -8,9 +8,17 @@ namespace Swarmops.Database
{
public partial class SwarmDb
{
- // This class is in horrible need of serious refactoring. For its simplicity in task, it's a horrible bowl of spaghetti.
+ ///
+ /// This is the IN-CODE revision of the database. The version we expect to be running against.
+ ///
+ public static int DbVersionExpected
+ {
+ get { return 5; }
+ }
+ // This class is in horrible need of serious refactoring. For its simplicity in task, it's a horrible bowl of spaghetti.
+
[Serializable]
public class Configuration
{
diff --git a/Database/Database-Constructors.cs b/Database/Database-Constructors.cs
index 244381d0..8eb0d3dd 100644
--- a/Database/Database-Constructors.cs
+++ b/Database/Database-Constructors.cs
@@ -66,15 +66,6 @@ namespace Swarmops.Database
}
}
- ///
- /// This is the IN-CODE revision of the database. The version we expect to be running against.
- ///
- public static int DbVersionExpected
- {
- get { return 4; }
- }
-
-
[Obsolete ("Do not use. Use SwarmDb.GetDatabaseForReading(), ...ForWriting() or ...ForAdmin().", true)]
public static SwarmDb GetDatabase()
{
diff --git a/Database/Database-Countries.cs b/Database/Database-Countries.cs
index 103b4c0d..20b22c33 100644
--- a/Database/Database-Countries.cs
+++ b/Database/Database-Countries.cs
@@ -10,8 +10,8 @@ namespace Swarmops.Database
{
#region Field reading code
- private const string countryFieldSequence = " CountryId,Name,Code,Culture,GeographyId," + // 0-4
- "PostalCodeLEngth FROM Countries ";
+ private const string countryFieldSequence = " CountryId,Name,Code,Culture,CurrencyCode," + // 0-4
+ "GeographyId,PostalCodeLength FROM Countries "; // 5-6
private static BasicCountry ReadCountryFromDataReader(DbDataReader reader)
@@ -20,10 +20,11 @@ namespace Swarmops.Database
string name = reader.GetString(1);
string code = reader.GetString(2).ToUpperInvariant();
string culture = reader.GetString(3);
- int geographyId = reader.GetInt32(4);
- int postalCodeLength = reader.GetInt32(5);
+ string currencyCode = reader.GetString(4);
+ int geographyId = reader.GetInt32(5);
+ int postalCodeLength = reader.GetInt32(6);
- return new BasicCountry(countryId, name, code, culture, geographyId, postalCodeLength);
+ return new BasicCountry(countryId, name, code, culture, currencyCode, geographyId, postalCodeLength);
}
#endregion
diff --git a/Database/Schemata/revisions.txt b/Database/Schemata/revisions.txt
index f9ae51a8..4531a128 100644
--- a/Database/Schemata/revisions.txt
+++ b/Database/Schemata/revisions.txt
@@ -2,4 +2,4 @@
0002 - Added functions for account plan maintenance and back/forward links to FinancialAccounts, Rick Falkvinge
0003 - Added 'Year' field for salary tax data, Rick Falkvinge
0004 - Added BankProfile tables and stored procs to insert/update, Rick Falkvinge
-
+0005 - Changed PostalCodeLength for NO DK to 4; for GH to zero; added Country.Currency
diff --git a/Database/Schemata/upgrade-0005.sql b/Database/Schemata/upgrade-0005.sql
new file mode 100644
index 00000000..81f76fea
--- /dev/null
+++ b/Database/Schemata/upgrade-0005.sql
@@ -0,0 +1,29 @@
+UPDATE `Countries` SET `PostalCodeLength`='4' WHERE `Code`='DK'
+
+#
+
+UPDATE `Countries` SET `PostalCodeLength`='4' WHERE `Code`='NO'
+
+#
+
+UPDATE `Countries` SET `PostalCodeLength`='0' WHERE `Code`='GH'
+
+#
+
+ALTER TABLE `Countries` ADD COLUMN `CurrencyCode` VARCHAR(8) NOT NULL DEFAULT '' AFTER `Culture`;
+
+#
+
+UPDATE `Countries` SET `CurrencyCode`='SEK' WHERE `Code`='SE'
+
+#
+
+UPDATE `Countries` SET `CurrencyCode`='DKK' WHERE `Code`='DK'
+
+#
+
+UPDATE `Countries` SET `CurrencyCode`='NOK' WHERE `Code`='NO'
+
+#
+
+UPDATE `Countries` SET `CurrencyCode`='EUR' WHERE `Code`='FI'