Added Country.CurrencyCode in db
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
@@ -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.
|
||||
/// <summary>
|
||||
/// This is the IN-CODE revision of the database. The version we expect to be running against.
|
||||
/// </summary>
|
||||
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
|
||||
{
|
||||
|
||||
@@ -66,15 +66,6 @@ namespace Swarmops.Database
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the IN-CODE revision of the database. The version we expect to be running against.
|
||||
/// </summary>
|
||||
public static int DbVersionExpected
|
||||
{
|
||||
get { return 4; }
|
||||
}
|
||||
|
||||
|
||||
[Obsolete ("Do not use. Use SwarmDb.GetDatabaseForReading(), ...ForWriting() or ...ForAdmin().", true)]
|
||||
public static SwarmDb GetDatabase()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
Reference in New Issue
Block a user