From 51d49cd7aebdeb217ad75e79f2a4a0c11e7114bc Mon Sep 17 00:00:00 2001 From: tellsense Date: Wed, 14 Feb 2024 21:06:58 +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=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0?= =?UTF-8?q?=20SushiBarContracts.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar.sln | 6 ++++ .../BindingModels/ComponentBindingModel.cs | 16 ++++++++++ .../BindingModels/OrderBindingModel.cs | 22 ++++++++++++++ .../BindingModels/SushiBindingModel.cs | 21 +++++++++++++ .../IComponentLogic.cs | 21 +++++++++++++ .../BusinessLogicsContracts/IOrderLogic.cs | 21 +++++++++++++ .../BusinessLogicsContracts/ISushiLogic.cs | 21 +++++++++++++ .../SearchModels/ComponentSearchModel.cs | 14 +++++++++ .../SearchModels/OrderSearchModel.cs | 14 +++++++++ .../SearchModels/SushiSearchModel.cs | 14 +++++++++ .../StoragesContracts/IComponentStorage.cs | 22 ++++++++++++++ .../StoragesContracts/IOrderStorage.cs | 22 ++++++++++++++ .../StoragesContracts/ISushiStorage.cs | 22 ++++++++++++++ .../SushiBarContracts.csproj | 13 ++++++++ .../ViewModels/ComponentViewModel.cs | 20 +++++++++++++ .../ViewModels/OrderViewModel.cs | 30 +++++++++++++++++++ .../ViewModels/SushiViewModel.cs | 24 +++++++++++++++ .../SushiBarDataModels/IComponentModel.cs | 2 +- SushiBar/SushiBarDataModels/IOrderModel.cs | 4 +-- SushiBar/SushiBarDataModels/IProductModel.cs | 16 ---------- SushiBar/SushiBarDataModels/ISushiModel.cs | 16 ++++++++++ 21 files changed, 342 insertions(+), 19 deletions(-) create mode 100644 SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs create mode 100644 SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs create mode 100644 SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs create mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs create mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs create mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs create mode 100644 SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs create mode 100644 SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs create mode 100644 SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs create mode 100644 SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs create mode 100644 SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs create mode 100644 SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs create mode 100644 SushiBar/SushiBarContracts/SushiBarContracts.csproj create mode 100644 SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs create mode 100644 SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs create mode 100644 SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs delete mode 100644 SushiBar/SushiBarDataModels/IProductModel.cs create mode 100644 SushiBar/SushiBarDataModels/ISushiModel.cs diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index bb3b28d..a7abd5b 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiB EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{CF80CDC9-4579-4A90-B1E0-3929F0DFB872}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{EED78058-8732-4C80-8D47-6E190EB80952}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {CF80CDC9-4579-4A90-B1E0-3929F0DFB872}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF80CDC9-4579-4A90-B1E0-3929F0DFB872}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF80CDC9-4579-4A90-B1E0-3929F0DFB872}.Release|Any CPU.Build.0 = Release|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..07d1170 --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,16 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BindingModels +{ + public class ComponentBindingModel : IComponentModel + { + public int Id { get; set; } + public string ComponentName { get; set; } = string.Empty; + public double Cost { get; set; } + } +} diff --git a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..42f4f98 --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,22 @@ +using SushiBarDataModels.Enums; +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BindingModels +{ + 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/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs new file mode 100644 index 0000000..795bcbd --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs @@ -0,0 +1,21 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BindingModels +{ + 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/SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..2422874 --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..a73972c --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs new file mode 100644 index 0000000..32c732b --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..a69687d --- /dev/null +++ b/SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + public string? ComponentName { get; set; } + } +} diff --git a/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..fdf186f --- /dev/null +++ b/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } + +} diff --git a/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs new file mode 100644 index 0000000..95d2732 --- /dev/null +++ b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.SearchModels +{ + public class SushiSearchModel + { + public int? Id { get; set; } + public string? SushiName { get; set; } + } +} diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..2ab6e9c --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,22 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..5d310e8 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,22 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs new file mode 100644 index 0000000..4aab129 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs @@ -0,0 +1,22 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/SushiBarContracts.csproj b/SushiBar/SushiBarContracts/SushiBarContracts.csproj new file mode 100644 index 0000000..ef52534 --- /dev/null +++ b/SushiBar/SushiBarContracts/SushiBarContracts.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..3d112ef --- /dev/null +++ b/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,20 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..ec4c5a3 --- /dev/null +++ b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,30 @@ +using SushiBarDataModels.Enums; +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs new file mode 100644 index 0000000..2463a83 --- /dev/null +++ b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs @@ -0,0 +1,24 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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(); + } +} diff --git a/SushiBar/SushiBarDataModels/IComponentModel.cs b/SushiBar/SushiBarDataModels/IComponentModel.cs index d218171..f0cba33 100644 --- a/SushiBar/SushiBarDataModels/IComponentModel.cs +++ b/SushiBar/SushiBarDataModels/IComponentModel.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SushiBarDataModels +namespace SushiBarDataModels.Models { public interface IComponentModel : IId { diff --git a/SushiBar/SushiBarDataModels/IOrderModel.cs b/SushiBar/SushiBarDataModels/IOrderModel.cs index 7f16a72..38a66b1 100644 --- a/SushiBar/SushiBarDataModels/IOrderModel.cs +++ b/SushiBar/SushiBarDataModels/IOrderModel.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SushiBarDataModels +namespace SushiBarDataModels.Models { public interface IOrderModel : IId { - int ProductId { get; } + int SushiId { get; } int Count { get; } double Sum { get; } OrderStatus Status { get; } diff --git a/SushiBar/SushiBarDataModels/IProductModel.cs b/SushiBar/SushiBarDataModels/IProductModel.cs deleted file mode 100644 index 2950ba4..0000000 --- a/SushiBar/SushiBarDataModels/IProductModel.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SushiBarDataModels -{ - public interface IProductModel : IId - { - string ProductName { get; } - double Price { get; } - Dictionary ProductComponents { get; } - } - -} diff --git a/SushiBar/SushiBarDataModels/ISushiModel.cs b/SushiBar/SushiBarDataModels/ISushiModel.cs new file mode 100644 index 0000000..e7ed3a3 --- /dev/null +++ b/SushiBar/SushiBarDataModels/ISushiModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarDataModels.Models +{ + public interface ISushiModel : IId + { + string SushiName { get; } + double Price { get; } + Dictionary SushiComponents { get; } + } + +}