Country and currency data
This commit is contained in:
parent
245fdbc7f6
commit
6f60f74c90
|
@ -1 +0,0 @@
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\include\MapTo\src\BlueWest.MapTo\BlueWest.MapTo.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
<ProjectReference Include="..\include\Math-Expression-Evaluator\SimpleExpressionEvaluator\SimpleExpressionEvaluator.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\include\MapTo\src\BlueWest.MapTo\MapTo.props" />
|
||||
<ItemGroup>
|
||||
|
|
|
@ -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;
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace BlueWest.Data;
|
||||
|
||||
public class Country
|
||||
{
|
||||
public string StateName;
|
||||
public int Code;
|
||||
public string TLD;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace BlueWest.Data;
|
||||
|
||||
public class Currency
|
||||
{
|
||||
public Country Country { get; set; }
|
||||
}
|
|
@ -4,28 +4,16 @@ 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 string Name;
|
||||
|
||||
private string Description;
|
||||
}
|
||||
|
||||
public enum MathOperationType
|
||||
{
|
||||
Add,
|
||||
Sub,
|
||||
Div,
|
||||
Mul
|
||||
}
|
||||
|
||||
[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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
public MathOperation(string expression, Dictionary<string, decimal> letters)
|
||||
{
|
||||
MathOperationType = mathOperationType;
|
||||
LeftAmount = leftAmount;
|
||||
RightAmount = rightAmount;
|
||||
MathOperationDescription = mathOperationDescription;
|
||||
}
|
||||
|
||||
public void Calculate()
|
||||
{
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BlueWest.Data
|
||||
{
|
||||
public static class UserExtensions
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
|
Loading…
Reference in New Issue