From cf6d712375364520e36d6e29bcaa29bc116d6a6c Mon Sep 17 00:00:00 2001 From: mara-1 <147929076+mara-1@users.noreply.github.com> Date: Mon, 24 Feb 2025 23:09:17 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Squirrel/GuestBusinessLogicContract.cs | 8 +++ .../BuyerBusinessLogicContract.cs | 38 ++++++++++++++ .../PostBusinessLogicContract.cs | 44 ++++++++++++++++ .../ProductBusinessLogicContract.cs | 44 ++++++++++++++++ .../SalaryBusinessLogicContract.cs | 34 +++++++++++++ .../SaleBusinessLogicContract.cs | 48 +++++++++++++++++ .../WorkerBusinessLogicContract.cs | 51 +++++++++++++++++++ .../SquirelBusinessLogic.csproj | 17 +++++++ Squirrel/Squirrel.sln | 8 ++- .../IGuestBusinessLogicContract.cs | 2 +- 10 files changed, 292 insertions(+), 2 deletions(-) create mode 100644 Squirrel/GuestBusinessLogicContract.cs create mode 100644 Squirrel/SquirelBusinessLogic/Implementations/BuyerBusinessLogicContract.cs create mode 100644 Squirrel/SquirelBusinessLogic/Implementations/PostBusinessLogicContract.cs create mode 100644 Squirrel/SquirelBusinessLogic/Implementations/ProductBusinessLogicContract.cs create mode 100644 Squirrel/SquirelBusinessLogic/Implementations/SalaryBusinessLogicContract.cs create mode 100644 Squirrel/SquirelBusinessLogic/Implementations/SaleBusinessLogicContract.cs create mode 100644 Squirrel/SquirelBusinessLogic/Implementations/WorkerBusinessLogicContract.cs create mode 100644 Squirrel/SquirelBusinessLogic/SquirelBusinessLogic.csproj diff --git a/Squirrel/GuestBusinessLogicContract.cs b/Squirrel/GuestBusinessLogicContract.cs new file mode 100644 index 0000000..d555ecb --- /dev/null +++ b/Squirrel/GuestBusinessLogicContract.cs @@ -0,0 +1,8 @@ +using System; + +public class Class1 +{ + public Class1() + { + } +} diff --git a/Squirrel/SquirelBusinessLogic/Implementations/BuyerBusinessLogicContract.cs b/Squirrel/SquirelBusinessLogic/Implementations/BuyerBusinessLogicContract.cs new file mode 100644 index 0000000..fded49e --- /dev/null +++ b/Squirrel/SquirelBusinessLogic/Implementations/BuyerBusinessLogicContract.cs @@ -0,0 +1,38 @@ +using Microsoft.Extensions.Logging; +using Squirrel.BusinessLogicsContracts; +using Squirrel.DataModels; +using Squirrel.StoragesContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SquirelBusinessLogic.Implementations; + +internal class GuestBusinessLogicContract(IGuestStorageContract +guestStorageContract, ILogger logger) : IGuestBusinessLogicContract + +{ + private readonly ILogger _logger = logger; + private readonly IGuestStorageContract _guestStorageContract = + guestStorageContract; + public List GetAllGuests() + { + return []; + } + public GuestDataModel GetGuestByData(string data) + { + return new("", "", "", 0); + } + public void InsertGuest(GuestDataModel guestDataModel) + { + } + public void UpdateGuest(GuestDataModel guestDataModel) + { + } + public void DeleteGuest(string id) + { + } + +} diff --git a/Squirrel/SquirelBusinessLogic/Implementations/PostBusinessLogicContract.cs b/Squirrel/SquirelBusinessLogic/Implementations/PostBusinessLogicContract.cs new file mode 100644 index 0000000..dc91435 --- /dev/null +++ b/Squirrel/SquirelBusinessLogic/Implementations/PostBusinessLogicContract.cs @@ -0,0 +1,44 @@ +using Microsoft.Extensions.Logging; +using Squirrel.BusinessLogicsContracts; +using Squirrel.DataModels; +using Squirrel.Enums; +using Squirrel.StoragesContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SquirelBusinessLogic.Implementations; + +internal class PostBusinessLogicContract(IPostStorageContract +postStorageContract, ILogger logger) : IPostBusinessLogicContract +{ + private readonly ILogger _logger = logger; + private readonly IPostStorageContract _postStorageContract = postStorageContract; + public List GetAllPosts(bool onlyActive = true) + { + return []; + } + public List GetAllDataOfPost(string postId) + { + return []; + } + public PostDataModel GetPostByData(string data) + { + return new("", "", "", PostType.None, 0, true, DateTime.UtcNow); + } + public void InsertPost(PostDataModel postDataModel) + { + } + public void UpdatePost(PostDataModel postDataModel) + { + } + public void DeletePost(string id) + { + } + public void RestorePost(string id) + { + } +} + diff --git a/Squirrel/SquirelBusinessLogic/Implementations/ProductBusinessLogicContract.cs b/Squirrel/SquirelBusinessLogic/Implementations/ProductBusinessLogicContract.cs new file mode 100644 index 0000000..762f27e --- /dev/null +++ b/Squirrel/SquirelBusinessLogic/Implementations/ProductBusinessLogicContract.cs @@ -0,0 +1,44 @@ +using Microsoft.Extensions.Logging; +using Squirrel.BusinessLogicsContracts; +using Squirrel.DataModels; +using Squirrel.Enums; +using Squirrel.StoragesContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SquirelBusinessLogic.Implementations; + +internal class ProductBusinessLogicContract(IProductStorageContract +productStorageContract, ILogger logger) : IProductBusinessLogicContract +{ + private readonly ILogger _logger = logger; + + private readonly IProductStorageContract _productStorageContract = productStorageContract; + public List GetAllProducts(bool onlyActive) + { + return []; + } + + public List GetProductHistoryByProduct(string + productId) + { + return []; + } + public ProductDataModel GetProductByData(string data) + { + return new("", "", ProductType.None, 0, true); + } + public void InsertProduct(ProductDataModel productDataModel) + { + } + public void UpdateProduct(ProductDataModel productDataModel) + { + } + public void DeleteProduct(string id) + { + } +} + diff --git a/Squirrel/SquirelBusinessLogic/Implementations/SalaryBusinessLogicContract.cs b/Squirrel/SquirelBusinessLogic/Implementations/SalaryBusinessLogicContract.cs new file mode 100644 index 0000000..bdb5330 --- /dev/null +++ b/Squirrel/SquirelBusinessLogic/Implementations/SalaryBusinessLogicContract.cs @@ -0,0 +1,34 @@ +using Microsoft.Extensions.Logging; +using Squirrel.BusinessLogicsContracts; +using Squirrel.DataModels; +using Squirrel.StoragesContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SquirelBusinessLogic.Implementations; + +internal class SalaryBusinessLogicContract(ISalaryStorageContract salaryStorageContract, ISaleStorageContract saleStorageContract, IPostStorageContract +postStorageContract, IWorkerStorageContract workerStorageContract, ILogger +logger) : ISalaryBusinessLogicContract +{ + private readonly ILogger _logger = logger; + private readonly ISalaryStorageContract _salaryStorageContract = salaryStorageContract; + private readonly ISaleStorageContract _saleStorageContract = saleStorageContract; + private readonly IPostStorageContract _postStorageContract = postStorageContract; + private readonly IWorkerStorageContract _workerStorageContract = workerStorageContract; + public List GetAllSalariesByPeriod(DateTime fromDate, DateTime toDate) + + { + return []; + } + public List GetAllSalariesByPeriodByWorker(DateTime fromDate, DateTime toDate, string workerId) + { + return []; + } + public void CalculateSalaryByMounth(DateTime date) + { + } +} diff --git a/Squirrel/SquirelBusinessLogic/Implementations/SaleBusinessLogicContract.cs b/Squirrel/SquirelBusinessLogic/Implementations/SaleBusinessLogicContract.cs new file mode 100644 index 0000000..8c652f6 --- /dev/null +++ b/Squirrel/SquirelBusinessLogic/Implementations/SaleBusinessLogicContract.cs @@ -0,0 +1,48 @@ +using Microsoft.Extensions.Logging; +using Squirrel.BusinessLogicsContracts; +using Squirrel.DataModels; +using Squirrel.Enums; +using Squirrel.StoragesContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SquirelBusinessLogic.Implementations; + +internal class SaleBusinessLogicContract(ISaleStorageContract +saleStorageContract, ILogger logger) : ISaleBusinessLogicContract +{ + private readonly ILogger _logger = logger; + private readonly ISaleStorageContract _saleStorageContract = saleStorageContract; + public List GetAllSalesByPeriod(DateTime fromDate, DateTime toDate) + { + return []; + } + public List GetAllSalesByWorkerByPeriod(string workerId, DateTime fromDate, DateTime toDate) + { + return []; + } + public List GetAllSalesByGuestByPeriod(string? guestId, DateTime fromDate, DateTime toDate) + { + return []; + } + public List GetAllSalesByProductByPeriod(string productId, DateTime fromDate, DateTime toDate) + { + return []; + } + public SaleDataModel GetSaleByData(string data) + { + return new("", "", "", 0, DiscountType.None, 0, false, []); + } + public void InsertSale(SaleDataModel saleDataModel) + { + } + + public void CancelSale(string id) + { + } + + +} diff --git a/Squirrel/SquirelBusinessLogic/Implementations/WorkerBusinessLogicContract.cs b/Squirrel/SquirelBusinessLogic/Implementations/WorkerBusinessLogicContract.cs new file mode 100644 index 0000000..2d30eee --- /dev/null +++ b/Squirrel/SquirelBusinessLogic/Implementations/WorkerBusinessLogicContract.cs @@ -0,0 +1,51 @@ +using Microsoft.Extensions.Logging; +using Squirrel.BusinessLogicsContracts; +using Squirrel.DataModels; +using Squirrel.StoragesContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SquirelBusinessLogic.Implementations; + +internal class WorkerBusinessLogicContract(IWorkerStorageContract +workerStorageContract, ILogger logger) : IWorkerBusinessLogicContract +{ + private readonly ILogger _logger = logger; + private readonly IWorkerStorageContract _workerStorageContract = + workerStorageContract; + public List GetAllWorkers(bool onlyActive = true) + { + return []; + } + public List GetAllWorkersByPost(string postId, bool + onlyActive = true) + { + return []; + } + public List GetAllWorkersByBirthDate(DateTime fromDate, + DateTime toDate, bool onlyActive = true) + { + return []; + } + public List GetAllWorkersByEmploymentDate(DateTime + fromDate, DateTime toDate, bool onlyActive = true) + { + return []; + } + public WorkerDataModel GetWorkerByData(string data) + { + return new("", "", "", DateTime.Now, DateTime.Now, true); + } + public void InsertWorker(WorkerDataModel workerDataModel) + { + } + public void UpdateWorker(WorkerDataModel workerDataModel) + { + } + public void DeleteWorker(string id) + { + } +} diff --git a/Squirrel/SquirelBusinessLogic/SquirelBusinessLogic.csproj b/Squirrel/SquirelBusinessLogic/SquirelBusinessLogic.csproj new file mode 100644 index 0000000..730d157 --- /dev/null +++ b/Squirrel/SquirelBusinessLogic/SquirelBusinessLogic.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/Squirrel/Squirrel.sln b/Squirrel/Squirrel.sln index d831c3b..f4df99c 100644 --- a/Squirrel/Squirrel.sln +++ b/Squirrel/Squirrel.sln @@ -5,7 +5,9 @@ VisualStudioVersion = 17.11.35303.130 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrel", "Squirrel\Squirrel.csproj", "{16CED5CC-61F1-494B-8B3E-7F6A3BD6F0C3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SquirrelTests", "SquirrelTests\SquirrelTests.csproj", "{C61A5FF4-E87A-4722-AA58-2E7FC2057217}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SquirrelTests", "SquirrelTests\SquirrelTests.csproj", "{C61A5FF4-E87A-4722-AA58-2E7FC2057217}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SquirelBusinessLogic", "SquirelBusinessLogic\SquirelBusinessLogic.csproj", "{9846600E-25A1-423B-B84E-A87CE0563ED7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +23,10 @@ Global {C61A5FF4-E87A-4722-AA58-2E7FC2057217}.Debug|Any CPU.Build.0 = Debug|Any CPU {C61A5FF4-E87A-4722-AA58-2E7FC2057217}.Release|Any CPU.ActiveCfg = Release|Any CPU {C61A5FF4-E87A-4722-AA58-2E7FC2057217}.Release|Any CPU.Build.0 = Release|Any CPU + {9846600E-25A1-423B-B84E-A87CE0563ED7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9846600E-25A1-423B-B84E-A87CE0563ED7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9846600E-25A1-423B-B84E-A87CE0563ED7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9846600E-25A1-423B-B84E-A87CE0563ED7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Squirrel/Squirrel/BusinessLogicsContracts/IGuestBusinessLogicContract.cs b/Squirrel/Squirrel/BusinessLogicsContracts/IGuestBusinessLogicContract.cs index 687822e..1df523f 100644 --- a/Squirrel/Squirrel/BusinessLogicsContracts/IGuestBusinessLogicContract.cs +++ b/Squirrel/Squirrel/BusinessLogicsContracts/IGuestBusinessLogicContract.cs @@ -12,6 +12,6 @@ public interface IGuestBusinessLogicContract List GetAllGuests(); GuestDataModel GetGuestByData(string data); void InsertGuest(GuestDataModel guestDataModel); - void UpdateBuyer(GuestDataModel guestDataModel); + void UpdateGuest(GuestDataModel guestDataModel); void DeleteGuest(string id); }