From 09c564caaeb50bd4ec4a54678d2447241e392f7b Mon Sep 17 00:00:00 2001 From: ekallin Date: Sun, 25 Feb 2024 19:29:35 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D0=BA=D0=B0=20SushiBarContracts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar.sln | 6 +++ .../BindingModel/ComponentBindingModel.cs | 11 ++++++ .../BindingModel/OrderBindingModel.cs | 22 +++++++++++ .../BindingModel/SushiBindingModel.cs | 12 ++++++ .../IComponentLogic.cs | 15 ++++++++ .../BusinessLogicsContracts/IOrderLogic.cs | 15 ++++++++ .../BusinessLogicsContracts/ISushiLogic.cs | 16 ++++++++ .../SearchModel/ComponentSearchModel.cs | 9 +++++ .../SearchModel/OrderSearchModel.cs | 13 +++++++ .../SearchModel/SushiSearchModel.cs | 8 ++++ .../StoragesContracts/IComponentStorage.cs | 16 ++++++++ .../StoragesContracts/IOrderStorage.cs | 16 ++++++++ .../StoragesContracts/ISushiStorage.cs | 16 ++++++++ SushiBarContracts/SushiBarContracts.csproj | 13 +++++++ .../ViewModels/ComponentViewModel.cs | 18 +++++++++ .../ViewModels/OrderViewModel.cs | 38 +++++++++++++++++++ .../ViewModels/SushiViewModel.cs | 23 +++++++++++ 17 files changed, 267 insertions(+) create mode 100644 SushiBarContracts/BindingModel/ComponentBindingModel.cs create mode 100644 SushiBarContracts/BindingModel/OrderBindingModel.cs create mode 100644 SushiBarContracts/BindingModel/SushiBindingModel.cs create mode 100644 SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs create mode 100644 SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs create mode 100644 SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs create mode 100644 SushiBarContracts/SearchModel/ComponentSearchModel.cs create mode 100644 SushiBarContracts/SearchModel/OrderSearchModel.cs create mode 100644 SushiBarContracts/SearchModel/SushiSearchModel.cs create mode 100644 SushiBarContracts/StoragesContracts/IComponentStorage.cs create mode 100644 SushiBarContracts/StoragesContracts/IOrderStorage.cs create mode 100644 SushiBarContracts/StoragesContracts/ISushiStorage.cs create mode 100644 SushiBarContracts/SushiBarContracts.csproj create mode 100644 SushiBarContracts/ViewModels/ComponentViewModel.cs create mode 100644 SushiBarContracts/ViewModels/OrderViewModel.cs create mode 100644 SushiBarContracts/ViewModels/SushiViewModel.cs diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index b6947c8..6400d68 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBar", "SushiBar.csproj EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "..\SushiBarDataModels\SushiBarDataModels.csproj", "{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "..\SushiBarContracts\SushiBarContracts.csproj", "{0C8B928F-ACD2-4196-8F2B-5190914911D8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}.Debug|Any CPU.Build.0 = Debug|Any CPU {98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}.Release|Any CPU.ActiveCfg = Release|Any CPU {98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}.Release|Any CPU.Build.0 = Release|Any CPU + {0C8B928F-ACD2-4196-8F2B-5190914911D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C8B928F-ACD2-4196-8F2B-5190914911D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C8B928F-ACD2-4196-8F2B-5190914911D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C8B928F-ACD2-4196-8F2B-5190914911D8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SushiBarContracts/BindingModel/ComponentBindingModel.cs b/SushiBarContracts/BindingModel/ComponentBindingModel.cs new file mode 100644 index 0000000..9a151cb --- /dev/null +++ b/SushiBarContracts/BindingModel/ComponentBindingModel.cs @@ -0,0 +1,11 @@ +using SushiBarDataModels.Models; + +namespace SushiBarContracts.BindingModel +{ + public class ComponentBindingModel : IComponentModel + { + public int Id { get; set; } + public string ComponentName { get; set; } = string.Empty; + public double Cost { get; set; } + } +} diff --git a/SushiBarContracts/BindingModel/OrderBindingModel.cs b/SushiBarContracts/BindingModel/OrderBindingModel.cs new file mode 100644 index 0000000..a7e09b7 --- /dev/null +++ b/SushiBarContracts/BindingModel/OrderBindingModel.cs @@ -0,0 +1,22 @@ +using SushiBarDataModels; +using SushiBarDataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BindingModel +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + public int SushiId { get; set; } + public int Count { get; set; } + public double Sum { get; set; } + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + public DateTime DateCreate { get; set; } = DateTime.Now; + public DateTime? DateImplement { get; set; } + + } +} diff --git a/SushiBarContracts/BindingModel/SushiBindingModel.cs b/SushiBarContracts/BindingModel/SushiBindingModel.cs new file mode 100644 index 0000000..4975850 --- /dev/null +++ b/SushiBarContracts/BindingModel/SushiBindingModel.cs @@ -0,0 +1,12 @@ +using SushiBarDataModels.Models; + +namespace SushiBarContracts.BindingModel +{ + public class SushiBindingModel : ISushiModel + { + public int Id { get; set; } + public string SushiName { get; set; } = string.Empty; + public double Price { get; set; } + public Dictionary SushiComponents { get; set; } = new(); + } +} diff --git a/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs b/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..d613a25 --- /dev/null +++ b/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,15 @@ +using SushiBarContracts.BindingModel; +using SushiBarContracts.SearchModel; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.BusinessLogicsContracts +{ + public interface IComponentLogic + { + List? ReadList(ComponentSearchModel? model); + ComponentViewModel? ReadElement(ComponentSearchModel model); + bool Create(ComponentBindingModel model); + bool Update(ComponentBindingModel model); + bool Delete(ComponentBindingModel model); + } +} diff --git a/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs b/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..c161184 --- /dev/null +++ b/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,15 @@ +using SushiBarContracts.BindingModel; +using SushiBarContracts.SearchModel; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.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/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs b/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs new file mode 100644 index 0000000..5f34747 --- /dev/null +++ b/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs @@ -0,0 +1,16 @@ +using SushiBarContracts.BindingModel; +using SushiBarContracts.SearchModel; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.BusinessLogicsContracts +{ + public interface ISushiLogic + { + List? ReadList(SushiSearchModel? model); + SushiViewModel? ReadElement(SushiSearchModel model); + bool Create(SushiBindingModel model); + bool Update(SushiBindingModel model); + bool Delete(SushiBindingModel model); + + } +} diff --git a/SushiBarContracts/SearchModel/ComponentSearchModel.cs b/SushiBarContracts/SearchModel/ComponentSearchModel.cs new file mode 100644 index 0000000..80aa9a4 --- /dev/null +++ b/SushiBarContracts/SearchModel/ComponentSearchModel.cs @@ -0,0 +1,9 @@ + +namespace SushiBarContracts.SearchModel +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + public string? ComponentName { get; set; } + } +} diff --git a/SushiBarContracts/SearchModel/OrderSearchModel.cs b/SushiBarContracts/SearchModel/OrderSearchModel.cs new file mode 100644 index 0000000..4223941 --- /dev/null +++ b/SushiBarContracts/SearchModel/OrderSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.SearchModel +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } +} diff --git a/SushiBarContracts/SearchModel/SushiSearchModel.cs b/SushiBarContracts/SearchModel/SushiSearchModel.cs new file mode 100644 index 0000000..9bd3f9c --- /dev/null +++ b/SushiBarContracts/SearchModel/SushiSearchModel.cs @@ -0,0 +1,8 @@ +namespace SushiBarContracts.SearchModel +{ + public class SushiSearchModel + { + public int? Id { get; set; } + public string? SushiName { get; set; } + } +} diff --git a/SushiBarContracts/StoragesContracts/IComponentStorage.cs b/SushiBarContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..690e5d0 --- /dev/null +++ b/SushiBarContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,16 @@ +using SushiBarContracts.BindingModel; +using SushiBarContracts.SearchModel; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.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); + } +} diff --git a/SushiBarContracts/StoragesContracts/IOrderStorage.cs b/SushiBarContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..48999d7 --- /dev/null +++ b/SushiBarContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,16 @@ +using SushiBarContracts.BindingModel; +using SushiBarContracts.SearchModel; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.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/SushiBarContracts/StoragesContracts/ISushiStorage.cs b/SushiBarContracts/StoragesContracts/ISushiStorage.cs new file mode 100644 index 0000000..9773e8b --- /dev/null +++ b/SushiBarContracts/StoragesContracts/ISushiStorage.cs @@ -0,0 +1,16 @@ +using SushiBarContracts.BindingModel; +using SushiBarContracts.SearchModel; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.StoragesContracts +{ + public interface ISushiStorage + { + List GetFullList(); + List GetFilteredList(SushiSearchModel model); + SushiViewModel? GetElement(SushiSearchModel model); + SushiViewModel? Insert(SushiBindingModel model); + SushiViewModel? Update(SushiBindingModel model); + SushiViewModel? Delete(SushiBindingModel model); + } +} diff --git a/SushiBarContracts/SushiBarContracts.csproj b/SushiBarContracts/SushiBarContracts.csproj new file mode 100644 index 0000000..24184cb --- /dev/null +++ b/SushiBarContracts/SushiBarContracts.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/SushiBarContracts/ViewModels/ComponentViewModel.cs b/SushiBarContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..328e429 --- /dev/null +++ b/SushiBarContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,18 @@ +using System.ComponentModel; +using SushiBarDataModels.Models; + +namespace SushiBarContracts.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/SushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBarContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..0093487 --- /dev/null +++ b/SushiBarContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,38 @@ +using System.ComponentModel; +using SushiBarDataModels.Models; +using SushiBarDataModels.Enums; +using SushiBarDataModels; + +namespace SushiBarContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + public int SushiId { get; set; } + + + [DisplayName("Изделие")] + public string SushiName { get; set; } = string.Empty; + + + [DisplayName("Количество")] + public int Count { get; set; } + + + [DisplayName("Сумма")] + public double Sum { get; set; } + + + [DisplayName("Статус")] + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + + + [DisplayName("Дата создания")] + public DateTime DateCreate { get; set; } = DateTime.Now; + + + [DisplayName("Дата выполнения")] + public DateTime? DateImplement { get; set; } + } +} diff --git a/SushiBarContracts/ViewModels/SushiViewModel.cs b/SushiBarContracts/ViewModels/SushiViewModel.cs new file mode 100644 index 0000000..2018924 --- /dev/null +++ b/SushiBarContracts/ViewModels/SushiViewModel.cs @@ -0,0 +1,23 @@ +using System.ComponentModel; +using SushiBarDataModels.Models; + +namespace SushiBarContracts.ViewModels +{ + public class SushiViewModel : ISushiModel + { + public int Id { get; set; } + [DisplayName("Название изделия")] + + + public string SushiName { get; set; } = string.Empty; + [DisplayName("Цена")] + + + public double Price { get; set; } + public Dictionary SushiComponents + { + get; + set; + } = new(); + } +}