Some mobile work

This commit is contained in:
Rick Falkvinge
2014-04-15 07:11:50 +00:00
parent b3f43e9af9
commit 7946a66bdc
2 changed files with 39 additions and 0 deletions
+34
View File
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Swarmops.Logic.Security;
namespace Swarmops.Logic.Financial
{
@@ -26,5 +28,37 @@ namespace Swarmops.Logic.Financial
}
#endregion
public string ImportHash
{
get
{
string importKey = string.Empty;
if (!string.IsNullOrEmpty(UniqueId))
{
importKey = UniqueId;
}
else if (!string.IsNullOrEmpty(NotUniqueId))
{
string commentKey = Description.ToLowerInvariant();
string hashKey = NotUniqueId + commentKey + (TransactionNetCents / 100.0).ToString(CultureInfo.InvariantCulture) + (AccountBalanceCents / 100.0).ToString(CultureInfo.InvariantCulture) +
DateTime.ToString("yyyy-MM-dd-00-00-00");
// the 00-00-00 used to be hh-mm-ss but is replaced this way for backward hash compatibility
// maybe replace cleanly at a certain year to include seconds in hash or so
importKey = SHA1.Hash(hashKey).Replace(" ", "");
}
if (importKey.Length > 30)
{
importKey = importKey.Substring(0, 30);
}
return importKey;
}
}
}
}
@@ -245,6 +245,11 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
newMismatch.MasterTransactionCount = masterTransactionCount;
newMismatch.SwarmopsDeltaCents = swarmopsDeltaCents;
newMismatch.SwarmopsTransactionCount = 0; // TODO
// Load transactions from both sources
// Analyze actions
mismatchList.Add(newMismatch);
}