From 52ba95b50e1b4ce489cebaf6f2b80c1970887ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=9F=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=D0=B2=D0=BE=D0=B9?= Date: Sun, 29 Jan 2023 19:21:11 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B2=D0=B5=D1=80=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D1=80=D0=B0=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogicsContracts/IBouquetLogic.cs | 15 +++++++++++ .../IComponentLogic.cs | 15 +++++++++++ .../BusinessLogicsContracts/IOrderLogic.cs | 15 +++++++++++ .../FlowerShopContracts.csproj | 6 ----- .../StoragesContracts/IBouquetStorage.cs | 16 ++++++++++++ .../StoragesContracts/IComponentStorage.cs | 16 ++++++++++++ .../StoragesContracts/IOrderStorage.cs | 16 ++++++++++++ .../ViewModels/BouquetViewModel.cs | 15 +++++++++++ .../ViewModels/ComponentViewModel.cs | 14 +++++++++++ .../ViewModels/OrderViewModel.cs | 25 +++++++++++++++++++ .../FlowerShopDataModels/OrderStatus.cs | 2 +- 11 files changed, 148 insertions(+), 7 deletions(-) create mode 100644 FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IBouquetLogic.cs create mode 100644 FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IComponentLogic.cs create mode 100644 FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IOrderLogic.cs create mode 100644 FlowerShop/FlowerShopContracts/StoragesContracts/IBouquetStorage.cs create mode 100644 FlowerShop/FlowerShopContracts/StoragesContracts/IComponentStorage.cs create mode 100644 FlowerShop/FlowerShopContracts/StoragesContracts/IOrderStorage.cs create mode 100644 FlowerShop/FlowerShopContracts/ViewModels/BouquetViewModel.cs create mode 100644 FlowerShop/FlowerShopContracts/ViewModels/ComponentViewModel.cs create mode 100644 FlowerShop/FlowerShopContracts/ViewModels/OrderViewModel.cs diff --git a/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IBouquetLogic.cs b/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IBouquetLogic.cs new file mode 100644 index 0000000..ce69ce4 --- /dev/null +++ b/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IBouquetLogic.cs @@ -0,0 +1,15 @@ +using FlowerShopContracts.BindingModels; +using FlowerShopContracts.SearchModels; +using FlowerShopContracts.ViewModels; + +namespace FlowerShopContracts.BusinessLogicsContracts +{ + public interface IBouquetLogic + { + List? ReadList(BouquetSearchModel? model); + BouquetViewModel? ReadElement(BouquetSearchModel model); + bool Create(BouquetBindingModel model); + bool Update(BouquetBindingModel model); + bool Delete(BouquetBindingModel model); + } +} \ No newline at end of file diff --git a/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IComponentLogic.cs b/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..5913315 --- /dev/null +++ b/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,15 @@ +using FlowerShopContracts.ViewModels; +using FlowerShopContracts.BindingModels; +using FlowerShopContracts.SearchModels; + +namespace FlowerShopContracts.BusinessLogicsContracts +{ + public interface IComponentLogic + { + List? ReadList(ComponentSearchModel? model); + ComponentViewModel? ReadElement(ComponentSearchModel model); + bool Create(ComponentBindingModel model); + bool Update(ComponentBindingModel model); + bool Delete(ComponentBindingModel model); + } +} \ No newline at end of file diff --git a/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IOrderLogic.cs b/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..0449bf8 --- /dev/null +++ b/FlowerShop/FlowerShopContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,15 @@ +using FlowerShopContracts.BindingModels; +using FlowerShopContracts.SearchModels; +using FlowerShopContracts.ViewModels; + +namespace FlowerShopContracts.BusinessLogicsContracts +{ + public interface IOrderLogic + { + List? ReadList(OrderSearchModel? model); + bool CreateOrder(OrderBindingModel model); + bool TakeOrderInWork(OrderBindingModel model); + bool FinishOrder(OrderBindingModel model); + bool DeliveryOrder(OrderBindingModel model); + } +} diff --git a/FlowerShop/FlowerShopContracts/FlowerShopContracts.csproj b/FlowerShop/FlowerShopContracts/FlowerShopContracts.csproj index 5c02fdf..5192185 100644 --- a/FlowerShop/FlowerShopContracts/FlowerShopContracts.csproj +++ b/FlowerShop/FlowerShopContracts/FlowerShopContracts.csproj @@ -10,10 +10,4 @@ - - - - - - diff --git a/FlowerShop/FlowerShopContracts/StoragesContracts/IBouquetStorage.cs b/FlowerShop/FlowerShopContracts/StoragesContracts/IBouquetStorage.cs new file mode 100644 index 0000000..3243a87 --- /dev/null +++ b/FlowerShop/FlowerShopContracts/StoragesContracts/IBouquetStorage.cs @@ -0,0 +1,16 @@ +using FlowerShopContracts.BindingModels; +using FlowerShopContracts.SearchModels; +using FlowerShopContracts.ViewModels; + +namespace FlowerShopContracts.StoragesContracts +{ + public interface IBouquetStorage + { + List GetFullList(); + List GetFilteredList(BouquetSearchModel model); + BouquetViewModel? GetElement(BouquetSearchModel model); + BouquetViewModel? Insert(BouquetBindingModel model); + BouquetViewModel? Update(BouquetBindingModel model); + BouquetViewModel? Delete(BouquetBindingModel model); + } +} diff --git a/FlowerShop/FlowerShopContracts/StoragesContracts/IComponentStorage.cs b/FlowerShop/FlowerShopContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..355796c --- /dev/null +++ b/FlowerShop/FlowerShopContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,16 @@ +using FlowerShopContracts.BindingModels; +using FlowerShopContracts.SearchModels; +using FlowerShopContracts.ViewModels; + +namespace FlowerShopContracts.StoragesContracts +{ + public interface IComponentStorage + { + List GetFullList(); + List GetFilteredList(ComponentSearchModel model); + ComponentViewModel? GetElement(ComponentSearchModel model); + ComponentViewModel? Insert(ComponentBindingModel model); + ComponentViewModel? Update(ComponentBindingModel model); + ComponentViewModel? Delete(ComponentBindingModel model); + } +} \ No newline at end of file diff --git a/FlowerShop/FlowerShopContracts/StoragesContracts/IOrderStorage.cs b/FlowerShop/FlowerShopContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..c0f34d9 --- /dev/null +++ b/FlowerShop/FlowerShopContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,16 @@ +using FlowerShopContracts.BindingModels; +using FlowerShopContracts.SearchModels; +using FlowerShopContracts.ViewModels; + +namespace FlowerShopContracts.StoragesContracts +{ + public interface IOrderStorage + { + List GetFullList(); + List GetFilteredList(OrderSearchModel model); + OrderViewModel? GetElement(OrderSearchModel model); + OrderViewModel? Insert(OrderBindingModel model); + OrderViewModel? Update(OrderBindingModel model); + OrderViewModel? Delete(OrderBindingModel model); + } +} diff --git a/FlowerShop/FlowerShopContracts/ViewModels/BouquetViewModel.cs b/FlowerShop/FlowerShopContracts/ViewModels/BouquetViewModel.cs new file mode 100644 index 0000000..2a7d6ed --- /dev/null +++ b/FlowerShop/FlowerShopContracts/ViewModels/BouquetViewModel.cs @@ -0,0 +1,15 @@ +using FlowerShopDataModels.Models; +using System.ComponentModel; + +namespace FlowerShopContracts.ViewModels +{ + public class BouquetViewModel : IBouquetModel + { + public int Id { get; set; } + [DisplayName("Название букета")] + public string BouquetName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Price { get; set; } + public Dictionary BouquetComponents { get; set; } = new(); + } +} diff --git a/FlowerShop/FlowerShopContracts/ViewModels/ComponentViewModel.cs b/FlowerShop/FlowerShopContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..3a06a8f --- /dev/null +++ b/FlowerShop/FlowerShopContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,14 @@ +using FlowerShopDataModels.Models; +using System.ComponentModel; + +namespace FlowerShopContracts.ViewModels +{ + public class ComponentViewModel : IComponentModel + { + public int Id { get; set; } + [DisplayName("Название компонента")] + public string ComponentName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Cost { get; set; } + } +} diff --git a/FlowerShop/FlowerShopContracts/ViewModels/OrderViewModel.cs b/FlowerShop/FlowerShopContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..397a029 --- /dev/null +++ b/FlowerShop/FlowerShopContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,25 @@ +using FlowerShopDataModels.Enums; +using FlowerShopDataModels.Models; +using System.ComponentModel; + +namespace FlowerShopContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + public int BouquetId { get; set; } + [DisplayName("Букет")] + public string BouquetName { get; set; } = string.Empty; + [DisplayName("Количество")] + public int Count { get; set; } + [DisplayName("Сумма")] + public double Sum { get; set; } + [DisplayName("Статус")] + public OrderStatus Status { get; set; } = OrderStatus.Unknown; + [DisplayName("Дата создания")] + public DateTime DateCreate { get; set; } = DateTime.Now; + [DisplayName("Дата выполнения")] + public DateTime? DateImplement { get; set; } + } +} diff --git a/FlowerShop/FlowerShopDataModels/OrderStatus.cs b/FlowerShop/FlowerShopDataModels/OrderStatus.cs index 583cc02..a93420b 100644 --- a/FlowerShop/FlowerShopDataModels/OrderStatus.cs +++ b/FlowerShop/FlowerShopDataModels/OrderStatus.cs @@ -6,6 +6,6 @@ Accepted = 0, Processing = 1, Ready = 2, - Issued = 3 + Delivered = 3 } }