From 0a88f415b6912ad956ec3a92a85a01806c4ed61c Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 5 May 2014 08:31:21 +0000 Subject: [PATCH] Committing work to test live --- Logic/Financial/ExternalBankData.cs | 9 ++++--- .../v5/Ledgers/Json-ResyncPreview.aspx.cs | 8 +++++- .../v5/Ledgers/ResyncExternalAccount.aspx.cs | 25 ++++++++++++------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Logic/Financial/ExternalBankData.cs b/Logic/Financial/ExternalBankData.cs index 454fff52..f512fee2 100644 --- a/Logic/Financial/ExternalBankData.cs +++ b/Logic/Financial/ExternalBankData.cs @@ -285,7 +285,7 @@ namespace Swarmops.Logic.Financial this.Description = string.Empty; this.MasterCents = new long[0]; this.SwarmopsCents = new long[0]; - this.TransactionDependencies = new object[0]; + // this.TransactionDependencies = new object[0]; this.ResyncActions = new ExternalBankMismatchResyncAction[0]; } @@ -293,7 +293,8 @@ namespace Swarmops.Logic.Financial public long[] MasterCents; // may have multiple txs with this description public long[] SwarmopsCents; // may have multiple txs with this description public ExternalBankMismatchResyncAction[] ResyncActions; - public object[] TransactionDependencies; // matching the Swarmops array + // public object[] TransactionDependencies; // matching the Swarmops array + public FinancialTransaction[] Transactions; // matching the Swarmops array } public class ExternalBankMismatchConstruction @@ -313,11 +314,11 @@ namespace Swarmops.Logic.Financial public ExternalBankMismatchingRecordConstruction() { Cents = new List(); - Dependencies = new List(); + this.Transactions = new List(); } public List Cents; - public List Dependencies; + public List Transactions; } public enum ExternalBankMismatchResyncAction diff --git a/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs b/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs index b9e544f0..d039b6c8 100644 --- a/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs +++ b/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs @@ -52,7 +52,13 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers for (int masterIndex = 0; masterIndex < mismatchingRecord.MasterCents.Count(); masterIndex++) { string dependencyString = string.Empty; - object dependency = mismatchingRecord.TransactionDependencies[masterIndex]; + FinancialTransaction transaction = mismatchingRecord.Transactions[masterIndex]; + object dependency = null; + + if (transaction != null) + { + dependency = transaction.Dependency; + } if (dependency != null) { diff --git a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs index 34332645..b8c32ee8 100644 --- a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs +++ b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs @@ -284,7 +284,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers } mismatchConstruction.Master[description].Cents.Add(externalData.Records[innerRecordIndex].TransactionNetCents); - mismatchConstruction.Master[description].Dependencies.Add(null); // no dependencies on the master side, only on swarmops side + mismatchConstruction.Master[description].Transactions.Add(null); // no dependencies on the master side, only on swarmops side } // Load from Swarmops @@ -314,7 +314,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers } mismatchConstruction.Swarmops[description].Cents.Add(transaction [account]); - mismatchConstruction.Swarmops[description].Dependencies.Add(transaction.Dependency); + mismatchConstruction.Swarmops[description].Transactions.Add(transaction); } // Then, parse the intermediate construction object to the presentation-and-action object. @@ -341,6 +341,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers List masterCentsList = new List(); List swarmopsCentsList = new List(); List dependenciesList = new List(); + List transactionsList = new List(); List actionsList = new List(); // STEP 1 - locate all identical matches @@ -372,8 +373,10 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers swarmopsCentsList.Add( mismatchConstruction.Swarmops[masterKey].Cents[swarmopsIndex]); // should be equal, we're defensive here + transactionsList.Add( + mismatchConstruction.Swarmops[masterKey].Transactions[swarmopsIndex]); dependenciesList.Add( - mismatchConstruction.Swarmops[masterKey].Dependencies[swarmopsIndex]); + mismatchConstruction.Swarmops[masterKey].Transactions[swarmopsIndex].Dependency); actionsList.Add(ExternalBankMismatchResyncAction.NoAction); checkMasterIndex[masterIndex] = true; @@ -411,7 +414,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers masterCentsList.Add(findMasterCents); swarmopsCentsList.Add(mismatchConstruction.Swarmops[masterKey].Cents[swarmopsIndex]); - dependenciesList.Add(mismatchConstruction.Swarmops[masterKey].Dependencies[swarmopsIndex]); + dependenciesList.Add(mismatchConstruction.Swarmops[masterKey].Transactions[swarmopsIndex].Dependency); + transactionsList.Add(mismatchConstruction.Swarmops[masterKey].Transactions[swarmopsIndex]); actionsList.Add(ExternalBankMismatchResyncAction.RewriteSwarmops); checkMasterIndex[masterIndex] = true; @@ -436,6 +440,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers masterCentsList.Add(mismatchConstruction.Master[masterKey].Cents[masterIndex]); swarmopsCentsList.Add(0); // null equivalent; invalid value dependenciesList.Add(null); + transactionsList.Add(null); actionsList.Add(ExternalBankMismatchResyncAction.CreateSwarmops); checkMasterIndex[masterIndex] = true; @@ -455,11 +460,12 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers masterCentsList.Add(0); // null equivalent; invalid value swarmopsCentsList.Add(mismatchConstruction.Swarmops[masterKey].Cents[swarmopsIndex]); + transactionsList.Add(mismatchConstruction.Swarmops[masterKey].Transactions[swarmopsIndex]); - if (mismatchConstruction.Swarmops[masterKey].Dependencies[swarmopsIndex] != null) + if (mismatchConstruction.Swarmops[masterKey].Transactions[swarmopsIndex].Dependency != null) { dependenciesList.Add( - mismatchConstruction.Swarmops[masterKey].Dependencies[swarmopsIndex]); + mismatchConstruction.Swarmops[masterKey].Transactions[swarmopsIndex].Dependency); actionsList.Add(ExternalBankMismatchResyncAction.ManualAction); // can't auto } else @@ -475,7 +481,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers newRecord.MasterCents = masterCentsList.ToArray(); newRecord.SwarmopsCents = swarmopsCentsList.ToArray(); newRecord.ResyncActions = actionsList.ToArray(); - newRecord.TransactionDependencies = dependenciesList.ToArray(); + // newRecord.TransactionDependencies = dependenciesList.ToArray(); + newRecord.Transactions = transactionsList.ToArray(); mismatchingRecordList[masterKey] = newRecord; } @@ -491,8 +498,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers mismatchingRecordList[swarmopsKey].SwarmopsCents = mismatchConstruction.Swarmops[swarmopsKey].Cents.ToArray(); - mismatchingRecordList[swarmopsKey].TransactionDependencies = - mismatchConstruction.Swarmops[swarmopsKey].Dependencies.ToArray(); + mismatchingRecordList[swarmopsKey].Transactions = + mismatchConstruction.Swarmops[swarmopsKey].Transactions.ToArray(); mismatchingRecordList[swarmopsKey].MasterCents = new long[mismatchConstruction.Swarmops[swarmopsKey].Cents.Count]; // inits to zero