diff --git a/Logic/Financial/ExternalBankDataProfile.cs b/Logic/Financial/ExternalBankDataProfile.cs index 8f7fd2a7..52537aa2 100644 --- a/Logic/Financial/ExternalBankDataProfile.cs +++ b/Logic/Financial/ExternalBankDataProfile.cs @@ -13,6 +13,27 @@ namespace Swarmops.Logic.Financial this.FieldNames = new Dictionary(); } + public string DateTimeFormatString + { + get + { + switch (Precision) + { + case ExternalBankDateTimePrecision.Day: + return "yyyy-MM-dd"; + case ExternalBankDateTimePrecision.Minute: + return "yyyy-MM-dd HH:mm"; + case ExternalBankDateTimePrecision.Second: + return "yyyy-MM-dd HH:mm:ss"; + case ExternalBankDateTimePrecision.Microsecond: + return "yyyy-MM-dd HH:mm:ss.ffffff"; + default: + throw new NotImplementedException("Unknown ExternalDateTimePrecision: " + Precision.ToString()); + } + + } + } + static public ExternalBankDataProfile FromIdentity (int externalBankDataProfileId) { ExternalBankDataProfile result = new ExternalBankDataProfile(); @@ -32,6 +53,7 @@ namespace Swarmops.Logic.Financial result.FieldNames[ExternalBankDataFieldName.NotUniqueId] = "Verifikationsnummer"; result.LatestTransactionLocation = LatestTransactionLocation.Top; + result.Precision = ExternalBankDateTimePrecision.Day; return result; } @@ -54,6 +76,7 @@ namespace Swarmops.Logic.Financial result.FieldNames[ExternalBankDataFieldName.UniqueId] = "Transaction ID"; result.LatestTransactionLocation = LatestTransactionLocation.Top; + result.Precision = ExternalBankDateTimePrecision.Second; return result; } @@ -69,6 +92,7 @@ namespace Swarmops.Logic.Financial public string Culture { get; set; } public string Currency { get; set; } public LatestTransactionLocation LatestTransactionLocation; + public ExternalBankDateTimePrecision Precision; public Dictionary FieldNames { get; private set; } } @@ -102,4 +126,33 @@ namespace Swarmops.Logic.Financial /// Bottom } + + public enum ExternalBankDateTimePrecision + { + Unknown = 0, + /// + /// The external bank has day precision only. Typical for oldbanks. + /// + Day, + /// + /// The external bank has minute (hour:minute) precision on top of day. + /// + Minute, + /// + /// The external bank tags transactions with hour, minute, and second. + /// + Second, + /// + /// The external bank has millisecond-level timestamps for transactions. Not implemented. + /// + Millisecond, + /// + /// The external bank has microsecond-resolution timestamp for transactions + /// + Microsecond, + /// + /// The external bank has nanosecond-resolution timestamp for transactions + /// + Nanosecond + } } diff --git a/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs b/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs index 167505ac..7fd9ff74 100644 --- a/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs +++ b/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs @@ -21,7 +21,10 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers string guid = Request.QueryString["Guid"]; ExternalBankMismatchingDateTime[] mismatchArray = - (ExternalBankMismatchingDateTime[]) Session["LedgersResync" + guid + "MismatchArray"]; + (ExternalBankMismatchingDateTime[])Session["LedgersResync" + guid + "MismatchArray"]; + + ExternalBankDataProfile profile = + (ExternalBankDataProfile)Session["LedgersResync" + guid + "Profile"]; if (!_authenticationData.CurrentUser.HasAccess(new Access(_authenticationData.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Read))) { @@ -42,7 +45,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers string childrenString = string.Empty; // Room for next step here string rowId = mismatch.DateTime.ToString("yyyyMMddHHmmss"); - string rowName = mismatch.DateTime.ToString("yyyy-MMM-dd HH:mm:ss"); + string rowName = mismatch.DateTime.ToString(profile.DateTimeFormatString); string swarmopsData = ((double) mismatch.SwarmopsDeltaCents/100.0).ToString("N2") + " " + currentOrganizationCurrency; diff --git a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs index 4d620696..cc83cef3 100644 --- a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs +++ b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs @@ -102,7 +102,11 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers HttpContext.Current.Session["LedgersResync" + guid + "MismatchArray"] = _staticDataLookup[guid + "MismatchArray"]; + HttpContext.Current.Session["LedgersResync" + guid + "Profile"] = + _staticDataLookup[guid + "Profile"]; + _staticDataLookup[guid + "MismatchArray"] = null; // clear the static object, which will otherwise live on + _staticDataLookup[guid + "Profile"] = null; } return percentReady; @@ -191,6 +195,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers externalData.Records[externalData.Records.Length - 1].DateTime.ToLongDateString(); _staticDataLookup[guid + "TxCount"] = externalData.Records.Length.ToString("N0"); + _staticDataLookup[guid + "Profile"] = externalData.Profile; + _staticDataLookup[guid + "PercentRead"] = 1; int accountId = 1; // TODO: HACK HACK HACK HACK