From d94b4cbe44a1a694aa672c9c7018dd4f0e54578c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=93=D0=BE=D1=80=D0=B4?= =?UTF-8?q?=D0=B5=D0=B5=D0=B2?= <89176335310x@gmail.com> Date: Sun, 19 May 2024 18:43:00 +0400 Subject: [PATCH] BeBeBe2 --- .../BusinessLogic/OrderLogic.cs | 7 ++++- .../BusinessLogic/PayLogic.cs | 31 +++++++++++++++++++ .../BindingModels/PayBindingModel.cs | 17 ++++++++++ .../BusinessLogicContracts/IPayLogic.cs | 19 ++++++++++++ .../SearchModels/PaySearchModel.cs | 16 ++++++++++ .../StorageContracts/IPayStorage.cs | 18 +++++++++++ .../ViewModels/PayViewModel.cs | 20 ++++++++++++ .../Models/IPayModel.cs | 16 ++++++++++ 8 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/PayLogic.cs create mode 100644 ElectronicsShop/ElectronicsShopContracts/BindingModels/PayBindingModel.cs create mode 100644 ElectronicsShop/ElectronicsShopContracts/BusinessLogicContracts/IPayLogic.cs create mode 100644 ElectronicsShop/ElectronicsShopContracts/SearchModels/PaySearchModel.cs create mode 100644 ElectronicsShop/ElectronicsShopContracts/StorageContracts/IPayStorage.cs create mode 100644 ElectronicsShop/ElectronicsShopContracts/ViewModels/PayViewModel.cs create mode 100644 ElectronicsShop/ElectronicsShopDataModels/Models/IPayModel.cs diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/OrderLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/OrderLogic.cs index cdd7c61..a0b818c 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/OrderLogic.cs @@ -83,7 +83,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic if (viewModel == null) { throw new ArgumentNullException(nameof(model)); } - if (viewModel.Status + 1 != newOrderStatus) { + if (viewModel.OrderStatus + 1 != newOrderStatus) { _logger.LogWarning("Status update to " + newOrderStatus.ToString() + " operation failed."); return false; } @@ -100,5 +100,10 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic } return true; } + + public OrderViewModel? ReadElement(OrderSearchModel model) + { + throw new NotImplementedException(); + } } } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/PayLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/PayLogic.cs new file mode 100644 index 0000000..d4513ee --- /dev/null +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/PayLogic.cs @@ -0,0 +1,31 @@ +using ElectronicsShopContracts.BindingModels; +using ElectronicsShopContracts.BusinessLogicContracts; +using ElectronicsShopContracts.SearchModels; +using ElectronicsShopContracts.StorageContracts; +using ElectronicsShopContracts.ViewModels; +using Microsoft.Extensions.Logging; + + +namespace ElectronicsShopBusinessLogic.BusinessLogic +{ + public class PayLogic : IPayLogic + { + private readonly ILogger _logger; + private readonly IPayStorage _storage; + + public bool CreatePay(PayBindingModel model) + { + throw new NotImplementedException(); + } + + public PayViewModel? ReadElement(PaySearchModel model) + { + throw new NotImplementedException(); + } + + public List? ReadList(PaySearchModel? model) + { + throw new NotImplementedException(); + } + } +} diff --git a/ElectronicsShop/ElectronicsShopContracts/BindingModels/PayBindingModel.cs b/ElectronicsShop/ElectronicsShopContracts/BindingModels/PayBindingModel.cs new file mode 100644 index 0000000..25b935f --- /dev/null +++ b/ElectronicsShop/ElectronicsShopContracts/BindingModels/PayBindingModel.cs @@ -0,0 +1,17 @@ +using ElectronicsShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicsShopContracts.BindingModels +{ + public class PayBindingModel : IPayModel + { + public int ID { get; set; } + public int ClientID { get; set; } + public double SummaPay { get; set; } + public DateTime DatePay { get; set; } + } +} diff --git a/ElectronicsShop/ElectronicsShopContracts/BusinessLogicContracts/IPayLogic.cs b/ElectronicsShop/ElectronicsShopContracts/BusinessLogicContracts/IPayLogic.cs new file mode 100644 index 0000000..4dd746b --- /dev/null +++ b/ElectronicsShop/ElectronicsShopContracts/BusinessLogicContracts/IPayLogic.cs @@ -0,0 +1,19 @@ +using ElectronicsShopContracts.BindingModels; +using ElectronicsShopContracts.SearchModels; +using ElectronicsShopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicsShopContracts.BusinessLogicContracts +{ + public interface IPayLogic + { + List? ReadList(PaySearchModel? model); + PayViewModel? ReadElement(PaySearchModel model); + + bool CreatePay(PayBindingModel model); + } +} diff --git a/ElectronicsShop/ElectronicsShopContracts/SearchModels/PaySearchModel.cs b/ElectronicsShop/ElectronicsShopContracts/SearchModels/PaySearchModel.cs new file mode 100644 index 0000000..7084788 --- /dev/null +++ b/ElectronicsShop/ElectronicsShopContracts/SearchModels/PaySearchModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicsShopContracts.SearchModels +{ + public class PaySearchModel + { + public int? ID { get; set; } + public int? ClientID { get; set; } + public double? SummaPay { get; set; } + public DateTime DatePay { get; set; } + } +} diff --git a/ElectronicsShop/ElectronicsShopContracts/StorageContracts/IPayStorage.cs b/ElectronicsShop/ElectronicsShopContracts/StorageContracts/IPayStorage.cs new file mode 100644 index 0000000..e4be54b --- /dev/null +++ b/ElectronicsShop/ElectronicsShopContracts/StorageContracts/IPayStorage.cs @@ -0,0 +1,18 @@ +using ElectronicsShopContracts.BindingModels; +using ElectronicsShopContracts.SearchModels; +using ElectronicsShopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicsShopContracts.StorageContracts +{ + public interface IPayStorage + { + List GetFullList(); + PayViewModel? GetElement(PaySearchModel model); + PayViewModel? Insert(PayBindingModel model); + } +} diff --git a/ElectronicsShop/ElectronicsShopContracts/ViewModels/PayViewModel.cs b/ElectronicsShop/ElectronicsShopContracts/ViewModels/PayViewModel.cs new file mode 100644 index 0000000..2d70501 --- /dev/null +++ b/ElectronicsShop/ElectronicsShopContracts/ViewModels/PayViewModel.cs @@ -0,0 +1,20 @@ +using ElectronicsShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicsShopContracts.ViewModels +{ + public class PayViewModel : IPayModel + { + public int ID { get; set; } + public int ClientID {get;set;} + + public double SummaPay { get; set; } + + public DateTime DatePay { get; set; } + + } +} diff --git a/ElectronicsShop/ElectronicsShopDataModels/Models/IPayModel.cs b/ElectronicsShop/ElectronicsShopDataModels/Models/IPayModel.cs new file mode 100644 index 0000000..10f71cd --- /dev/null +++ b/ElectronicsShop/ElectronicsShopDataModels/Models/IPayModel.cs @@ -0,0 +1,16 @@ +using Microsoft.VisualBasic; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicsShopDataModels.Models +{ + public interface IPayModel: IID + { + int ClientID { get; } + double SummaPay { get; } + DateTime DatePay { get; } + } +}