From 0ee0a70aa3b6d34e463f2ef0be1001cee44e013c Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Tue, 21 Oct 2014 13:34:23 +0200 Subject: [PATCH] Ugly hack to let pilot import bank data --- Logic/Financial/FinancialAccount.cs | 26 +++++++++++-------- Logic/Structure/Organization.cs | 9 ++++++- Logic/Support/PilotInstallationIds.cs | 3 +++ Site5/Automation/Json-ByGuid.aspx.cs | 11 +++++++- .../Pages/v5/Ledgers/UploadBankFiles.aspx.cs | 1 + 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index e7f80bbc..152a38d1 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -196,20 +196,24 @@ namespace Swarmops.Logic.Financial { // HACK HACK HACK HACK HACK for our pilots; this will be softcoded later TODO - if (this.OrganizationId != 1 || !PilotInstallationIds.IsPilot(PilotInstallationIds.PiratePartySE)) + if (this.OrganizationId == 1 && PilotInstallationIds.IsPilot(PilotInstallationIds.PiratePartySE)) { - return null; + switch (this.FinancialAccountId) + { + case 1: + return ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.SESebId); + case 2: + return ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.PaypalId); + default: + return null; + } + } + else if (this.OrganizationId == 7 && PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) && this.FinancialAccountId == 29) + { + return ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.SESebId); } - switch (this.FinancialAccountId) - { - case 1: - return ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.SESebId); - case 2: - return ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.PaypalId); - default: - return null; - } + return null; } } diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 1918225b..8484e36f 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -169,7 +169,7 @@ namespace Swarmops.Logic.Structure OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, 2009); year = 2009; } - else if (this.Identity == 2 && this.Name.StartsWith("Europirate Acad")) + else if (this.Identity == 7 && this.Name.StartsWith("Europirate Acad")) { OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, 2012); year = 2012; @@ -809,6 +809,13 @@ namespace Swarmops.Logic.Structure return result; } + else if (PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) && this.OrganizationId == 7) + { + FinancialAccounts result = new FinancialAccounts(); + result.Add(FinancialAccount.FromIdentity(29)); + + return result; + } throw new NotImplementedException(); } diff --git a/Logic/Support/PilotInstallationIds.cs b/Logic/Support/PilotInstallationIds.cs index cd114575..40f6e7ac 100644 --- a/Logic/Support/PilotInstallationIds.cs +++ b/Logic/Support/PilotInstallationIds.cs @@ -8,6 +8,9 @@ static public string DevelopmentSandbox { get { return "a8187d16-d913-4ddc-a3d5-214f7c14aac5"; } } + static public string SwarmopsLive + { get { return "db8f4ade-07f2-4f4f-a1c7-c9da91f93ea9"; }} + static public bool IsPilot(string installationId) { string thisInstallationId = Persistence.Key["SwarmopsInstallationId"]; diff --git a/Site5/Automation/Json-ByGuid.aspx.cs b/Site5/Automation/Json-ByGuid.aspx.cs index 99bb44cf..83134ef4 100644 --- a/Site5/Automation/Json-ByGuid.aspx.cs +++ b/Site5/Automation/Json-ByGuid.aspx.cs @@ -14,7 +14,16 @@ namespace Swarmops.Frontend.Automation [WebMethod] static public int GetProgress(string guid) { - return (int) GuidCache.Get(guid + "-Progress"); // suffix because guid may refer to other data too + object progressObject = GuidCache.Get(guid + "-Progress"); // suffix because guid may refer to other data too + + if (progressObject != null) + { + return (int) progressObject; + } + + // if the progress object doesn't exist, assume it hasn't been initialized yet + + return 0; } } } \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs index 7408fe8b..299f8743 100644 --- a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs +++ b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs @@ -240,6 +240,7 @@ namespace Swarmops.Site.Pages.Ledgers case 0: return string.Empty; case 1: + case 29: return "(Instruct Stock-SE-SEB)"; case 2: return "(Instruct Stock-Global-Paypal)";