diff --git a/BlueWest.Data/BlueList.cs b/BlueWest.Data/BlueList.cs
deleted file mode 100644
index 5f28270..0000000
--- a/BlueWest.Data/BlueList.cs
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/BlueWest.Data/BlueWest.Data.csproj b/BlueWest.Data/BlueWest.Data.csproj
index 86cdb70..8fae5aa 100644
--- a/BlueWest.Data/BlueWest.Data.csproj
+++ b/BlueWest.Data/BlueWest.Data.csproj
@@ -13,6 +13,7 @@
+
diff --git a/BlueWest.Data/Core/CodeGenerator.cs b/BlueWest.Data/Core/CodeGenerator.cs
deleted file mode 100644
index b0caf85..0000000
--- a/BlueWest.Data/Core/CodeGenerator.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using System.Security.Cryptography;
-
-namespace BlueWest.Data
-{
- public class CodeGenerator
- {
- /*public string GetInviteCode(bool isBase64 = false)
- {
- var unix = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
- var unixStr = unix.ToString("0000000000")[^6..];
-
- byte[] bytes = RandomNumberGenerator.GetBytes(6);
-
- var hexArray = Array.ConvertAll(bytes, x => x.ToString("X2"));
- var hexStr = string.Concat(hexArray);
-
- var resultCode = isBase64
- ? Convert.ToBase64String(Convert.FromHexString(unixStr + hexStr))
- : unixStr + hexStr;
-
- return resultCode;
- }*/
- }
-}
\ No newline at end of file
diff --git a/BlueWest.Data/Finance/Country.cs b/BlueWest.Data/Finance/Country.cs
new file mode 100644
index 0000000..0f4f037
--- /dev/null
+++ b/BlueWest.Data/Finance/Country.cs
@@ -0,0 +1,8 @@
+namespace BlueWest.Data;
+
+public class Country
+{
+ public string StateName;
+ public int Code;
+ public string TLD;
+}
\ No newline at end of file
diff --git a/BlueWest.Data/Finance/Currency.cs b/BlueWest.Data/Finance/Currency.cs
new file mode 100644
index 0000000..e4fb9a4
--- /dev/null
+++ b/BlueWest.Data/Finance/Currency.cs
@@ -0,0 +1,6 @@
+namespace BlueWest.Data;
+
+public class Currency
+{
+ public Country Country { get; set; }
+}
\ No newline at end of file
diff --git a/BlueWest.Data/Finance/FinanceTransaction.cs b/BlueWest.Data/Finance/FinanceTransaction.cs
index b218439..40d86a0 100644
--- a/BlueWest.Data/Finance/FinanceTransaction.cs
+++ b/BlueWest.Data/Finance/FinanceTransaction.cs
@@ -4,29 +4,17 @@ using MapTo;
namespace BlueWest.Data
{
- public enum FinanceTransactionTypeEnum
- {
- ConsumerTypeBuy,
- ConsumerTypeDonate,
- BusinessIncomePayment,
- BankTransferPayment
- }
-
public class FinanceTransactionType
{
- [Key] private FinanceTransactionTypeEnum Type;
- private string FinanceTransactionTypeDescription;
- }
+ [Key] public TimeSpan CreationDate { get; set; }
- public enum MathOperationType
- {
- Add,
- Sub,
- Div,
- Mul
+ public string Name;
+
+ private string Description;
}
+
[MapFrom(typeof(FinanceTransactionInsertDto))]
public partial class FinanceTransaction
{
@@ -35,7 +23,7 @@ namespace BlueWest.Data
public TimeSpan UserId { get; set; }
public string Currency { get; }
- public FinanceTransactionType FinanceTransactionType {get;}
+ public FinanceTransactionType Type {get;}
private string FinanceTransactionDescription;
diff --git a/BlueWest.Data/Finance/MathOperation.cs b/BlueWest.Data/Finance/MathOperation.cs
index 07f7100..8293eab 100644
--- a/BlueWest.Data/Finance/MathOperation.cs
+++ b/BlueWest.Data/Finance/MathOperation.cs
@@ -1,22 +1,23 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using SimpleExpressionEvaluator;
namespace BlueWest.Data;
public class MathOperation
{
[Key] public TimeSpan CreationDate { get; set; }
- public MathOperationType MathOperationType { get; }
-
- public double LeftAmount { get; }
- public double RightAmount { get; }
- public string MathOperationDescription { get; }
private bool _isCalculated = false;
- private double _resultingAmount;
+ private string _expression;
- public double ResultingAmount
+ private decimal _resultingAmount;
+
+ private ExpressionEvaluator _expressionEvaluator = new ExpressionEvaluator();
+
+ public decimal ResultingAmount
{
get
{
@@ -26,32 +27,12 @@ public class MathOperation
}
public MathOperation() { }
- public MathOperation(MathOperationType mathOperationType, double leftAmount, double rightAmount, string mathOperationDescription)
- {
- MathOperationType = mathOperationType;
- LeftAmount = leftAmount;
- RightAmount = rightAmount;
- MathOperationDescription = mathOperationDescription;
- }
-
- public void Calculate()
+ public MathOperation(string expression, Dictionary letters)
{
+
+ _resultingAmount = _expressionEvaluator.Evaluate(expression, letters);
_isCalculated = true;
- switch (MathOperationType)
- {
- case MathOperationType.Add:
- _resultingAmount = LeftAmount + RightAmount;
- return;
- case MathOperationType.Div:
- _resultingAmount = LeftAmount / RightAmount;
- return;
- case MathOperationType.Mul:
- _resultingAmount = LeftAmount * RightAmount;
- return;
- case MathOperationType.Sub:
- _resultingAmount = LeftAmount - RightAmount;
- return;
- }
}
+
}
\ No newline at end of file
diff --git a/BlueWest.Data/UserExtensions.cs b/BlueWest.Data/UserExtensions.cs
deleted file mode 100644
index 0c8b953..0000000
--- a/BlueWest.Data/UserExtensions.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace BlueWest.Data
-{
- public static class UserExtensions
- {
-
- }
-}
diff --git a/BlueWest.Data/UserList.cs b/BlueWest.Data/UserList.cs
deleted file mode 100644
index 5f28270..0000000
--- a/BlueWest.Data/UserList.cs
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file