From c2d673f9a39316b147abeaf0e2a43d5e14bc1e3a Mon Sep 17 00:00:00 2001 From: dasha Date: Tue, 4 Apr 2023 00:18:03 +0400 Subject: [PATCH] =?UTF-8?q?=D1=8F=20=D0=BD=D0=B8=D1=87=D0=B5=D0=B3=D0=BE?= =?UTF-8?q?=20=D0=BD=D0=B5=20=D0=B7=D0=BD=D0=B0=D1=8E=20=D1=8F=20=D0=B4?= =?UTF-8?q?=D0=B5=D0=B1=D0=B8=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Storekeeper/ReportStorekeeperLogic.cs | 44 +++++++++++++++++++ .../IReportStorekeeperLogic.cs | 22 ++++++++++ .../SearchModels/PurchaseSearchModel.cs | 1 + .../ViewModels/ReportBuildGoodViewModel.cs | 12 +++++ .../ViewModels/ReportComponentsViewModel.cs | 11 +++++ 5 files changed, 90 insertions(+) create mode 100644 HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Storekeeper/ReportStorekeeperLogic.cs create mode 100644 HardwareShop/HardwareShopContracts/BusinessLogicsContracts/IReportStorekeeperLogic.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/ReportBuildGoodViewModel.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/ReportComponentsViewModel.cs diff --git a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Storekeeper/ReportStorekeeperLogic.cs b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Storekeeper/ReportStorekeeperLogic.cs new file mode 100644 index 0000000..23ee404 --- /dev/null +++ b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Storekeeper/ReportStorekeeperLogic.cs @@ -0,0 +1,44 @@ +using HardwareShopContracts.BindingModels; +using HardwareShopContracts.BusinessLogicsContracts; +using HardwareShopContracts.SearchModels; +using HardwareShopContracts.StoragesContracts; +using HardwareShopContracts.ViewModels; +using System.Collections.Generic; + +namespace HardwareShopBusinessLogic.BusinessLogics.Storekeeper +{ + public class ReportStorekeeperLogic : IReportStorekeeperLogic + { + private readonly IComponentStorage _componentStorage; + private readonly IGoodStorage _goodStorage; + private readonly IPurchaseStorage _purchaseStorage; + + public ReportStorekeeperLogic(IComponentStorage componentStorage, IGoodStorage goodStorage, IPurchaseStorage purchaseStorage) + { + _componentStorage = componentStorage; + _goodStorage = goodStorage; + _purchaseStorage = purchaseStorage; + } + public List GetBuildGood(List goods) + { + var list = new List(); + + foreach (var good in goods) + { + var record = new ReportBuildGoodViewModel + { + GoodName = good.GoodName, + Builds = new() + }; + } + return list; + } + + public List GetComponents(ReportBindingModel model) + { + var list = new List(); + + return list; + } + } +} diff --git a/HardwareShop/HardwareShopContracts/BusinessLogicsContracts/IReportStorekeeperLogic.cs b/HardwareShop/HardwareShopContracts/BusinessLogicsContracts/IReportStorekeeperLogic.cs new file mode 100644 index 0000000..d404576 --- /dev/null +++ b/HardwareShop/HardwareShopContracts/BusinessLogicsContracts/IReportStorekeeperLogic.cs @@ -0,0 +1,22 @@ +using HardwareShopContracts.BindingModels; +using HardwareShopContracts.ViewModels; + +namespace HardwareShopContracts.BusinessLogicsContracts +{ + public interface IReportStorekeeperLogic + { + /// + /// Получение списка сборок с указанием, в каких товарах используются + /// + /// + List GetBuildGood(List goods); + + /// + /// Получение сведений по комплектующим за период, + /// с указанием в каких товарах и сборках они использовались + /// + /// + /// + List GetComponents(ReportBindingModel model); + } +} diff --git a/HardwareShop/HardwareShopContracts/SearchModels/PurchaseSearchModel.cs b/HardwareShop/HardwareShopContracts/SearchModels/PurchaseSearchModel.cs index 7f2e5f6..e4caf9b 100644 --- a/HardwareShop/HardwareShopContracts/SearchModels/PurchaseSearchModel.cs +++ b/HardwareShop/HardwareShopContracts/SearchModels/PurchaseSearchModel.cs @@ -9,5 +9,6 @@ namespace HardwareShopContracts.SearchModels public int? UserId { get; set; } public DateTime? DatePurchase { get; set; } + public DateTime? DateTo { get; set; } } } diff --git a/HardwareShop/HardwareShopContracts/ViewModels/ReportBuildGoodViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/ReportBuildGoodViewModel.cs new file mode 100644 index 0000000..5bb6a22 --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/ReportBuildGoodViewModel.cs @@ -0,0 +1,12 @@ +namespace HardwareShopContracts.ViewModels +{ + public class ReportBuildGoodViewModel + { + public string GoodName { get; set; } = string.Empty; + public List Builds + { + get; + set; + } = new(); + } +} diff --git a/HardwareShop/HardwareShopContracts/ViewModels/ReportComponentsViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/ReportComponentsViewModel.cs new file mode 100644 index 0000000..094b415 --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/ReportComponentsViewModel.cs @@ -0,0 +1,11 @@ +namespace HardwareShopContracts.ViewModels +{ + public class ReportComponentsViewModel + { + public string ComponentName { get; set; } = string.Empty; + + public int TotalCount { get; set; } + + public List<(string GoodOrBuild, int Count)> GoodOrBuilds { get; set; } = new(); + } +}