From d9236f9452bf9510afcf3e4f28349391dc53d241 Mon Sep 17 00:00:00 2001 From: CodeLiturgy Date: Sat, 13 Aug 2022 03:32:57 +0100 Subject: [PATCH] bump includes --- BlueWest.Data/Finance/FinanceTransaction.cs | 17 ++++-- BlueWest.Data/Finance/MathOperation.cs | 57 +++++++++++++++++++++ BlueWest.sln | 23 +++++++++ include/Math-Expression-Evaluator | 1 + 4 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 BlueWest.Data/Finance/MathOperation.cs create mode 160000 include/Math-Expression-Evaluator diff --git a/BlueWest.Data/Finance/FinanceTransaction.cs b/BlueWest.Data/Finance/FinanceTransaction.cs index c7eb582..b218439 100644 --- a/BlueWest.Data/Finance/FinanceTransaction.cs +++ b/BlueWest.Data/Finance/FinanceTransaction.cs @@ -8,18 +8,25 @@ namespace BlueWest.Data { ConsumerTypeBuy, ConsumerTypeDonate, - BusinessIncomePayment + BusinessIncomePayment, + BankTransferPayment } public class FinanceTransactionType { [Key] private FinanceTransactionTypeEnum Type; - private string FinanceTransactionDescription; + private string FinanceTransactionTypeDescription; + } + + public enum MathOperationType + { + Add, + Sub, + Div, + Mul } - - [MapFrom(typeof(FinanceTransactionInsertDto))] public partial class FinanceTransaction { @@ -28,9 +35,9 @@ namespace BlueWest.Data public TimeSpan UserId { get; set; } public string Currency { get; } - public FinanceTransactionType FinanceTransactionType {get;} + private string FinanceTransactionDescription; public FinanceTransaction() diff --git a/BlueWest.Data/Finance/MathOperation.cs b/BlueWest.Data/Finance/MathOperation.cs new file mode 100644 index 0000000..07f7100 --- /dev/null +++ b/BlueWest.Data/Finance/MathOperation.cs @@ -0,0 +1,57 @@ +using System; +using System.ComponentModel.DataAnnotations; + +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; + + public double ResultingAmount + { + get + { + if (_isCalculated) return _resultingAmount; + return 0; + } + } + + public MathOperation() { } + public MathOperation(MathOperationType mathOperationType, double leftAmount, double rightAmount, string mathOperationDescription) + { + MathOperationType = mathOperationType; + LeftAmount = leftAmount; + RightAmount = rightAmount; + MathOperationDescription = mathOperationDescription; + } + + public void Calculate() + { + _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.sln b/BlueWest.sln index 9de9c6e..4d58851 100644 --- a/BlueWest.sln +++ b/BlueWest.sln @@ -13,6 +13,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Collections", "Blu EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlueWest.MapTo", "include\MapTo\src\BlueWest.MapTo\BlueWest.MapTo.csproj", "{72B37540-A12F-466E-A58F-7BA2B247CB74}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleExpressionEvaluator", "include\Math-Expression-Evaluator\SimpleExpressionEvaluator\SimpleExpressionEvaluator.csproj", "{30637214-EDE9-4C2E-BFD6-E4B163FA308B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "include", "include", "{A1606EEC-6AC5-4779-B140-F57089F5A05F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data", "data", "{19577B27-7EDF-4DBA-83D5-E047467BDFEF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleExpressionEvaluator.Tests", "include\Math-Expression-Evaluator\SimpleExpressionEvaluator.Tests\SimpleExpressionEvaluator.Tests.csproj", "{08F4484E-5FD8-4590-A8D7-12FBE47120C8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +47,14 @@ Global {72B37540-A12F-466E-A58F-7BA2B247CB74}.Debug|Any CPU.Build.0 = Debug|Any CPU {72B37540-A12F-466E-A58F-7BA2B247CB74}.Release|Any CPU.ActiveCfg = Release|Any CPU {72B37540-A12F-466E-A58F-7BA2B247CB74}.Release|Any CPU.Build.0 = Release|Any CPU + {30637214-EDE9-4C2E-BFD6-E4B163FA308B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30637214-EDE9-4C2E-BFD6-E4B163FA308B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30637214-EDE9-4C2E-BFD6-E4B163FA308B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30637214-EDE9-4C2E-BFD6-E4B163FA308B}.Release|Any CPU.Build.0 = Release|Any CPU + {08F4484E-5FD8-4590-A8D7-12FBE47120C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08F4484E-5FD8-4590-A8D7-12FBE47120C8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08F4484E-5FD8-4590-A8D7-12FBE47120C8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08F4484E-5FD8-4590-A8D7-12FBE47120C8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -46,4 +62,11 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F24E44CA-98BA-4B44-A1E1-57912CC5DCC3} EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {30637214-EDE9-4C2E-BFD6-E4B163FA308B} = {A1606EEC-6AC5-4779-B140-F57089F5A05F} + {72B37540-A12F-466E-A58F-7BA2B247CB74} = {A1606EEC-6AC5-4779-B140-F57089F5A05F} + {F55019A2-E2A8-4AF1-8FBC-FA99476A1B1C} = {19577B27-7EDF-4DBA-83D5-E047467BDFEF} + {E518C62D-768C-4885-9C9D-FD5761605B54} = {19577B27-7EDF-4DBA-83D5-E047467BDFEF} + {08F4484E-5FD8-4590-A8D7-12FBE47120C8} = {A1606EEC-6AC5-4779-B140-F57089F5A05F} + EndGlobalSection EndGlobal diff --git a/include/Math-Expression-Evaluator b/include/Math-Expression-Evaluator new file mode 160000 index 0000000..bc7ff8b --- /dev/null +++ b/include/Math-Expression-Evaluator @@ -0,0 +1 @@ +Subproject commit bc7ff8bced98c9e58ae1b55133909cd76effb210