From e199c30eec535fccf093e666ea134b1e1d4a436e Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 5 Feb 2024 14:40:27 +0400 Subject: [PATCH 01/22] =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar.sln | 25 ++++++ SushiBar/SushiBar/Form1.Designer.cs | 39 +++++++++ SushiBar/SushiBar/Form1.cs | 10 +++ SushiBar/SushiBar/Form1.resx | 120 ++++++++++++++++++++++++++++ SushiBar/SushiBar/Program.cs | 17 ++++ SushiBar/SushiBar/SushiBar.csproj | 11 +++ 6 files changed, 222 insertions(+) create mode 100644 SushiBar/SushiBar.sln create mode 100644 SushiBar/SushiBar/Form1.Designer.cs create mode 100644 SushiBar/SushiBar/Form1.cs create mode 100644 SushiBar/SushiBar/Form1.resx create mode 100644 SushiBar/SushiBar/Program.cs create mode 100644 SushiBar/SushiBar/SushiBar.csproj diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln new file mode 100644 index 0000000..7227a18 --- /dev/null +++ b/SushiBar/SushiBar.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5C5DF432-32EF-4281-A1A9-8B849939EEEF} + EndGlobalSection +EndGlobal diff --git a/SushiBar/SushiBar/Form1.Designer.cs b/SushiBar/SushiBar/Form1.Designer.cs new file mode 100644 index 0000000..b5f899b --- /dev/null +++ b/SushiBar/SushiBar/Form1.Designer.cs @@ -0,0 +1,39 @@ +namespace SushiBar +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "Form1"; + } + + #endregion + } +} \ No newline at end of file diff --git a/SushiBar/SushiBar/Form1.cs b/SushiBar/SushiBar/Form1.cs new file mode 100644 index 0000000..0eaa471 --- /dev/null +++ b/SushiBar/SushiBar/Form1.cs @@ -0,0 +1,10 @@ +namespace SushiBar +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/SushiBar/SushiBar/Form1.resx b/SushiBar/SushiBar/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SushiBar/SushiBar/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs new file mode 100644 index 0000000..402417b --- /dev/null +++ b/SushiBar/SushiBar/Program.cs @@ -0,0 +1,17 @@ +namespace SushiBar +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/SushiBar/SushiBar/SushiBar.csproj b/SushiBar/SushiBar/SushiBar.csproj new file mode 100644 index 0000000..b57c89e --- /dev/null +++ b/SushiBar/SushiBar/SushiBar.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + \ No newline at end of file -- 2.25.1 From b597e77637195dcce78930aec1a93819b3ae8306 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 5 Feb 2024 15:12:21 +0400 Subject: [PATCH 02/22] =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B5=D0=B9=20?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ca1c7a3..3d05129 100644 --- a/.gitignore +++ b/.gitignore @@ -398,3 +398,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +*.csproj -- 2.25.1 From 512a6055105878166dbecdf5f95aef392d913ce6 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 5 Feb 2024 15:12:53 +0400 Subject: [PATCH 03/22] =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BD=D0=BE=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=BD=D0=BB=D0=B5=D0=B9?= =?UTF-8?q?=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractSushiBarDataModels.sln | 25 +++++++++++++++++++ .../Enums/OrderStatus.cs | 11 ++++++++ .../AbstractSushiBarDataModels/IId.cs | 7 ++++++ .../Models/IComponentModel.cs | 8 ++++++ .../Models/IOrderModel.cs | 14 +++++++++++ .../Models/IProductModel.cs | 12 +++++++++ 6 files changed, 77 insertions(+) create mode 100644 AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln create mode 100644 AbstractSushiBarDataModels/AbstractSushiBarDataModels/Enums/OrderStatus.cs create mode 100644 AbstractSushiBarDataModels/AbstractSushiBarDataModels/IId.cs create mode 100644 AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IComponentModel.cs create mode 100644 AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IOrderModel.cs create mode 100644 AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IProductModel.cs diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln b/AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln new file mode 100644 index 0000000..4367961 --- /dev/null +++ b/AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractSushiBarDataModels", "AbstractSushiBarDataModels\AbstractSushiBarDataModels.csproj", "{3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {73292010-42D8-482B-90B6-CD302C7EA849} + EndGlobalSection +EndGlobal diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Enums/OrderStatus.cs b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Enums/OrderStatus.cs new file mode 100644 index 0000000..32b3cf1 --- /dev/null +++ b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Enums/OrderStatus.cs @@ -0,0 +1,11 @@ +namespace AbstractSushiBarDataModels.Enums +{ + public enum OrderStatus + { + Неизвестен = -1, + Принят = 0, + Выполняется = 1, + Готов = 2, + Выдан = 3 + } +} diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/IId.cs b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/IId.cs new file mode 100644 index 0000000..758b3fd --- /dev/null +++ b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/IId.cs @@ -0,0 +1,7 @@ +namespace AbstractSushiBarDataModels +{ + public interface IId + { + int Id { get; } + } +} diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IComponentModel.cs b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IComponentModel.cs new file mode 100644 index 0000000..0cb698d --- /dev/null +++ b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IComponentModel.cs @@ -0,0 +1,8 @@ +namespace AbstractSushiBarDataModels.Models +{ + internal interface IComponentModel : IId + { + string ComponentName { get; } + double Cost { get; } + } +} diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IOrderModel.cs b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IOrderModel.cs new file mode 100644 index 0000000..975b9fc --- /dev/null +++ b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IOrderModel.cs @@ -0,0 +1,14 @@ +using AbstractSushiBarDataModels.Enums; + +namespace AbstractSushiBarDataModels.Models +{ + internal interface IOrderModel : IId + { + int ProductId { get; } + int Count { get; } + double Sum { get; } + OrderStatus Status { get; } + DateTime DateCreate { get; } + DateTime? DateImplement { get; } + } +} diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IProductModel.cs b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IProductModel.cs new file mode 100644 index 0000000..846012f --- /dev/null +++ b/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IProductModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +namespace AbstractSushiBarDataModels.Models +{ + internal interface IProductModel : IId + { + string ProductName { get; } + double Price { get; } + Dictionary ProductComponents { get; } + } +} -- 2.25.1 From 3f5418a52040f187b9ebeef8ea2e13231c624618 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 5 Feb 2024 16:26:35 +0400 Subject: [PATCH 04/22] =?UTF-8?q?=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractSushiBarDataModels.sln | 25 ------------------- .../BindingModels/ComponentBindingModel.cs | 11 ++++++++ .../BindingModels/OrderBindingModel.cs | 16 ++++++++++++ .../BindingModels/ProductBindingModel.cs | 16 ++++++++++++ .../IComponentLogic.cs | 16 ++++++++++++ .../BusinessLogicsContracts/IOrderLogic.cs | 15 +++++++++++ .../BusinessLogicsContracts/IProductLogic.cs | 15 +++++++++++ .../SearchModels/ComponentSearchModel.cs | 8 ++++++ .../SearchModels/OrderSearchModel.cs | 7 ++++++ .../SearchModels/ProductSearchModel.cs | 8 ++++++ .../StoragesContracts/IComponentStorage.cs | 16 ++++++++++++ .../StoragesContracts/IOrderStorage.cs | 16 ++++++++++++ .../StoragesContracts/IProductStorage.cs | 16 ++++++++++++ .../ViewModels/ComponentViewModel.cs | 14 +++++++++++ .../ViewModels/OrderViewModel.cs | 25 +++++++++++++++++++ .../ViewModels/ProductViewModel.cs | 20 +++++++++++++++ .../Enums/OrderStatus.cs | 0 .../AbstractSushiBarDataModels/IId.cs | 0 .../Models/IComponentModel.cs | 2 +- .../Models/IOrderModel.cs | 2 +- .../Models/IProductModel.cs | 2 +- SushiBar/SushiBar.sln | 14 ++++++++++- 22 files changed, 235 insertions(+), 29 deletions(-) delete mode 100644 AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln create mode 100644 SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs create mode 100644 SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs create mode 100644 SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs create mode 100644 SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs create mode 100644 SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs create mode 100644 SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs create mode 100644 SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs create mode 100644 SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs rename {AbstractSushiBarDataModels => SushiBar}/AbstractSushiBarDataModels/Enums/OrderStatus.cs (100%) rename {AbstractSushiBarDataModels => SushiBar}/AbstractSushiBarDataModels/IId.cs (100%) rename {AbstractSushiBarDataModels => SushiBar}/AbstractSushiBarDataModels/Models/IComponentModel.cs (74%) rename {AbstractSushiBarDataModels => SushiBar}/AbstractSushiBarDataModels/Models/IOrderModel.cs (88%) rename {AbstractSushiBarDataModels => SushiBar}/AbstractSushiBarDataModels/Models/IProductModel.cs (86%) diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln b/AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln deleted file mode 100644 index 4367961..0000000 --- a/AbstractSushiBarDataModels/AbstractSushiBarDataModels.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.7.34031.279 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractSushiBarDataModels", "AbstractSushiBarDataModels\AbstractSushiBarDataModels.csproj", "{3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {73292010-42D8-482B-90B6-CD302C7EA849} - EndGlobalSection -EndGlobal diff --git a/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs b/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..8edc388 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,11 @@ +using AbstractSushiBarDataModels.Models; + +namespace AbstractSushiBarContracts.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/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..d37e083 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,16 @@ +using AbstractSushiBarDataModels.Enums; +using AbstractSushiBarDataModels.Models; + +namespace AbstractSushiBarContracts.BindingModels +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + public int ProductId { 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/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs b/SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs new file mode 100644 index 0000000..24e59f7 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs @@ -0,0 +1,16 @@ +using AbstractSushiBarDataModels.Models; + +namespace AbstractSushiBarContracts.BindingModels +{ + public class ProductBindingModel : IProductModel + { + public int Id { get; set; } + public string ProductName { get; set; } = string.Empty; + public double Price { get; set; } + public Dictionary ProductComponents + { + get; + set; + } = new(); + } +} diff --git a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..731a5d3 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,16 @@ +using AbstractSushiBarContracts.BindingModels; +using AbstractSushiBarContracts.SearchModels; +using AbstractSushiBarContracts.ViewModels; + +namespace AbstractSushiBarContracts.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/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..0ff7296 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,15 @@ +using AbstractSushiBarContracts.BindingModels; +using AbstractSushiBarContracts.SearchModels; +using AbstractSushiBarContracts.ViewModels; + +namespace AbstractSushiBarContracts.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/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs new file mode 100644 index 0000000..0483b5e --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs @@ -0,0 +1,15 @@ +using AbstractSushiBarContracts.BindingModels; +using AbstractSushiBarContracts.SearchModels; +using AbstractSushiBarContracts.ViewModels; + +namespace AbstractSushiBarContracts.BusinessLogicsContracts +{ + public interface IProductLogic + { + List? ReadList(ProductSearchModel? model); + ProductViewModel? ReadElement(ProductSearchModel model); + bool Create(ProductBindingModel model); + bool Update(ProductBindingModel model); + bool Delete(ProductBindingModel model); + } +} diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs b/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..524a085 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,8 @@ +namespace AbstractSushiBarContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + public string? ComponentName { get; set; } + } +} diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs b/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..21fd7e3 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,7 @@ +namespace AbstractSushiBarContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } +} diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs b/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs new file mode 100644 index 0000000..c68c49d --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs @@ -0,0 +1,8 @@ +namespace AbstractSushiBarContracts.SearchModels +{ + public class ProductSearchModel + { + public int? Id { get; set; } + public string? ProductName { get; set; } + } +} diff --git a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..e516ea7 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,16 @@ +using AbstractSushiBarContracts.BindingModels; +using AbstractSushiBarContracts.SearchModels; +using AbstractSushiBarContracts.ViewModels; + +namespace AbstractSushiBarContracts.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/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..7f4d1eb --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,16 @@ +using AbstractSushiBarContracts.BindingModels; +using AbstractSushiBarContracts.SearchModels; +using AbstractSushiBarContracts.ViewModels; + +namespace AbstractSushiBarContracts.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/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs new file mode 100644 index 0000000..e93bd8e --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs @@ -0,0 +1,16 @@ +using AbstractSushiBarContracts.BindingModels; +using AbstractSushiBarContracts.SearchModels; +using AbstractSushiBarContracts.ViewModels; + +namespace AbstractSushiBarContracts.StoragesContracts +{ + public interface IProductStorage + { + List GetFullList(); + List GetFilteredList(ProductSearchModel model); + ProductViewModel? GetElement(ProductSearchModel model); + ProductViewModel? Insert(ProductBindingModel model); + ProductViewModel? Update(ProductBindingModel model); + ProductViewModel? Delete(ProductBindingModel model); + } +} diff --git a/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs b/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..bc11a92 --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,14 @@ +using AbstractSushiBarDataModels.Models; +using System.ComponentModel; + +namespace AbstractSushiBarContracts.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/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..f6318af --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,25 @@ +using AbstractSushiBarDataModels.Enums; +using AbstractSushiBarDataModels.Models; +using System.ComponentModel; + +namespace AbstractSushiBarContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + public int ProductId { get; set; } + [DisplayName("Изделие")] + public string ProductName { 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/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs b/SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs new file mode 100644 index 0000000..55dbbbf --- /dev/null +++ b/SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs @@ -0,0 +1,20 @@ +using AbstractSushiBarDataModels.Models; +using System.ComponentModel; + +namespace AbstractSushiBarContracts.ViewModels +{ + public class ProductViewModel : IProductModel + { + public int Id { get; set; } + [DisplayName("Название изделия")] + public string ProductName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Price { get; set; } + public Dictionary ProductComponents + { + get; + set; + } = new(); + + } +} diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Enums/OrderStatus.cs b/SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs similarity index 100% rename from AbstractSushiBarDataModels/AbstractSushiBarDataModels/Enums/OrderStatus.cs rename to SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/IId.cs b/SushiBar/AbstractSushiBarDataModels/IId.cs similarity index 100% rename from AbstractSushiBarDataModels/AbstractSushiBarDataModels/IId.cs rename to SushiBar/AbstractSushiBarDataModels/IId.cs diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IComponentModel.cs b/SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs similarity index 74% rename from AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IComponentModel.cs rename to SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs index 0cb698d..136d0b8 100644 --- a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IComponentModel.cs +++ b/SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs @@ -1,6 +1,6 @@ namespace AbstractSushiBarDataModels.Models { - internal interface IComponentModel : IId + public interface IComponentModel : IId { string ComponentName { get; } double Cost { get; } diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IOrderModel.cs b/SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs similarity index 88% rename from AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IOrderModel.cs rename to SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs index 975b9fc..047d1e1 100644 --- a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IOrderModel.cs +++ b/SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs @@ -2,7 +2,7 @@ namespace AbstractSushiBarDataModels.Models { - internal interface IOrderModel : IId + public interface IOrderModel : IId { int ProductId { get; } int Count { get; } diff --git a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IProductModel.cs b/SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs similarity index 86% rename from AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IProductModel.cs rename to SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs index 846012f..a921f17 100644 --- a/AbstractSushiBarDataModels/AbstractSushiBarDataModels/Models/IProductModel.cs +++ b/SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; namespace AbstractSushiBarDataModels.Models { - internal interface IProductModel : IId + public interface IProductModel : IId { string ProductName { get; } double Price { get; } diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index 7227a18..1b8646d 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractSushiBarDataModels", "AbstractSushiBarDataModels\AbstractSushiBarDataModels.csproj", "{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractSushiBarContracts", "AbstractSushiBarContracts\AbstractSushiBarContracts.csproj", "{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +19,14 @@ Global {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.Build.0 = Release|Any CPU + {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Release|Any CPU.Build.0 = Release|Any CPU + {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- 2.25.1 From 641591bf4f1bf1f7cf96b70d4a1491a1b789d0f2 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 5 Feb 2024 16:40:47 +0400 Subject: [PATCH 05/22] =?UTF-8?q?=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B5=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/ComponentBindingModel.cs | 4 ++-- .../BindingModels/OrderBindingModel.cs | 6 +++--- .../BindingModels/ProductBindingModel.cs | 4 ++-- .../BusinessLogicsContracts/IComponentLogic.cs | 8 ++++---- .../BusinessLogicsContracts/IOrderLogic.cs | 8 ++++---- .../BusinessLogicsContracts/IProductLogic.cs | 8 ++++---- .../SearchModels/ComponentSearchModel.cs | 2 +- .../SearchModels/OrderSearchModel.cs | 2 +- .../SearchModels/ProductSearchModel.cs | 2 +- .../StoragesContracts/IComponentStorage.cs | 8 ++++---- .../StoragesContracts/IOrderStorage.cs | 8 ++++---- .../StoragesContracts/IProductStorage.cs | 8 ++++---- .../ViewModels/ComponentViewModel.cs | 4 ++-- .../ViewModels/OrderViewModel.cs | 6 +++--- .../ViewModels/ProductViewModel.cs | 4 ++-- SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs | 2 +- SushiBar/AbstractSushiBarDataModels/IId.cs | 2 +- .../AbstractSushiBarDataModels/Models/IComponentModel.cs | 2 +- SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs | 4 ++-- .../AbstractSushiBarDataModels/Models/IProductModel.cs | 2 +- SushiBar/SushiBar.sln | 4 ++-- 21 files changed, 49 insertions(+), 49 deletions(-) diff --git a/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs b/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs index 8edc388..3df23d5 100644 --- a/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs +++ b/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs @@ -1,6 +1,6 @@ -using AbstractSushiBarDataModels.Models; +using SushiBarDataModels.Models; -namespace AbstractSushiBarContracts.BindingModels +namespace SushiBarContracts.BindingModels { public class ComponentBindingModel : IComponentModel { diff --git a/SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs index d37e083..2625c77 100644 --- a/SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs +++ b/SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs @@ -1,7 +1,7 @@ -using AbstractSushiBarDataModels.Enums; -using AbstractSushiBarDataModels.Models; +using SushiBarDataModels.Enums; +using SushiBarDataModels.Models; -namespace AbstractSushiBarContracts.BindingModels +namespace SushiBarContracts.BindingModels { public class OrderBindingModel : IOrderModel { diff --git a/SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs b/SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs index 24e59f7..13c12c0 100644 --- a/SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs +++ b/SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs @@ -1,6 +1,6 @@ -using AbstractSushiBarDataModels.Models; +using SushiBarDataModels.Models; -namespace AbstractSushiBarContracts.BindingModels +namespace SushiBarContracts.BindingModels { public class ProductBindingModel : IProductModel { diff --git a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs index 731a5d3..d75c9f1 100644 --- a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs +++ b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -1,8 +1,8 @@ -using AbstractSushiBarContracts.BindingModels; -using AbstractSushiBarContracts.SearchModels; -using AbstractSushiBarContracts.ViewModels; +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; -namespace AbstractSushiBarContracts.BusinessLogicsContracts +namespace SushiBarContracts.BusinessLogicsContracts { public interface IComponentLogic { diff --git a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs index 0ff7296..be0cb58 100644 --- a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs +++ b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -1,8 +1,8 @@ -using AbstractSushiBarContracts.BindingModels; -using AbstractSushiBarContracts.SearchModels; -using AbstractSushiBarContracts.ViewModels; +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; -namespace AbstractSushiBarContracts.BusinessLogicsContracts +namespace SushiBarContracts.BusinessLogicsContracts { public interface IOrderLogic { diff --git a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs index 0483b5e..96217a1 100644 --- a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs +++ b/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs @@ -1,8 +1,8 @@ -using AbstractSushiBarContracts.BindingModels; -using AbstractSushiBarContracts.SearchModels; -using AbstractSushiBarContracts.ViewModels; +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; -namespace AbstractSushiBarContracts.BusinessLogicsContracts +namespace SushiBarContracts.BusinessLogicsContracts { public interface IProductLogic { diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs b/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs index 524a085..3e9c31b 100644 --- a/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs +++ b/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs @@ -1,4 +1,4 @@ -namespace AbstractSushiBarContracts.SearchModels +namespace SushiBarContracts.SearchModels { public class ComponentSearchModel { diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs b/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs index 21fd7e3..becbcd5 100644 --- a/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs +++ b/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs @@ -1,4 +1,4 @@ -namespace AbstractSushiBarContracts.SearchModels +namespace SushiBarContracts.SearchModels { public class OrderSearchModel { diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs b/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs index c68c49d..86bc1d7 100644 --- a/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs +++ b/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs @@ -1,4 +1,4 @@ -namespace AbstractSushiBarContracts.SearchModels +namespace SushiBarContracts.SearchModels { public class ProductSearchModel { diff --git a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs index e516ea7..2f18178 100644 --- a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs +++ b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs @@ -1,8 +1,8 @@ -using AbstractSushiBarContracts.BindingModels; -using AbstractSushiBarContracts.SearchModels; -using AbstractSushiBarContracts.ViewModels; +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; -namespace AbstractSushiBarContracts.StoragesContracts +namespace SushiBarContracts.StoragesContracts { public interface IComponentStorage { diff --git a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs index 7f4d1eb..f337dbf 100644 --- a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs +++ b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs @@ -1,8 +1,8 @@ -using AbstractSushiBarContracts.BindingModels; -using AbstractSushiBarContracts.SearchModels; -using AbstractSushiBarContracts.ViewModels; +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; -namespace AbstractSushiBarContracts.StoragesContracts +namespace SushiBarContracts.StoragesContracts { public interface IOrderStorage { diff --git a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs index e93bd8e..16e3db4 100644 --- a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs +++ b/SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs @@ -1,8 +1,8 @@ -using AbstractSushiBarContracts.BindingModels; -using AbstractSushiBarContracts.SearchModels; -using AbstractSushiBarContracts.ViewModels; +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; -namespace AbstractSushiBarContracts.StoragesContracts +namespace SushiBarContracts.StoragesContracts { public interface IProductStorage { diff --git a/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs b/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs index bc11a92..f879afc 100644 --- a/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs +++ b/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs @@ -1,7 +1,7 @@ -using AbstractSushiBarDataModels.Models; +using SushiBarDataModels.Models; using System.ComponentModel; -namespace AbstractSushiBarContracts.ViewModels +namespace SushiBarContracts.ViewModels { public class ComponentViewModel : IComponentModel { diff --git a/SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs index f6318af..9988699 100644 --- a/SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs +++ b/SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs @@ -1,8 +1,8 @@ -using AbstractSushiBarDataModels.Enums; -using AbstractSushiBarDataModels.Models; +using SushiBarDataModels.Enums; +using SushiBarDataModels.Models; using System.ComponentModel; -namespace AbstractSushiBarContracts.ViewModels +namespace SushiBarContracts.ViewModels { public class OrderViewModel : IOrderModel { diff --git a/SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs b/SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs index 55dbbbf..67b02e2 100644 --- a/SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs +++ b/SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs @@ -1,7 +1,7 @@ -using AbstractSushiBarDataModels.Models; +using SushiBarDataModels.Models; using System.ComponentModel; -namespace AbstractSushiBarContracts.ViewModels +namespace SushiBarContracts.ViewModels { public class ProductViewModel : IProductModel { diff --git a/SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs b/SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs index 32b3cf1..64556e2 100644 --- a/SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs +++ b/SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs @@ -1,4 +1,4 @@ -namespace AbstractSushiBarDataModels.Enums +namespace SushiBarDataModels.Enums { public enum OrderStatus { diff --git a/SushiBar/AbstractSushiBarDataModels/IId.cs b/SushiBar/AbstractSushiBarDataModels/IId.cs index 758b3fd..2b4af59 100644 --- a/SushiBar/AbstractSushiBarDataModels/IId.cs +++ b/SushiBar/AbstractSushiBarDataModels/IId.cs @@ -1,4 +1,4 @@ -namespace AbstractSushiBarDataModels +namespace SushiBarDataModels { public interface IId { diff --git a/SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs b/SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs index 136d0b8..93c68db 100644 --- a/SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs +++ b/SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs @@ -1,4 +1,4 @@ -namespace AbstractSushiBarDataModels.Models +namespace SushiBarDataModels.Models { public interface IComponentModel : IId { diff --git a/SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs b/SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs index 047d1e1..501a9dc 100644 --- a/SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs +++ b/SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs @@ -1,6 +1,6 @@ -using AbstractSushiBarDataModels.Enums; +using SushiBarDataModels.Enums; -namespace AbstractSushiBarDataModels.Models +namespace SushiBarDataModels.Models { public interface IOrderModel : IId { diff --git a/SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs b/SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs index a921f17..a28a0bc 100644 --- a/SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs +++ b/SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -namespace AbstractSushiBarDataModels.Models +namespace SushiBarDataModels.Models { public interface IProductModel : IId { diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index 1b8646d..7bfc06a 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -5,9 +5,9 @@ VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractSushiBarDataModels", "AbstractSushiBarDataModels\AbstractSushiBarDataModels.csproj", "{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "AbstractSushiBarDataModels\SushiBarDataModels.csproj", "{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractSushiBarContracts", "AbstractSushiBarContracts\AbstractSushiBarContracts.csproj", "{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "AbstractSushiBarContracts\SushiBarContracts.csproj", "{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution -- 2.25.1 From 0b22e235a20b4d66df79f792326d04a02db3fa7b Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 5 Feb 2024 16:44:05 +0400 Subject: [PATCH 06/22] =?UTF-8?q?=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar.sln | 20 +++++++++---------- .../BindingModels/ComponentBindingModel.cs | 0 .../BindingModels/OrderBindingModel.cs | 0 .../BindingModels/ProductBindingModel.cs | 0 .../IComponentLogic.cs | 0 .../BusinessLogicsContracts/IOrderLogic.cs | 0 .../BusinessLogicsContracts/IProductLogic.cs | 0 .../SearchModels/ComponentSearchModel.cs | 0 .../SearchModels/OrderSearchModel.cs | 0 .../SearchModels/ProductSearchModel.cs | 0 .../StoragesContracts/IComponentStorage.cs | 0 .../StoragesContracts/IOrderStorage.cs | 0 .../StoragesContracts/IProductStorage.cs | 0 .../ViewModels/ComponentViewModel.cs | 0 .../ViewModels/OrderViewModel.cs | 0 .../ViewModels/ProductViewModel.cs | 0 .../Enums/OrderStatus.cs | 0 .../IId.cs | 0 .../Models/IComponentModel.cs | 0 .../Models/IOrderModel.cs | 0 .../Models/IProductModel.cs | 0 21 files changed, 10 insertions(+), 10 deletions(-) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/BindingModels/ComponentBindingModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/BindingModels/OrderBindingModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/BindingModels/ProductBindingModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/BusinessLogicsContracts/IComponentLogic.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/BusinessLogicsContracts/IOrderLogic.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/BusinessLogicsContracts/IProductLogic.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/SearchModels/ComponentSearchModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/SearchModels/OrderSearchModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/SearchModels/ProductSearchModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/StoragesContracts/IComponentStorage.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/StoragesContracts/IOrderStorage.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/StoragesContracts/IProductStorage.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/ViewModels/ComponentViewModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/ViewModels/OrderViewModel.cs (100%) rename SushiBar/{AbstractSushiBarContracts => SushiBarContracts}/ViewModels/ProductViewModel.cs (100%) rename SushiBar/{AbstractSushiBarDataModels => SushiBarDataModels}/Enums/OrderStatus.cs (100%) rename SushiBar/{AbstractSushiBarDataModels => SushiBarDataModels}/IId.cs (100%) rename SushiBar/{AbstractSushiBarDataModels => SushiBarDataModels}/Models/IComponentModel.cs (100%) rename SushiBar/{AbstractSushiBarDataModels => SushiBarDataModels}/Models/IOrderModel.cs (100%) rename SushiBar/{AbstractSushiBarDataModels => SushiBarDataModels}/Models/IProductModel.cs (100%) diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index 7bfc06a..bf77c21 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -5,9 +5,9 @@ VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "AbstractSushiBarDataModels\SushiBarDataModels.csproj", "{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{968304F1-7A64-49F1-B27A-48AED7C7754D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "AbstractSushiBarContracts\SushiBarContracts.csproj", "{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -19,14 +19,14 @@ Global {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.Build.0 = Release|Any CPU - {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Release|Any CPU.Build.0 = Release|Any CPU - {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Release|Any CPU.Build.0 = Release|Any CPU + {968304F1-7A64-49F1-B27A-48AED7C7754D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {968304F1-7A64-49F1-B27A-48AED7C7754D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {968304F1-7A64-49F1-B27A-48AED7C7754D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {968304F1-7A64-49F1-B27A-48AED7C7754D}.Release|Any CPU.Build.0 = Release|Any CPU + {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/BindingModels/ComponentBindingModel.cs rename to SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/BindingModels/OrderBindingModel.cs rename to SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/BindingModels/ProductBindingModel.cs rename to SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs rename to SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs diff --git a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs rename to SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs diff --git a/SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/BusinessLogicsContracts/IProductLogic.cs rename to SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/SearchModels/ComponentSearchModel.cs rename to SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/SearchModels/OrderSearchModel.cs rename to SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/SearchModels/ProductSearchModel.cs rename to SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/StoragesContracts/IComponentStorage.cs rename to SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs diff --git a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/StoragesContracts/IOrderStorage.cs rename to SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs diff --git a/SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/StoragesContracts/IProductStorage.cs rename to SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs diff --git a/SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/ViewModels/ComponentViewModel.cs rename to SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/ViewModels/OrderViewModel.cs rename to SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs diff --git a/SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarContracts/ViewModels/ProductViewModel.cs rename to SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs diff --git a/SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs b/SushiBar/SushiBarDataModels/Enums/OrderStatus.cs similarity index 100% rename from SushiBar/AbstractSushiBarDataModels/Enums/OrderStatus.cs rename to SushiBar/SushiBarDataModels/Enums/OrderStatus.cs diff --git a/SushiBar/AbstractSushiBarDataModels/IId.cs b/SushiBar/SushiBarDataModels/IId.cs similarity index 100% rename from SushiBar/AbstractSushiBarDataModels/IId.cs rename to SushiBar/SushiBarDataModels/IId.cs diff --git a/SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs b/SushiBar/SushiBarDataModels/Models/IComponentModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarDataModels/Models/IComponentModel.cs rename to SushiBar/SushiBarDataModels/Models/IComponentModel.cs diff --git a/SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs b/SushiBar/SushiBarDataModels/Models/IOrderModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarDataModels/Models/IOrderModel.cs rename to SushiBar/SushiBarDataModels/Models/IOrderModel.cs diff --git a/SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs b/SushiBar/SushiBarDataModels/Models/IProductModel.cs similarity index 100% rename from SushiBar/AbstractSushiBarDataModels/Models/IProductModel.cs rename to SushiBar/SushiBarDataModels/Models/IProductModel.cs -- 2.25.1 From 026c32fb76d8324bb2e461d4877fe721250df509 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 5 Feb 2024 18:10:41 +0400 Subject: [PATCH 07/22] =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=B1=D0=B8=D0=B7=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar.sln | 6 + .../BusinessLogics/ComponentLogic.cs | 109 +++++++++++++++ .../BusinessLogics/OrderLogic.cs | 132 ++++++++++++++++++ .../BusinessLogics/ProductLogic.cs | 106 ++++++++++++++ 4 files changed, 353 insertions(+) create mode 100644 SushiBar/SushiBarBusinessLogic/BusinessLogics/ComponentLogic.cs create mode 100644 SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs create mode 100644 SushiBar/SushiBarBusinessLogic/BusinessLogics/ProductLogic.cs diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index bf77c21..40fb127 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "Sushi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarBusinessLogic", "SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{CD8F84A5-5665-49EC-9630-F27A3176BA47}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Release|Any CPU.Build.0 = Release|Any CPU + {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/ComponentLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/ComponentLogic.cs new file mode 100644 index 0000000..f5ad6bb --- /dev/null +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/ComponentLogic.cs @@ -0,0 +1,109 @@ +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; +using SushiBarContracts.ViewModels; +using Microsoft.Extensions.Logging; + +namespace SushiBarBusinessLogic.BusinessLogics +{ + public class ComponentLogic : IComponentLogic + { + private readonly ILogger _logger; + private readonly IComponentStorage _componentStorage; + public ComponentLogic(ILogger logger, IComponentStorage componentStorage) + { + _logger = logger; + _componentStorage = componentStorage; + } + public List? ReadList(ComponentSearchModel? model) + { + _logger.LogInformation("ReadList. ComponentName:{ComponentName}. Id:{ Id}", model?.ComponentName, model?.Id); + var list = model == null ? _componentStorage.GetFullList() : + _componentStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + public ComponentViewModel? ReadElement(ComponentSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. ComponentName:{ComponentName}. Id:{ Id}", model.ComponentName, model.Id); + var element = _componentStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); + return element; + } + public bool Create(ComponentBindingModel model) + { + CheckModel(model); + if (_componentStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + public bool Update(ComponentBindingModel model) + { + CheckModel(model); + if (_componentStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + public bool Delete(ComponentBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_componentStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + private void CheckModel(ComponentBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.ComponentName)) + { + throw new ArgumentNullException("Нет названия компонента", nameof(model.ComponentName)); + } + if (model.Cost <= 0) + { + throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost)); + } + _logger.LogInformation("Component. ComponentName:{ComponentName}. Cost:{ Cost}. Id: { Id}", model.ComponentName, model.Cost, model.Id); + var element = _componentStorage.GetElement(new ComponentSearchModel + { + ComponentName = model.ComponentName + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Компонент с таким названием уже есть"); + } + } + } + +} diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs new file mode 100644 index 0000000..393ee23 --- /dev/null +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs @@ -0,0 +1,132 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; +using SushiBarContracts.ViewModels; +using SushiBarDataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarBusinessLogic.BusinessLogics +{ + public class OrderLogic : IOrderLogic + { + private readonly ILogger _logger; + private readonly IOrderStorage _orderStorage; + public OrderLogic(ILogger logger, IOrderStorage orderStorage) + { + _logger = logger; + _orderStorage = orderStorage; + } + public List? ReadList(OrderSearchModel? model) + { + _logger.LogInformation("ReadList. Id:{ Id}", model?.Id); + var list = model == null ? _orderStorage.GetFullList() : + _orderStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + public bool CreateOrder(OrderBindingModel model) + { + CheckModel(model); + if (model.Status != OrderStatus.Неизвестен) + { + _logger.LogWarning("Wrong Order Status"); + _logger.LogWarning("Insert operation failed"); + return false; + } + model.Status = OrderStatus.Принят; + if (_orderStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + public bool TakeOrderInWork(OrderBindingModel model) + { + CheckModel(model); + if (model.Status != OrderStatus.Принят) + { + _logger.LogWarning("Wrong Order Status"); + _logger.LogWarning("Insert operation failed"); + return false; + } + model.Status = OrderStatus.Выполняется; + if (_orderStorage.Update(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + public bool DeliveryOrder(OrderBindingModel model) + { + CheckModel(model); + if (model.Status != OrderStatus.Выполняется) + { + _logger.LogWarning("Wrong Order Status"); + _logger.LogWarning("Insert operation failed"); + return false; + } + model.Status = OrderStatus.Готов; + if (_orderStorage.Update(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool FinishOrder(OrderBindingModel model) + { + CheckModel(model); + if (model.Status != OrderStatus.Готов) + { + _logger.LogWarning("Wrong Order Status"); + _logger.LogWarning("Insert operation failed"); + return false; + } + model.Status = OrderStatus.Выдан; + if (_orderStorage.Update(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + private void CheckModel(OrderBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.DateImplement != null && model.DateCreate > model.DateImplement) + { + throw new InvalidOperationException("Заказ не может быть начат после его завершения"); + } + if (model.Count <= 0) + { + throw new ArgumentException("Количество продукта должно быть бльше 0"); + } + if (model.Sum <= 0) + { + throw new ArgumentException("Сумма заказа должна быть больше 0", nameof(model.Sum)); + } + } + } +} diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/ProductLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/ProductLogic.cs new file mode 100644 index 0000000..6d62299 --- /dev/null +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/ProductLogic.cs @@ -0,0 +1,106 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; +using SushiBarContracts.ViewModels; + +namespace SushiBarBusinessLogic.BusinessLogics +{ + public class ProductLogic : IProductLogic + { + private readonly ILogger _logger; + private readonly IProductStorage _productStorage; + public ProductLogic(ILogger logger, IProductStorage productStorage) + { + _logger = logger; + _productStorage = productStorage; + } + public List? ReadList(ProductSearchModel? model) + { + _logger.LogInformation("ReadList. ProductName:{ProductName}. Id:{ Id}", model?.ProductName, model?.Id); + var list = model == null ? _productStorage.GetFullList() : + _productStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + public ProductViewModel? ReadElement(ProductSearchModel model) + { + if(model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. ProductName:{ProductName}. Id:{ Id}", model.ProductName, model.Id); + var element = _productStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + return element; + } + public bool Create(ProductBindingModel model) + { + CheckModel(model); + if (_productStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + public bool Update(ProductBindingModel model) + { + CheckModel(model); + if (_productStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + public bool Delete(ProductBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_productStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + private void CheckModel(ProductBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.ProductName)) + { + throw new ArgumentException("Нет названия продукта", nameof(model.ProductName)); + } + if (model.Price <= 0) + { + throw new ArgumentNullException("Цена продукта должна быть больше 0", nameof(model.Price)); + } + var element = _productStorage.GetElement(new ProductSearchModel + { + ProductName = model.ProductName + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Продукт с таким названием уже есть"); + } + } + } +} -- 2.25.1 From 12166ce6263fb77bdf9a6cfc27b62356b97ce7dd Mon Sep 17 00:00:00 2001 From: bekodeg Date: Fri, 9 Feb 2024 17:38:25 +0400 Subject: [PATCH 08/22] =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D1=8B.=20=D0=BD?= =?UTF-8?q?=D0=B0=D1=87=D0=B0=D0=BB=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar.sln | 20 +- .../{ProductLogic.cs => SushiLogic.cs} | 44 +-- .../BindingModels/OrderBindingModel.cs | 2 +- ...ctBindingModel.cs => SushiBindingModel.cs} | 6 +- .../BusinessLogicsContracts/IProductLogic.cs | 15 - .../BusinessLogicsContracts/ISushiLogic.cs | 15 + ...ductSearchModel.cs => SushiSearchModel.cs} | 4 +- .../StoragesContracts/IProductStorage.cs | 16 - .../StoragesContracts/ISushiStorage.cs | 16 + .../ViewModels/OrderViewModel.cs | 6 +- ...{ProductViewModel.cs => SushiViewModel.cs} | 8 +- .../SushiBarDataModels/Models/IOrderModel.cs | 2 +- .../{IProductModel.cs => ISushiModel.cs} | 6 +- .../DataListSingleton.cs | 27 ++ .../Implements/ComponentStorage.cs | 102 ++++++ .../Implements/OrderStorage.cs | 89 +++++ .../Implements/SushiStorage.cs | 102 ++++++ .../SushiBarListImplement/Models/Component.cs | 41 +++ .../SushiBarListImplement/Models/Order.cs | 61 ++++ .../SushiBarListImplement/Models/Sushi.cs | 54 ++++ .../SushiBarView/FormComponent.Designer.cs | 98 ++++++ SushiBar/SushiBarView/FormComponent.cs | 25 ++ SushiBar/SushiBarView/FormComponent.resx | 305 ++++++++++++++++++ SushiBar/SushiBarView/FormComponent.ru.resx | 183 +++++++++++ SushiBar/SushiBarView/FormComponentLogic.cs | 81 +++++ SushiBar/SushiBarView/Program.cs | 17 + 26 files changed, 1268 insertions(+), 77 deletions(-) rename SushiBar/SushiBarBusinessLogic/BusinessLogics/{ProductLogic.cs => SushiLogic.cs} (62%) rename SushiBar/SushiBarContracts/BindingModels/{ProductBindingModel.cs => SushiBindingModel.cs} (55%) delete mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs create mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs rename SushiBar/SushiBarContracts/SearchModels/{ProductSearchModel.cs => SushiSearchModel.cs} (53%) delete mode 100644 SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs create mode 100644 SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs rename SushiBar/SushiBarContracts/ViewModels/{ProductViewModel.cs => SushiViewModel.cs} (54%) rename SushiBar/SushiBarDataModels/Models/{IProductModel.cs => ISushiModel.cs} (50%) create mode 100644 SushiBar/SushiBarListImplement/DataListSingleton.cs create mode 100644 SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs create mode 100644 SushiBar/SushiBarListImplement/Implements/OrderStorage.cs create mode 100644 SushiBar/SushiBarListImplement/Implements/SushiStorage.cs create mode 100644 SushiBar/SushiBarListImplement/Models/Component.cs create mode 100644 SushiBar/SushiBarListImplement/Models/Order.cs create mode 100644 SushiBar/SushiBarListImplement/Models/Sushi.cs create mode 100644 SushiBar/SushiBarView/FormComponent.Designer.cs create mode 100644 SushiBar/SushiBarView/FormComponent.cs create mode 100644 SushiBar/SushiBarView/FormComponent.resx create mode 100644 SushiBar/SushiBarView/FormComponent.ru.resx create mode 100644 SushiBar/SushiBarView/FormComponentLogic.cs create mode 100644 SushiBar/SushiBarView/Program.cs diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index 40fb127..588ef02 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -3,13 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{968304F1-7A64-49F1-B27A-48AED7C7754D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarBusinessLogic", "SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{CD8F84A5-5665-49EC-9630-F27A3176BA47}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarBusinessLogic", "SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{CD8F84A5-5665-49EC-9630-F27A3176BA47}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarListImplement", "SushiBarListImplement\SushiBarListImplement.csproj", "{A9E33D09-7C81-4D94-9A06-CF8A347D5740}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarView", "SushiBarView\SushiBarView.csproj", "{BCB90098-D537-4516-8DBA-450FEF6B479D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,10 +19,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.Build.0 = Release|Any CPU {968304F1-7A64-49F1-B27A-48AED7C7754D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {968304F1-7A64-49F1-B27A-48AED7C7754D}.Debug|Any CPU.Build.0 = Debug|Any CPU {968304F1-7A64-49F1-B27A-48AED7C7754D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -33,6 +31,14 @@ Global {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Release|Any CPU.Build.0 = Release|Any CPU + {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Release|Any CPU.Build.0 = Release|Any CPU + {BCB90098-D537-4516-8DBA-450FEF6B479D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BCB90098-D537-4516-8DBA-450FEF6B479D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BCB90098-D537-4516-8DBA-450FEF6B479D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BCB90098-D537-4516-8DBA-450FEF6B479D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/ProductLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/SushiLogic.cs similarity index 62% rename from SushiBar/SushiBarBusinessLogic/BusinessLogics/ProductLogic.cs rename to SushiBar/SushiBarBusinessLogic/BusinessLogics/SushiLogic.cs index 6d62299..2cf5260 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/ProductLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/SushiLogic.cs @@ -7,20 +7,20 @@ using SushiBarContracts.ViewModels; namespace SushiBarBusinessLogic.BusinessLogics { - public class ProductLogic : IProductLogic + public class SushiLogic : ISushiLogic { private readonly ILogger _logger; - private readonly IProductStorage _productStorage; - public ProductLogic(ILogger logger, IProductStorage productStorage) + private readonly ISushiStorage _sushiStorage; + public SushiLogic(ILogger logger, ISushiStorage sushiStorage) { _logger = logger; - _productStorage = productStorage; + _sushiStorage = sushiStorage; } - public List? ReadList(ProductSearchModel? model) + public List? ReadList(SushiSearchModel? model) { - _logger.LogInformation("ReadList. ProductName:{ProductName}. Id:{ Id}", model?.ProductName, model?.Id); - var list = model == null ? _productStorage.GetFullList() : - _productStorage.GetFilteredList(model); + _logger.LogInformation("ReadList. SushiName:{SushiName}. Id:{ Id}", model?.SushiName, model?.Id); + var list = model == null ? _sushiStorage.GetFullList() : + _sushiStorage.GetFilteredList(model); if (list == null) { _logger.LogWarning("ReadList return null list"); @@ -29,14 +29,14 @@ namespace SushiBarBusinessLogic.BusinessLogics _logger.LogInformation("ReadList. Count:{Count}", list.Count); return list; } - public ProductViewModel? ReadElement(ProductSearchModel model) + public SushiViewModel? ReadElement(SushiSearchModel model) { if(model == null) { throw new ArgumentNullException(nameof(model)); } - _logger.LogInformation("ReadElement. ProductName:{ProductName}. Id:{ Id}", model.ProductName, model.Id); - var element = _productStorage.GetElement(model); + _logger.LogInformation("ReadElement. SushiName:{SushiName}. Id:{ Id}", model.SushiName, model.Id); + var element = _sushiStorage.GetElement(model); if (element == null) { _logger.LogWarning("ReadElement element not found"); @@ -44,38 +44,38 @@ namespace SushiBarBusinessLogic.BusinessLogics } return element; } - public bool Create(ProductBindingModel model) + public bool Create(SushiBindingModel model) { CheckModel(model); - if (_productStorage.Insert(model) == null) + if (_sushiStorage.Insert(model) == null) { _logger.LogWarning("Insert operation failed"); return false; } return true; } - public bool Update(ProductBindingModel model) + public bool Update(SushiBindingModel model) { CheckModel(model); - if (_productStorage.Update(model) == null) + if (_sushiStorage.Update(model) == null) { _logger.LogWarning("Update operation failed"); return false; } return true; } - public bool Delete(ProductBindingModel model) + public bool Delete(SushiBindingModel model) { CheckModel(model, false); _logger.LogInformation("Delete. Id:{Id}", model.Id); - if (_productStorage.Delete(model) == null) + if (_sushiStorage.Delete(model) == null) { _logger.LogWarning("Delete operation failed"); return false; } return true; } - private void CheckModel(ProductBindingModel model, bool withParams = true) + private void CheckModel(SushiBindingModel model, bool withParams = true) { if (model == null) { @@ -85,17 +85,17 @@ namespace SushiBarBusinessLogic.BusinessLogics { return; } - if (string.IsNullOrEmpty(model.ProductName)) + if (string.IsNullOrEmpty(model.SushiName)) { - throw new ArgumentException("Нет названия продукта", nameof(model.ProductName)); + throw new ArgumentException("Нет названия продукта", nameof(model.SushiName)); } if (model.Price <= 0) { throw new ArgumentNullException("Цена продукта должна быть больше 0", nameof(model.Price)); } - var element = _productStorage.GetElement(new ProductSearchModel + var element = _sushiStorage.GetElement(new SushiSearchModel { - ProductName = model.ProductName + SushiName = model.SushiName }); if (element != null && element.Id != model.Id) { diff --git a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs index 2625c77..04c26e9 100644 --- a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs +++ b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs @@ -6,7 +6,7 @@ namespace SushiBarContracts.BindingModels public class OrderBindingModel : IOrderModel { public int Id { get; set; } - public int ProductId { get; set; } + public int SushiId { get; set; } public int Count { get; set; } public double Sum { get; set; } public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; diff --git a/SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs similarity index 55% rename from SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs rename to SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs index 13c12c0..2e10f06 100644 --- a/SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs +++ b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs @@ -2,12 +2,12 @@ namespace SushiBarContracts.BindingModels { - public class ProductBindingModel : IProductModel + public class SushiBindingModel : ISushiModel { public int Id { get; set; } - public string ProductName { get; set; } = string.Empty; + public string SushiName { get; set; } = string.Empty; public double Price { get; set; } - public Dictionary ProductComponents + public Dictionary SushiComponents { get; set; diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs deleted file mode 100644 index 96217a1..0000000 --- a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs +++ /dev/null @@ -1,15 +0,0 @@ -using SushiBarContracts.BindingModels; -using SushiBarContracts.SearchModels; -using SushiBarContracts.ViewModels; - -namespace SushiBarContracts.BusinessLogicsContracts -{ - public interface IProductLogic - { - List? ReadList(ProductSearchModel? model); - ProductViewModel? ReadElement(ProductSearchModel model); - bool Create(ProductBindingModel model); - bool Update(ProductBindingModel model); - bool Delete(ProductBindingModel model); - } -} diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs new file mode 100644 index 0000000..ae5cbbb --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs @@ -0,0 +1,15 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +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/SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs similarity index 53% rename from SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs rename to SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs index 86bc1d7..55e424e 100644 --- a/SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs +++ b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs @@ -1,8 +1,8 @@ namespace SushiBarContracts.SearchModels { - public class ProductSearchModel + public class SushiSearchModel { public int? Id { get; set; } - public string? ProductName { get; set; } + public string? SushiName { get; set; } } } diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs deleted file mode 100644 index 16e3db4..0000000 --- a/SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using SushiBarContracts.BindingModels; -using SushiBarContracts.SearchModels; -using SushiBarContracts.ViewModels; - -namespace SushiBarContracts.StoragesContracts -{ - public interface IProductStorage - { - List GetFullList(); - List GetFilteredList(ProductSearchModel model); - ProductViewModel? GetElement(ProductSearchModel model); - ProductViewModel? Insert(ProductBindingModel model); - ProductViewModel? Update(ProductBindingModel model); - ProductViewModel? Delete(ProductBindingModel model); - } -} diff --git a/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs new file mode 100644 index 0000000..ff49391 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs @@ -0,0 +1,16 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +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/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs index 9988699..0d9b086 100644 --- a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs @@ -8,9 +8,9 @@ namespace SushiBarContracts.ViewModels { [DisplayName("Номер")] public int Id { get; set; } - public int ProductId { get; set; } - [DisplayName("Изделие")] - public string ProductName { get; set; } = string.Empty; + public int SushiId { get; set; } + [DisplayName("Суши")] + public string SushiName { get; set; } = string.Empty; [DisplayName("Количество")] public int Count { get; set; } [DisplayName("Сумма")] diff --git a/SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs similarity index 54% rename from SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs rename to SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs index 67b02e2..73b3ae8 100644 --- a/SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs @@ -3,14 +3,14 @@ using System.ComponentModel; namespace SushiBarContracts.ViewModels { - public class ProductViewModel : IProductModel + public class SushiViewModel : ISushiModel { public int Id { get; set; } - [DisplayName("Название изделия")] - public string ProductName { get; set; } = string.Empty; + [DisplayName("Название суши")] + public string SushiName { get; set; } = string.Empty; [DisplayName("Цена")] public double Price { get; set; } - public Dictionary ProductComponents + public Dictionary SushiComponents { get; set; diff --git a/SushiBar/SushiBarDataModels/Models/IOrderModel.cs b/SushiBar/SushiBarDataModels/Models/IOrderModel.cs index 501a9dc..3770e12 100644 --- a/SushiBar/SushiBarDataModels/Models/IOrderModel.cs +++ b/SushiBar/SushiBarDataModels/Models/IOrderModel.cs @@ -4,7 +4,7 @@ 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/Models/IProductModel.cs b/SushiBar/SushiBarDataModels/Models/ISushiModel.cs similarity index 50% rename from SushiBar/SushiBarDataModels/Models/IProductModel.cs rename to SushiBar/SushiBarDataModels/Models/ISushiModel.cs index a28a0bc..d7257ad 100644 --- a/SushiBar/SushiBarDataModels/Models/IProductModel.cs +++ b/SushiBar/SushiBarDataModels/Models/ISushiModel.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; namespace SushiBarDataModels.Models { - public interface IProductModel : IId + public interface ISushiModel : IId { - string ProductName { get; } + string SushiName { get; } double Price { get; } - Dictionary ProductComponents { get; } + Dictionary SushiComponents { get; } } } diff --git a/SushiBar/SushiBarListImplement/DataListSingleton.cs b/SushiBar/SushiBarListImplement/DataListSingleton.cs new file mode 100644 index 0000000..c02c6c7 --- /dev/null +++ b/SushiBar/SushiBarListImplement/DataListSingleton.cs @@ -0,0 +1,27 @@ +using SushiBarListImplement.Models; + +namespace SushiBarListImplement +{ + public class DataListSingleton + { + private static DataListSingleton _instance; + public List Components { get; set; } + public List Orders { get; set; } + public List Sushis { get; set; } + private DataListSingleton() + { + Components = new List(); + Orders = new List(); + Sushis = new List(); + } + + public static DataListSingleton GetInsance() + { + if (_instance == null) + { + _instance = new DataListSingleton(); + } + return _instance; + } + } +} diff --git a/SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs b/SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs new file mode 100644 index 0000000..e242577 --- /dev/null +++ b/SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs @@ -0,0 +1,102 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; +using SushiBarContracts.ViewModels; +using SushiBarListImplement.Models; + +namespace SushiBarListImplement.Implements +{ + public class ComponentStorage : IComponentStorage + { + private readonly DataListSingleton _source; + public ComponentStorage() + { + _source = DataListSingleton.GetInsance(); + } + public List GetFullList() + { + var result = new List(); + foreach (var component in _source.Components) + { + result.Add(component.GetViewModel); + } + return result; + } + public List GetFilteredList(ComponentSearchModel model) + { + var result = new List(); + if (string.IsNullOrEmpty(model.ComponentName)) + { + return result; + } + foreach (var component in _source.Components) + { + if (component.ComponentName.Contains(model.ComponentName)) + { + result.Add(component.GetViewModel); + } + } + return result; + } + public ComponentViewModel? GetElement(ComponentSearchModel model) + { + if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue) + { + return null; + } + foreach (var component in _source.Components) + { + if ((!string.IsNullOrEmpty(model.ComponentName) && + component.ComponentName == model.ComponentName) || + (model.Id.HasValue && component.Id == model.Id)) + { + return component.GetViewModel; + } + } + return null; + } + public ComponentViewModel? Insert(ComponentBindingModel model) + { + model.Id = 1; + foreach (var component in _source.Components) + { + if (model.Id <= component.Id) + { + model.Id = component.Id + 1; + } + } + var newComponent = Component.Create(model); + if (newComponent == null) + { + return null; + } + _source.Components.Add(newComponent); + return newComponent.GetViewModel; + } + public ComponentViewModel? Update(ComponentBindingModel model) + { + foreach (var component in _source.Components) + { + if (component.Id == model.Id) + { + component.Update(model); + return component.GetViewModel; + } + } + return null; + } + public ComponentViewModel? Delete(ComponentBindingModel model) + { + for (int i = 0; i < _source.Components.Count; ++i) + { + if (_source.Components[i].Id == model.Id) + { + var element = _source.Components[i]; + _source.Components.RemoveAt(i); + return element.GetViewModel; + } + } + return null; + } + } +} diff --git a/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs b/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..6635a4d --- /dev/null +++ b/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs @@ -0,0 +1,89 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; +using SushiBarContracts.ViewModels; +using SushiBarListImplement.Models; + +namespace SushiBarListImplement.Implements +{ + public class OrderStorage : IOrderStorage + { + private readonly DataListSingleton _source; + public OrderStorage() + { + _source = DataListSingleton.GetInsance(); + } + public List GetFullList() + { + var result = new List(); + foreach (var order in _source.Orders) + { + result.Add(order.GetViewModel); + } + return result; + } + public List GetFilteredList(OrderSearchModel model) + { + var result = new List(); + return result; + } + public OrderViewModel? GetElement(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return null; + } + foreach (var order in _source.Orders) + { + if (model.Id.HasValue && order.Id == model.Id) + { + return order.GetViewModel; + } + } + return null; + } + public OrderViewModel? Insert(OrderBindingModel model) + { + model.Id = 1; + foreach (var order in _source.Orders) + { + if (model.Id <= order.Id) + { + model.Id = order.Id + 1; + } + } + var newOrder = Order.Create(model); + if (newOrder == null) + { + return null; + } + _source.Orders.Add(newOrder); + return newOrder.GetViewModel; + } + public OrderViewModel? Update(OrderBindingModel model) + { + foreach (var order in _source.Orders) + { + if (order.Id == model.Id) + { + order.Update(model); + return order.GetViewModel; + } + } + return null; + } + public OrderViewModel? Delete(OrderBindingModel model) + { + for (int i = 0; i < _source.Orders.Count; ++i) + { + if (_source.Orders[i].Id == model.Id) + { + var element = _source.Orders[i]; + _source.Orders.RemoveAt(i); + return element.GetViewModel; + } + } + return null; + } + } +} diff --git a/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs b/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs new file mode 100644 index 0000000..7ed32ac --- /dev/null +++ b/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs @@ -0,0 +1,102 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; +using SushiBarContracts.ViewModels; +using SushiBarListImplement.Models; + +namespace SushiBarListImplement.Implements +{ + public class SushiStorage : ISushiStorage + { + private readonly DataListSingleton _source; + public SushiStorage() + { + _source = DataListSingleton.GetInsance(); + } + public List GetFullList() + { + var result = new List(); + foreach (var sushi in _source.Sushis) + { + result.Add(sushi.GetViewModel); + } + return result; + } + public List GetFilteredList(SushiSearchModel model) + { + var result = new List(); + if (string.IsNullOrEmpty(model.SushiName)) + { + return result; + } + foreach (var sushi in _source.Sushis) + { + if (sushi.SushiName.Contains(model.SushiName)) + { + result.Add(sushi.GetViewModel); + } + } + return result; + } + public SushiViewModel? GetElement(SushiSearchModel model) + { + if (string.IsNullOrEmpty(model.SushiName) && !model.Id.HasValue) + { + return null; + } + foreach (var sushi in _source.Sushis) + { + if ((!string.IsNullOrEmpty(model.SushiName) && + sushi.SushiName == model.SushiName) || + (model.Id.HasValue && sushi.Id == model.Id)) + { + return sushi.GetViewModel; + } + } + return null; + } + public SushiViewModel? Insert(SushiBindingModel model) + { + model.Id = 1; + foreach (var sushi in _source.Sushis) + { + if (model.Id <= sushi.Id) + { + model.Id = sushi.Id + 1; + } + } + var newSushi = Sushi.Create(model); + if (newSushi == null) + { + return null; + } + _source.Sushis.Add(newSushi); + return newSushi.GetViewModel; + } + public SushiViewModel? Update(SushiBindingModel model) + { + foreach (var sushi in _source.Sushis) + { + if (sushi.Id == model.Id) + { + sushi.Update(model); + return sushi.GetViewModel; + } + } + return null; + } + public SushiViewModel? Delete(SushiBindingModel model) + { + for (int i = 0; i < _source.Sushis.Count; ++i) + { + if (_source.Sushis[i].Id == model.Id) + { + var element = _source.Sushis[i]; + _source.Sushis.RemoveAt(i); + return element.GetViewModel; + } + } + return null; + } + } +} diff --git a/SushiBar/SushiBarListImplement/Models/Component.cs b/SushiBar/SushiBarListImplement/Models/Component.cs new file mode 100644 index 0000000..b220453 --- /dev/null +++ b/SushiBar/SushiBarListImplement/Models/Component.cs @@ -0,0 +1,41 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.ViewModels; +using SushiBarDataModels.Models; + +namespace SushiBarListImplement.Models +{ + public class Component : IComponentModel + { + public int Id { get; private set; } + public string ComponentName { get; private set; } = string.Empty; + public double Cost { get; set; } + public static Component? Create(ComponentBindingModel? model) + { + if (model == null) + { + return null; + } + return new Component() + { + Id = model.Id, + ComponentName = model.ComponentName, + Cost = model.Cost + }; + } + public void Update(ComponentBindingModel? model) + { + if (model == null) + { + return; + } + ComponentName = model.ComponentName; + Cost = model.Cost; + } + public ComponentViewModel GetViewModel => new() + { + Id = Id, + ComponentName = ComponentName, + Cost = Cost + }; + } +} diff --git a/SushiBar/SushiBarListImplement/Models/Order.cs b/SushiBar/SushiBarListImplement/Models/Order.cs new file mode 100644 index 0000000..5897bf7 --- /dev/null +++ b/SushiBar/SushiBarListImplement/Models/Order.cs @@ -0,0 +1,61 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.ViewModels; +using SushiBarDataModels.Enums; +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarListImplement.Models +{ + public class Order : IOrderModel + { + public int Id { get; private set; } + public int SushiId { get; private set; } + public int Count { get; private set; } + public double Sum { get; private set; } + public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; + public DateTime DateCreate { get; private set; } + public DateTime? DateImplement { get; private set; } + public static Order? Create(OrderBindingModel? model) { + if (model == null) + { + return null; + } + return new Order() + { + Id = model.Id, + SushiId = model.SushiId, + Count = model.Count, + Sum = model.Sum, + Status = model.Status, + DateCreate = model.DateCreate, + DateImplement = model.DateImplement + }; + } + public void Update(OrderBindingModel? model) + { + if (model == null) + { + return; + } + SushiId = model.SushiId; + Count = model.Count; + Sum = model.Sum; + Status = model.Status; + DateImplement = model.DateImplement; + } + public OrderViewModel GetViewModel => new() + { + Id = Id, + SushiId = SushiId, + Count = Count, + Sum = Sum, + Status = Status, + DateCreate = DateCreate, + DateImplement = DateImplement + }; + } +} diff --git a/SushiBar/SushiBarListImplement/Models/Sushi.cs b/SushiBar/SushiBarListImplement/Models/Sushi.cs new file mode 100644 index 0000000..a3656cd --- /dev/null +++ b/SushiBar/SushiBarListImplement/Models/Sushi.cs @@ -0,0 +1,54 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.ViewModels; +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarListImplement.Models +{ + public class Sushi : ISushiModel + { + public int Id { get; private set; } + public string SushiName { get; private set; } = string.Empty; + public double Price { get; private set; } + public Dictionary SushiComponents + { + get; + private set; + } = new Dictionary(); + public static Sushi? Create(SushiBindingModel? model) + { + if (model == null) + { + return null; + } + return new Sushi() + { + Id = model.Id, + SushiName = model.SushiName, + Price = model.Price, + SushiComponents = model.SushiComponents + }; + } + public void Update(SushiBindingModel? model) + { + if (model == null) + { + return; + } + SushiName = model.SushiName; + Price = model.Price; + SushiComponents = model.SushiComponents; + } + public SushiViewModel GetViewModel => new() + { + Id = Id, + SushiName = SushiName, + Price = Price, + SushiComponents = SushiComponents + }; + } +} diff --git a/SushiBar/SushiBarView/FormComponent.Designer.cs b/SushiBar/SushiBarView/FormComponent.Designer.cs new file mode 100644 index 0000000..7c52e81 --- /dev/null +++ b/SushiBar/SushiBarView/FormComponent.Designer.cs @@ -0,0 +1,98 @@ +namespace SushiBarView +{ + partial class FormComponent + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormComponent)); + label1 = new Label(); + textBoxName = new TextBox(); + textBoxCost = new TextBox(); + label2 = new Label(); + buttonSave = new Button(); + buttonCancel = new Button(); + SuspendLayout(); + // + // label1 + // + resources.ApplyResources(label1, "label1"); + label1.Name = "label1"; + // + // textBoxName + // + resources.ApplyResources(textBoxName, "textBoxName"); + textBoxName.Name = "textBoxName"; + // + // textBoxCost + // + resources.ApplyResources(textBoxCost, "textBoxCost"); + textBoxCost.Name = "textBoxCost"; + // + // label2 + // + resources.ApplyResources(label2, "label2"); + label2.Name = "label2"; + // + // buttonSave + // + resources.ApplyResources(buttonSave, "buttonSave"); + buttonSave.Name = "buttonSave"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // buttonCancel + // + resources.ApplyResources(buttonCancel, "buttonCancel"); + buttonCancel.Name = "buttonCancel"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // FormComponent + // + resources.ApplyResources(this, "$this"); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxCost); + Controls.Add(label2); + Controls.Add(textBoxName); + Controls.Add(label1); + Name = "FormComponent"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label label1; + private TextBox textBoxName; + private TextBox textBoxCost; + private Label label2; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarView/FormComponent.cs b/SushiBar/SushiBarView/FormComponent.cs new file mode 100644 index 0000000..7ab25e2 --- /dev/null +++ b/SushiBar/SushiBarView/FormComponent.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SushiBarView +{ + public partial class FormComponent + { + private void buttonSave_Click(object sender, EventArgs e) + { + + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/SushiBar/SushiBarView/FormComponent.resx b/SushiBar/SushiBarView/FormComponent.resx new file mode 100644 index 0000000..ac033b7 --- /dev/null +++ b/SushiBar/SushiBarView/FormComponent.resx @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + FormComponent + + + $this + + + $this + + + 4 + + + buttonCancel + + + + 800, 450 + + + + 3 + + + $this + + + System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 1 + + + textBoxCost + + + $this + + + $this + + + 8, 20 + + + 4 + + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + button1 + + + System.Windows.Forms.Form, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 + + + textBox1 + + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 95, 85 + + + 1 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 12, 42 + + + 3 + + + $this + + + $this + + + 0 + + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 68, 6 + + + 0 + + + 222, 85 + + + label1 + + + 4 + + + System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 5 + + + 1 + + + buttonSave + + + 222, 85 + + + FormComponent + + + 12, 9 + + + 95, 85 + + + label2 + + + 0 + + + 5 + + + 1 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 2 + + + 5 + + + textBoxName + + + $this + + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 95, 39 + + + 95, 6 + + + 2 + + + button2 + + + ru + + + True + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/FormComponent.ru.resx b/SushiBar/SushiBarView/FormComponent.ru.resx new file mode 100644 index 0000000..81e7eef --- /dev/null +++ b/SushiBar/SushiBarView/FormComponent.ru.resx @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + True + + + + 77, 20 + + + Название + + + 246, 27 + + + 246, 27 + + + True + + + + NoControl + + + 45, 20 + + + Цена + + + 95, 85 + + + 121, 29 + + + 4 + + + Сохранить + + + NoControl + + + 222, 85 + + + 119, 29 + + + 5 + + + Отмена + + + 353, 126 + + + Компонент + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/FormComponentLogic.cs b/SushiBar/SushiBarView/FormComponentLogic.cs new file mode 100644 index 0000000..28ea2ba --- /dev/null +++ b/SushiBar/SushiBarView/FormComponentLogic.cs @@ -0,0 +1,81 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.SearchModels; +using Microsoft.Extensions.Logging; + +namespace SushiBarView +{ + public partial class FormComponent : Form + { + private readonly ILogger _logger; + private readonly IComponentLogic _logic; + private int? _id; + public int Id { set { _id = value; } } + public FormComponent(ILogger logger, IComponentLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + private void FormComponent_Load(object sender, EventArgs e) + { + if (_id.HasValue) + { + try + { + _logger.LogInformation("Получение компонента"); + var view = _logic.ReadElement(new ComponentSearchModel + { + Id = _id.Value + }); + if (view != null) + { + textBoxName.Text = view.ComponentName; + textBoxCost.Text = view.Cost.ToString(); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения компонента"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void ButtonSave_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxName.Text)) + { + MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + _logger.LogInformation("Сохранение компонента"); + try + { + var model = new ComponentBindingModel + { + Id = _id ?? 0, + ComponentName = textBoxName.Text, + Cost = Convert.ToDouble(textBoxCost.Text) + }; + var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения компонента"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + } +} diff --git a/SushiBar/SushiBarView/Program.cs b/SushiBar/SushiBarView/Program.cs new file mode 100644 index 0000000..44ffd81 --- /dev/null +++ b/SushiBar/SushiBarView/Program.cs @@ -0,0 +1,17 @@ +namespace SushiBarView +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file -- 2.25.1 From d2a365a64e18b6570ffaba5ddf9e3e9059903467 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Sun, 11 Feb 2024 17:20:09 +0400 Subject: [PATCH 09/22] =?UTF-8?q?=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=20=D0=B1?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => Forms}/FormComponent.Designer.cs | 0 .../SushiBarView/{ => Forms}/FormComponent.cs | 3 +- .../{ => Forms}/FormComponent.resx | 0 .../{ => Forms}/FormComponent.ru.resx | 0 .../{ => Forms}/FormComponentLogic.cs | 0 .../Forms/FormComponents.Designer.cs | 114 ++++++++++ SushiBar/SushiBarView/Forms/FormComponents.cs | 35 +++ .../SushiBarView/Forms/FormComponents.resx | 120 ++++++++++ .../SushiBarView/Forms/FormComponentsLogic.cs | 99 +++++++++ .../SushiBarView/Forms/FormSushi.Designer.cs | 210 ++++++++++++++++++ SushiBar/SushiBarView/Forms/FormSushi.cs | 20 ++ SushiBar/SushiBarView/Forms/FormSushi.resx | 132 +++++++++++ .../Forms/FormSushiComponent.Designer.cs | 118 ++++++++++ .../SushiBarView/Forms/FormSushiComponent.cs | 25 +++ .../Forms/FormSushiComponent.resx | 120 ++++++++++ .../Forms/FormSushiComponentLogic.cs | 83 +++++++ SushiBar/SushiBarView/Program.cs | 30 ++- 17 files changed, 1107 insertions(+), 2 deletions(-) rename SushiBar/SushiBarView/{ => Forms}/FormComponent.Designer.cs (100%) rename SushiBar/SushiBarView/{ => Forms}/FormComponent.cs (84%) rename SushiBar/SushiBarView/{ => Forms}/FormComponent.resx (100%) rename SushiBar/SushiBarView/{ => Forms}/FormComponent.ru.resx (100%) rename SushiBar/SushiBarView/{ => Forms}/FormComponentLogic.cs (100%) create mode 100644 SushiBar/SushiBarView/Forms/FormComponents.Designer.cs create mode 100644 SushiBar/SushiBarView/Forms/FormComponents.cs create mode 100644 SushiBar/SushiBarView/Forms/FormComponents.resx create mode 100644 SushiBar/SushiBarView/Forms/FormComponentsLogic.cs create mode 100644 SushiBar/SushiBarView/Forms/FormSushi.Designer.cs create mode 100644 SushiBar/SushiBarView/Forms/FormSushi.cs create mode 100644 SushiBar/SushiBarView/Forms/FormSushi.resx create mode 100644 SushiBar/SushiBarView/Forms/FormSushiComponent.Designer.cs create mode 100644 SushiBar/SushiBarView/Forms/FormSushiComponent.cs create mode 100644 SushiBar/SushiBarView/Forms/FormSushiComponent.resx create mode 100644 SushiBar/SushiBarView/Forms/FormSushiComponentLogic.cs diff --git a/SushiBar/SushiBarView/FormComponent.Designer.cs b/SushiBar/SushiBarView/Forms/FormComponent.Designer.cs similarity index 100% rename from SushiBar/SushiBarView/FormComponent.Designer.cs rename to SushiBar/SushiBarView/Forms/FormComponent.Designer.cs diff --git a/SushiBar/SushiBarView/FormComponent.cs b/SushiBar/SushiBarView/Forms/FormComponent.cs similarity index 84% rename from SushiBar/SushiBarView/FormComponent.cs rename to SushiBar/SushiBarView/Forms/FormComponent.cs index 7ab25e2..f541ef5 100644 --- a/SushiBar/SushiBarView/FormComponent.cs +++ b/SushiBar/SushiBarView/Forms/FormComponent.cs @@ -14,11 +14,12 @@ namespace SushiBarView { private void buttonSave_Click(object sender, EventArgs e) { - + ButtonSave_Click(sender, e); } private void buttonCancel_Click(object sender, EventArgs e) { + ButtonCancel_Click(sender, e); } } diff --git a/SushiBar/SushiBarView/FormComponent.resx b/SushiBar/SushiBarView/Forms/FormComponent.resx similarity index 100% rename from SushiBar/SushiBarView/FormComponent.resx rename to SushiBar/SushiBarView/Forms/FormComponent.resx diff --git a/SushiBar/SushiBarView/FormComponent.ru.resx b/SushiBar/SushiBarView/Forms/FormComponent.ru.resx similarity index 100% rename from SushiBar/SushiBarView/FormComponent.ru.resx rename to SushiBar/SushiBarView/Forms/FormComponent.ru.resx diff --git a/SushiBar/SushiBarView/FormComponentLogic.cs b/SushiBar/SushiBarView/Forms/FormComponentLogic.cs similarity index 100% rename from SushiBar/SushiBarView/FormComponentLogic.cs rename to SushiBar/SushiBarView/Forms/FormComponentLogic.cs diff --git a/SushiBar/SushiBarView/Forms/FormComponents.Designer.cs b/SushiBar/SushiBarView/Forms/FormComponents.Designer.cs new file mode 100644 index 0000000..616bc5c --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormComponents.Designer.cs @@ -0,0 +1,114 @@ +namespace SushiBarView +{ + partial class FormComponents + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + buttonAdd = new Button(); + buttonUpd = new Button(); + buttonDel = new Button(); + buttonRef = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(0, 0); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(668, 408); + dataGridView.TabIndex = 0; + // + // buttonAdd + // + buttonAdd.Location = new Point(674, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(114, 29); + buttonAdd.TabIndex = 1; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // buttonUpd + // + buttonUpd.Location = new Point(674, 47); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(114, 29); + buttonUpd.TabIndex = 2; + buttonUpd.Text = "Изменить"; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += buttonUpd_Click; + // + // buttonDel + // + buttonDel.Location = new Point(674, 82); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(114, 29); + buttonDel.TabIndex = 3; + buttonDel.Text = "Удалить"; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += buttonDel_Click; + // + // buttonRef + // + buttonRef.Location = new Point(674, 117); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(114, 29); + buttonRef.TabIndex = 4; + buttonRef.Text = "Обновить"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += buttonRef_Click; + // + // FormComponents + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 408); + Controls.Add(buttonRef); + Controls.Add(buttonDel); + Controls.Add(buttonUpd); + Controls.Add(buttonAdd); + Controls.Add(dataGridView); + Name = "FormComponents"; + Text = "Компоненты"; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Button buttonAdd; + private Button buttonUpd; + private Button buttonDel; + private Button buttonRef; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormComponents.cs b/SushiBar/SushiBarView/Forms/FormComponents.cs new file mode 100644 index 0000000..b858c9c --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormComponents.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SushiBarView +{ + public partial class FormComponents + { + private void buttonAdd_Click(object sender, EventArgs e) + { + ButtonAdd_Click(sender, e); + } + + private void buttonUpd_Click(object sender, EventArgs e) + { + ButtonUpd_Click(sender, e); + } + + private void buttonDel_Click(object sender, EventArgs e) + { + ButtonDel_Click(sender, e); + } + + private void buttonRef_Click(object sender, EventArgs e) + { + ButtonRef_Click(sender, e); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormComponents.resx b/SushiBar/SushiBarView/Forms/FormComponents.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormComponents.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormComponentsLogic.cs b/SushiBar/SushiBarView/Forms/FormComponentsLogic.cs new file mode 100644 index 0000000..e937e38 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormComponentsLogic.cs @@ -0,0 +1,99 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; + + +namespace SushiBarView +{ + public partial class FormComponents : Form + { + private readonly ILogger _logger; + private readonly IComponentLogic _logic; + public FormComponents(ILogger logger, IComponentLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + private void FormComponents_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() + { + try + { + var list = _logic.ReadList(null); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + } + _logger.LogInformation("Загрузка компонентов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки компонентов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonAdd_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormComponent)); + if (service is FormComponent form) + { + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = Program.ServiceProvider?.GetService(typeof(FormComponent)); + if (service is FormComponent form) + { + form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + } + private void ButtonDel_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Удаление компонента"); + try + { + if (!_logic.Delete(new ComponentBindingModel + { + Id = id + })) + { + throw new Exception("Ошибка при удалении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка удаления компонента"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + } + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs b/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs new file mode 100644 index 0000000..f656ab6 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs @@ -0,0 +1,210 @@ +namespace SushiBarView.Forms +{ + partial class FormSushi + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + button1 = new Button(); + dataGridView1 = new DataGridView(); + groupBox1 = new GroupBox(); + button2 = new Button(); + button3 = new Button(); + button4 = new Button(); + button5 = new Button(); + button6 = new Button(); + ComponentName = new DataGridViewTextBoxColumn(); + ComponentCount = new DataGridViewTextBoxColumn(); + label1 = new Label(); + label2 = new Label(); + textBox1 = new TextBox(); + textBox2 = new TextBox(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + groupBox1.SuspendLayout(); + SuspendLayout(); + // + // button1 + // + button1.Location = new Point(560, 22); + button1.Name = "button1"; + button1.Size = new Size(110, 29); + button1.TabIndex = 0; + button1.Text = "Добавить"; + button1.UseVisualStyleBackColor = true; + // + // dataGridView1 + // + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ComponentName, ComponentCount }); + dataGridView1.Dock = DockStyle.Left; + dataGridView1.Location = new Point(3, 19); + dataGridView1.Name = "dataGridView1"; + dataGridView1.RowTemplate.Height = 25; + dataGridView1.Size = new Size(551, 199); + dataGridView1.TabIndex = 1; + // + // groupBox1 + // + groupBox1.Controls.Add(button6); + groupBox1.Controls.Add(button5); + groupBox1.Controls.Add(button4); + groupBox1.Controls.Add(dataGridView1); + groupBox1.Controls.Add(button1); + groupBox1.Location = new Point(12, 76); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new Size(676, 221); + groupBox1.TabIndex = 2; + groupBox1.TabStop = false; + groupBox1.Text = "Компоненты"; + // + // button2 + // + button2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + button2.Location = new Point(532, 303); + button2.Name = "button2"; + button2.Size = new Size(75, 23); + button2.TabIndex = 3; + button2.Text = "Сохранить"; + button2.UseVisualStyleBackColor = true; + // + // button3 + // + button3.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + button3.Location = new Point(613, 303); + button3.Name = "button3"; + button3.Size = new Size(75, 23); + button3.TabIndex = 4; + button3.Text = "Отмена"; + button3.UseVisualStyleBackColor = true; + // + // button4 + // + button4.Location = new Point(560, 57); + button4.Name = "button4"; + button4.Size = new Size(110, 29); + button4.TabIndex = 2; + button4.Text = "Изменить"; + button4.UseVisualStyleBackColor = true; + // + // button5 + // + button5.Location = new Point(560, 92); + button5.Name = "button5"; + button5.Size = new Size(110, 29); + button5.TabIndex = 3; + button5.Text = "Удалить"; + button5.UseVisualStyleBackColor = true; + // + // button6 + // + button6.Location = new Point(560, 127); + button6.Name = "button6"; + button6.Size = new Size(110, 29); + button6.TabIndex = 4; + button6.Text = "Обновить"; + button6.UseVisualStyleBackColor = true; + // + // ComponentName + // + ComponentName.HeaderText = "Компонент"; + ComponentName.Name = "ComponentName"; + // + // ComponentCount + // + ComponentCount.HeaderText = "Количество"; + ComponentCount.Name = "ComponentCount"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(22, 12); + label1.Name = "label1"; + label1.Size = new Size(62, 15); + label1.TabIndex = 5; + label1.Text = "Название:"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(22, 45); + label2.Name = "label2"; + label2.Size = new Size(70, 15); + label2.TabIndex = 6; + label2.Text = "Стоимость:"; + // + // textBox1 + // + textBox1.Location = new Point(98, 42); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(244, 23); + textBox1.TabIndex = 7; + // + // textBox2 + // + textBox2.Location = new Point(98, 13); + textBox2.Name = "textBox2"; + textBox2.Size = new Size(244, 23); + textBox2.TabIndex = 8; + // + // FormSushi + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(700, 338); + Controls.Add(textBox2); + Controls.Add(textBox1); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(groupBox1); + Margin = new Padding(3, 2, 3, 2); + Name = "FormSushi"; + Text = "Суши"; + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + groupBox1.ResumeLayout(false); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button button1; + private DataGridView dataGridView1; + private GroupBox groupBox1; + private Button button6; + private Button button5; + private Button button4; + private Button button2; + private Button button3; + private DataGridViewTextBoxColumn ComponentName; + private DataGridViewTextBoxColumn ComponentCount; + private Label label1; + private Label label2; + private TextBox textBox1; + private TextBox textBox2; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormSushi.cs b/SushiBar/SushiBarView/Forms/FormSushi.cs new file mode 100644 index 0000000..45ea6b4 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushi.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SushiBarView.Forms +{ + public partial class FormSushi : Form + { + public FormSushi() + { + InitializeComponent(); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormSushi.resx b/SushiBar/SushiBarView/Forms/FormSushi.resx new file mode 100644 index 0000000..729c93c --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushi.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponent.Designer.cs b/SushiBar/SushiBarView/Forms/FormSushiComponent.Designer.cs new file mode 100644 index 0000000..63d4bfb --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushiComponent.Designer.cs @@ -0,0 +1,118 @@ +namespace SushiBarView.Forms +{ + partial class FormSushiComponent + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + label1 = new Label(); + label2 = new Label(); + comboBoxComponent = new ComboBox(); + textBoxCount = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + SuspendLayout(); + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 15); + label1.Name = "label1"; + label1.Size = new Size(91, 20); + label1.TabIndex = 0; + label1.Text = "Компонент:"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 65); + label2.Name = "label2"; + label2.Size = new Size(93, 20); + label2.TabIndex = 1; + label2.Text = "Количество:"; + // + // comboBoxComponent + // + comboBoxComponent.FormattingEnabled = true; + comboBoxComponent.Location = new Point(125, 12); + comboBoxComponent.Name = "comboBoxComponent"; + comboBoxComponent.Size = new Size(227, 28); + comboBoxComponent.TabIndex = 2; + // + // textBoxCount + // + textBoxCount.Location = new Point(125, 62); + textBoxCount.Name = "textBoxCount"; + textBoxCount.Size = new Size(227, 27); + textBoxCount.TabIndex = 3; + // + // buttonSave + // + buttonSave.Location = new Point(158, 95); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 4; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(258, 95); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 5; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // FormSushiComponent + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(364, 132); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxCount); + Controls.Add(comboBoxComponent); + Controls.Add(label2); + Controls.Add(label1); + Name = "FormSushiComponent"; + Text = "Компонент Изделия"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label label1; + private Label label2; + private ComboBox comboBoxComponent; + private TextBox textBoxCount; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponent.cs b/SushiBar/SushiBarView/Forms/FormSushiComponent.cs new file mode 100644 index 0000000..7a7479a --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushiComponent.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SushiBarView.Forms +{ + public partial class FormSushiComponent + { + private void buttonSave_Click(object sender, EventArgs e) + { + ButtonSave_Click(sender, e); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + ButtonCancel_Click(sender, e); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponent.resx b/SushiBar/SushiBarView/Forms/FormSushiComponent.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushiComponent.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponentLogic.cs b/SushiBar/SushiBarView/Forms/FormSushiComponentLogic.cs new file mode 100644 index 0000000..37f116b --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushiComponentLogic.cs @@ -0,0 +1,83 @@ +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.ViewModels; +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarView.Forms +{ + partial class FormSushiComponent : Form + { + private readonly List? _list; + public int Id + { + get + { + return Convert.ToInt32(comboBoxComponent.SelectedValue); + } + set + { + comboBoxComponent.SelectedValue = value; + } + } + public IComponentModel? ComponentModel + { + get + { + if (_list == null) + { + return null; + } + foreach (var elem in _list) + { + if (elem.Id == Id) + { + return elem; + } + } + return null; + } + } + public int Count + { + get { return Convert.ToInt32(textBoxCount.Text); } + set + { textBoxCount.Text = value.ToString(); } + } + public FormSushiComponent(IComponentLogic logic) + { + InitializeComponent(); + _list = logic.ReadList(null); + if (_list != null) + { + comboBoxComponent.DisplayMember = "ComponentName"; + comboBoxComponent.ValueMember = "Id"; + comboBoxComponent.DataSource = _list; + comboBoxComponent.SelectedItem = null; + } + } + private void ButtonSave_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxCount.Text)) + { + MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (comboBoxComponent.SelectedValue == null) + { + MessageBox.Show("Выберите компонент", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + DialogResult = DialogResult.OK; + Close(); + } + private void ButtonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + } +} diff --git a/SushiBar/SushiBarView/Program.cs b/SushiBar/SushiBarView/Program.cs index 44ffd81..aff4891 100644 --- a/SushiBar/SushiBarView/Program.cs +++ b/SushiBar/SushiBarView/Program.cs @@ -1,7 +1,17 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NLog.Extensions.Logging; +using SushiBarBusinessLogic.BusinessLogics; +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.StoragesContracts; +using SushiBarListImplement.Implements; + namespace SushiBarView { internal static class Program { + private static ServiceProvider? _serviceProvider; + public static ServiceProvider? ServiceProvider => _serviceProvider; /// /// The main entry point for the application. /// @@ -11,7 +21,25 @@ namespace SushiBarView // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + var services = new ServiceCollection(); + ConfigureServices(services); + _serviceProvider = services.BuildServiceProvider(); + //Application.Run(_serviceProvider.GetRequiredService); + } + private static void ConfigureServices(ServiceCollection services) + { + services.AddLogging(option => + { + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); + }); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file -- 2.25.1 From 797e5beef1efeeefa3b4bfab21c8c744268f874f Mon Sep 17 00:00:00 2001 From: bekodeg Date: Tue, 13 Feb 2024 20:52:40 +0400 Subject: [PATCH 10/22] =?UTF-8?q?=D0=BD=D1=83=20=D0=BF=D0=BE=D1=87=D1=82?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/OrderLogic.cs | 5 - .../Forms/FormCreateOrder.Designer.cs | 141 ++++++++++ .../SushiBarView/Forms/FormCreateOrder.cs | 25 ++ .../SushiBarView/Forms/FormCreateOrder.resx | 120 ++++++++ .../Forms/FormCreateOrderLogic.cs | 102 +++++++ .../SushiBarView/Forms/FormMain.Designer.cs | 153 ++++++++++ SushiBar/SushiBarView/Forms/FormMain.cs | 30 ++ SushiBar/SushiBarView/Forms/FormMain.resx | 123 ++++++++ SushiBar/SushiBarView/Forms/FormMainLogic.cs | 121 ++++++++ .../SushiBarView/Forms/FormSushi.Designer.cs | 266 ++++++++++-------- SushiBar/SushiBarView/Forms/FormSushi.cs | 43 ++- SushiBar/SushiBarView/Forms/FormSushi.resx | 6 - SushiBar/SushiBarView/Forms/FormSushiLogic.cs | 201 +++++++++++++ SushiBar/SushiBarView/Program.cs | 11 +- SushiBar/SushiBarView/nlog.config | 15 + 15 files changed, 1215 insertions(+), 147 deletions(-) create mode 100644 SushiBar/SushiBarView/Forms/FormCreateOrder.Designer.cs create mode 100644 SushiBar/SushiBarView/Forms/FormCreateOrder.cs create mode 100644 SushiBar/SushiBarView/Forms/FormCreateOrder.resx create mode 100644 SushiBar/SushiBarView/Forms/FormCreateOrderLogic.cs create mode 100644 SushiBar/SushiBarView/Forms/FormMain.Designer.cs create mode 100644 SushiBar/SushiBarView/Forms/FormMain.cs create mode 100644 SushiBar/SushiBarView/Forms/FormMain.resx create mode 100644 SushiBar/SushiBarView/Forms/FormMainLogic.cs create mode 100644 SushiBar/SushiBarView/Forms/FormSushiLogic.cs create mode 100644 SushiBar/SushiBarView/nlog.config diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs index 393ee23..22b6922 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs @@ -5,11 +5,6 @@ using SushiBarContracts.SearchModels; using SushiBarContracts.StoragesContracts; using SushiBarContracts.ViewModels; using SushiBarDataModels.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SushiBarBusinessLogic.BusinessLogics { diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrder.Designer.cs b/SushiBar/SushiBarView/Forms/FormCreateOrder.Designer.cs new file mode 100644 index 0000000..bbe3ee3 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormCreateOrder.Designer.cs @@ -0,0 +1,141 @@ +namespace SushiBarView.Forms +{ + partial class FormCreateOrder + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonSave = new Button(); + buttonCancel = new Button(); + label1 = new Label(); + label2 = new Label(); + label3 = new Label(); + textBoxCount = new TextBox(); + textBoxSum = new TextBox(); + comboBoxSushi = new ComboBox(); + SuspendLayout(); + // + // buttonSave + // + buttonSave.Location = new Point(185, 112); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(100, 30); + buttonSave.TabIndex = 0; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(291, 112); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(100, 30); + buttonCancel.TabIndex = 1; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 15); + label1.Name = "label1"; + label1.Size = new Size(49, 20); + label1.TabIndex = 2; + label1.Text = "Суши:"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 49); + label2.Name = "label2"; + label2.Size = new Size(93, 20); + label2.TabIndex = 3; + label2.Text = "Количество:"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(12, 82); + label3.Name = "label3"; + label3.Size = new Size(58, 20); + label3.TabIndex = 4; + label3.Text = "Сумма:"; + // + // textBoxCount + // + textBoxCount.Location = new Point(119, 46); + textBoxCount.Name = "textBoxCount"; + textBoxCount.Size = new Size(272, 27); + textBoxCount.TabIndex = 5; + // + // textBoxSum + // + textBoxSum.Location = new Point(119, 79); + textBoxSum.Name = "textBoxSum"; + textBoxSum.ReadOnly = true; + textBoxSum.Size = new Size(272, 27); + textBoxSum.TabIndex = 6; + // + // comboBoxSushi + // + comboBoxSushi.FormattingEnabled = true; + comboBoxSushi.Location = new Point(119, 12); + comboBoxSushi.Name = "comboBoxSushi"; + comboBoxSushi.Size = new Size(272, 28); + comboBoxSushi.TabIndex = 7; + // + // FormCreateOrder + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(403, 152); + Controls.Add(comboBoxSushi); + Controls.Add(textBoxSum); + Controls.Add(textBoxCount); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Name = "FormCreateOrder"; + Text = "FormCreateOrder"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonSave; + private Button buttonCancel; + private Label label1; + private Label label2; + private Label label3; + private TextBox textBoxCount; + private TextBox textBoxSum; + private ComboBox comboBoxSushi; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrder.cs b/SushiBar/SushiBarView/Forms/FormCreateOrder.cs new file mode 100644 index 0000000..cddc482 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormCreateOrder.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SushiBarView.Forms +{ + public partial class FormCreateOrder + { + private void buttonSave_Click(object sender, EventArgs e) + { + ButtonSave_Click(sender, e); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + ButtonCancel_Click(sender, e); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrder.resx b/SushiBar/SushiBarView/Forms/FormCreateOrder.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormCreateOrder.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrderLogic.cs b/SushiBar/SushiBarView/Forms/FormCreateOrderLogic.cs new file mode 100644 index 0000000..50619f0 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormCreateOrderLogic.cs @@ -0,0 +1,102 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.SearchModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarView.Forms +{ + public partial class FormCreateOrder : Form + { + private readonly ILogger _logger; + private readonly ISushiLogic _logicS; + private readonly IOrderLogic _logicO; + public FormCreateOrder(ILogger logger, ISushiLogic logicS, IOrderLogic logicO) + { + InitializeComponent(); + _logger = logger; + _logicS = logicS; + _logicO = logicO; + } + private void FormCreateOrder_Load(object sender, EventArgs e) + { + _logger.LogInformation("Загрузка изделий для заказа"); + // прописать логику + } + private void CalcSum() + { + if (comboBoxSushi.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text)) + { + try + { + int id = Convert.ToInt32(comboBoxSushi.SelectedValue); + var sushi = _logicS.ReadElement(new SushiSearchModel + { + Id = id + }); + int count = Convert.ToInt32(textBoxCount.Text); + textBoxSum.Text = Math.Round(count * (sushi?.Price ?? 0), 2).ToString(); + _logger.LogInformation("Расчет суммы заказа"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка расчета суммы заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + private void TextBoxCount_TextChanged(object sender, EventArgs e) + { + CalcSum(); + } + private void ComboBoxSushi_SelectedIndexChanged(object sender, EventArgs e) + { + CalcSum(); + } + private void ButtonSave_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxCount.Text)) + { + MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (comboBoxSushi.SelectedValue == null) + { + MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + _logger.LogInformation("Создание заказа"); + try + { + var operationResult = _logicO.CreateOrder(new OrderBindingModel + { + SushiId = Convert.ToInt32(comboBoxSushi.SelectedValue), + Count = Convert.ToInt32(textBoxCount.Text), + Sum = Convert.ToDouble(textBoxSum.Text) + }); + if (!operationResult) + { + throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах."); + } + MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка создания заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormMain.Designer.cs b/SushiBar/SushiBarView/Forms/FormMain.Designer.cs new file mode 100644 index 0000000..b5f46a1 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormMain.Designer.cs @@ -0,0 +1,153 @@ +namespace SushiBarView.Forms +{ + partial class FormMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + menuStrip1 = new MenuStrip(); + SushiToolStripMenuItem = new ToolStripMenuItem(); + buttonCreateOrder = new Button(); + buttonTakeOrderInWork = new Button(); + buttonOrderReady = new Button(); + buttonIssuedOrder = new Button(); + buttonRef = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(12, 31); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(980, 407); + dataGridView.TabIndex = 0; + // + // menuStrip1 + // + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { SushiToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(1190, 28); + menuStrip1.TabIndex = 1; + menuStrip1.Text = "menuStrip1"; + // + // SushiToolStripMenuItem + // + SushiToolStripMenuItem.Name = "SushiToolStripMenuItem"; + SushiToolStripMenuItem.Size = new Size(117, 24); + SushiToolStripMenuItem.Text = "Справочники"; + SushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click; + // + // buttonCreateOrder + // + buttonCreateOrder.Location = new Point(998, 50); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(180, 30); + buttonCreateOrder.TabIndex = 2; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += buttonCreateOrder_Click; + // + // buttonTakeOrderInWork + // + buttonTakeOrderInWork.Location = new Point(998, 86); + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; + buttonTakeOrderInWork.Size = new Size(180, 30); + buttonTakeOrderInWork.TabIndex = 3; + buttonTakeOrderInWork.Text = "Отдать на выполнение"; + buttonTakeOrderInWork.UseVisualStyleBackColor = true; + buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click; + // + // buttonOrderReady + // + buttonOrderReady.Location = new Point(998, 122); + buttonOrderReady.Name = "buttonOrderReady"; + buttonOrderReady.Size = new Size(180, 30); + buttonOrderReady.TabIndex = 4; + buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.UseVisualStyleBackColor = true; + buttonOrderReady.Click += buttonOrderReady_Click; + // + // buttonIssuedOrder + // + buttonIssuedOrder.Location = new Point(998, 158); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(180, 30); + buttonIssuedOrder.TabIndex = 5; + buttonIssuedOrder.Text = "Заказ Выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += buttonIssuedOrder_Click; + // + // buttonRef + // + buttonRef.Location = new Point(998, 194); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(180, 30); + buttonRef.TabIndex = 6; + buttonRef.Text = "Обновить список"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += buttonRef_Click; + // + // FormMain + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1190, 450); + Controls.Add(buttonRef); + Controls.Add(buttonIssuedOrder); + Controls.Add(buttonOrderReady); + Controls.Add(buttonTakeOrderInWork); + Controls.Add(buttonCreateOrder); + Controls.Add(dataGridView); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Name = "FormMain"; + Text = "FormMain"; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private DataGridView dataGridView; + private MenuStrip menuStrip1; + private ToolStripMenuItem SushiToolStripMenuItem; + private Button buttonCreateOrder; + private Button buttonTakeOrderInWork; + private Button buttonOrderReady; + private Button buttonIssuedOrder; + private Button buttonRef; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormMain.cs b/SushiBar/SushiBarView/Forms/FormMain.cs new file mode 100644 index 0000000..a990127 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormMain.cs @@ -0,0 +1,30 @@ +namespace SushiBarView.Forms +{ + public partial class FormMain + { + private void buttonCreateOrder_Click(object sender, EventArgs e) + { + ButtonCreateOrder_Click(sender, e); + } + + private void buttonTakeOrderInWork_Click(object sender, EventArgs e) + { + ButtonTakeOrderInWork_Click(sender, e); + } + + private void buttonOrderReady_Click(object sender, EventArgs e) + { + ButtonOrderReady_Click(sender, e); + } + + private void buttonIssuedOrder_Click(object sender, EventArgs e) + { + ButtonIssuedOrder_Click(sender, e); + } + + private void buttonRef_Click(object sender, EventArgs e) + { + ButtonRef_Click(sender, e); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormMain.resx b/SushiBar/SushiBarView/Forms/FormMain.resx new file mode 100644 index 0000000..a0623c8 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormMain.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormMainLogic.cs b/SushiBar/SushiBarView/Forms/FormMainLogic.cs new file mode 100644 index 0000000..d0b0a2c --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormMainLogic.cs @@ -0,0 +1,121 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using System.Windows.Forms; + +namespace SushiBarView.Forms +{ + public partial class FormMain : Form + { + private readonly ILogger _logger; + private readonly IOrderLogic _orderLogic; + public FormMain(ILogger logger, IOrderLogic orderLogic) + { + InitializeComponent(); + _logger = logger; + _orderLogic = orderLogic; + } + private void FormMain_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() + { + _logger.LogInformation("Загрузка заказов"); + // прописать логику + } + private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs + e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); + if (service is FormComponents form) + { + form.ShowDialog(); + } + } + private void SushiToolStripMenuItem_Click(object sender, EventArgs e) + { + // прописать логику + } + private void ButtonCreateOrder_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); + if (service is FormCreateOrder form) + { + form.ShowDialog(); + LoadData(); + } + } + private void ButtonTakeOrderInWork_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); + try + { + var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка передачи заказа в работу"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void ButtonOrderReady_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id); + try + { + var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о готовности заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void ButtonIssuedOrder_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id); + try + { + var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + _logger.LogInformation("Заказ №{id} выдан", id); + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + } +} diff --git a/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs b/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs index f656ab6..45988af 100644 --- a/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs +++ b/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs @@ -28,163 +28,187 @@ /// private void InitializeComponent() { - button1 = new Button(); - dataGridView1 = new DataGridView(); - groupBox1 = new GroupBox(); - button2 = new Button(); - button3 = new Button(); - button4 = new Button(); - button5 = new Button(); - button6 = new Button(); + buttonAdd = new Button(); + dataGridView = new DataGridView(); ComponentName = new DataGridViewTextBoxColumn(); ComponentCount = new DataGridViewTextBoxColumn(); + groupBox1 = new GroupBox(); + buttonRef = new Button(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonSave = new Button(); + buttonCancel = new Button(); label1 = new Label(); label2 = new Label(); - textBox1 = new TextBox(); - textBox2 = new TextBox(); - ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + textBoxPrice = new TextBox(); + textBoxName = new TextBox(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); groupBox1.SuspendLayout(); SuspendLayout(); // - // button1 + // buttonAdd // - button1.Location = new Point(560, 22); - button1.Name = "button1"; - button1.Size = new Size(110, 29); - button1.TabIndex = 0; - button1.Text = "Добавить"; - button1.UseVisualStyleBackColor = true; + buttonAdd.Location = new Point(640, 29); + buttonAdd.Margin = new Padding(3, 4, 3, 4); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(126, 39); + buttonAdd.TabIndex = 0; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; // - // dataGridView1 + // dataGridView // - dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ComponentName, ComponentCount }); - dataGridView1.Dock = DockStyle.Left; - dataGridView1.Location = new Point(3, 19); - dataGridView1.Name = "dataGridView1"; - dataGridView1.RowTemplate.Height = 25; - dataGridView1.Size = new Size(551, 199); - dataGridView1.TabIndex = 1; - // - // groupBox1 - // - groupBox1.Controls.Add(button6); - groupBox1.Controls.Add(button5); - groupBox1.Controls.Add(button4); - groupBox1.Controls.Add(dataGridView1); - groupBox1.Controls.Add(button1); - groupBox1.Location = new Point(12, 76); - groupBox1.Name = "groupBox1"; - groupBox1.Size = new Size(676, 221); - groupBox1.TabIndex = 2; - groupBox1.TabStop = false; - groupBox1.Text = "Компоненты"; - // - // button2 - // - button2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - button2.Location = new Point(532, 303); - button2.Name = "button2"; - button2.Size = new Size(75, 23); - button2.TabIndex = 3; - button2.Text = "Сохранить"; - button2.UseVisualStyleBackColor = true; - // - // button3 - // - button3.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - button3.Location = new Point(613, 303); - button3.Name = "button3"; - button3.Size = new Size(75, 23); - button3.TabIndex = 4; - button3.Text = "Отмена"; - button3.UseVisualStyleBackColor = true; - // - // button4 - // - button4.Location = new Point(560, 57); - button4.Name = "button4"; - button4.Size = new Size(110, 29); - button4.TabIndex = 2; - button4.Text = "Изменить"; - button4.UseVisualStyleBackColor = true; - // - // button5 - // - button5.Location = new Point(560, 92); - button5.Name = "button5"; - button5.Size = new Size(110, 29); - button5.TabIndex = 3; - button5.Text = "Удалить"; - button5.UseVisualStyleBackColor = true; - // - // button6 - // - button6.Location = new Point(560, 127); - button6.Name = "button6"; - button6.Size = new Size(110, 29); - button6.TabIndex = 4; - button6.Text = "Обновить"; - button6.UseVisualStyleBackColor = true; + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ComponentName, ComponentCount }); + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(3, 24); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(630, 267); + dataGridView.TabIndex = 1; // // ComponentName // + ComponentName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ComponentName.HeaderText = "Компонент"; + ComponentName.MinimumWidth = 6; ComponentName.Name = "ComponentName"; // // ComponentCount // ComponentCount.HeaderText = "Количество"; + ComponentCount.MinimumWidth = 6; ComponentCount.Name = "ComponentCount"; + ComponentCount.Width = 125; + // + // groupBox1 + // + groupBox1.Controls.Add(buttonRef); + groupBox1.Controls.Add(buttonDel); + groupBox1.Controls.Add(buttonUpd); + groupBox1.Controls.Add(dataGridView); + groupBox1.Controls.Add(buttonAdd); + groupBox1.Location = new Point(14, 101); + groupBox1.Margin = new Padding(3, 4, 3, 4); + groupBox1.Name = "groupBox1"; + groupBox1.Padding = new Padding(3, 4, 3, 4); + groupBox1.Size = new Size(773, 295); + groupBox1.TabIndex = 2; + groupBox1.TabStop = false; + groupBox1.Text = "Компоненты"; + // + // buttonRef + // + buttonRef.Location = new Point(640, 169); + buttonRef.Margin = new Padding(3, 4, 3, 4); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(126, 39); + buttonRef.TabIndex = 4; + buttonRef.Text = "Обновить"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += buttonRef_Click; + // + // buttonDel + // + buttonDel.Location = new Point(640, 123); + buttonDel.Margin = new Padding(3, 4, 3, 4); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(126, 39); + buttonDel.TabIndex = 3; + buttonDel.Text = "Удалить"; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += buttonDel_Click; + // + // buttonUpd + // + buttonUpd.Location = new Point(640, 76); + buttonUpd.Margin = new Padding(3, 4, 3, 4); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(126, 39); + buttonUpd.TabIndex = 2; + buttonUpd.Text = "Изменить"; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += buttonUpd_Click; + // + // buttonSave + // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonSave.Location = new Point(573, 404); + buttonSave.Margin = new Padding(3, 4, 3, 4); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(100, 31); + buttonSave.TabIndex = 3; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(679, 404); + buttonCancel.Margin = new Padding(3, 4, 3, 4); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(100, 31); + buttonCancel.TabIndex = 4; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; // // label1 // label1.AutoSize = true; - label1.Location = new Point(22, 12); + label1.Location = new Point(25, 16); label1.Name = "label1"; - label1.Size = new Size(62, 15); + label1.Size = new Size(80, 20); label1.TabIndex = 5; label1.Text = "Название:"; // // label2 // label2.AutoSize = true; - label2.Location = new Point(22, 45); + label2.Location = new Point(25, 60); label2.Name = "label2"; - label2.Size = new Size(70, 15); + label2.Size = new Size(86, 20); label2.TabIndex = 6; label2.Text = "Стоимость:"; // - // textBox1 + // textBoxPrice // - textBox1.Location = new Point(98, 42); - textBox1.Name = "textBox1"; - textBox1.Size = new Size(244, 23); - textBox1.TabIndex = 7; + textBoxPrice.Location = new Point(112, 56); + textBoxPrice.Margin = new Padding(3, 4, 3, 4); + textBoxPrice.Name = "textBoxPrice"; + textBoxPrice.Size = new Size(278, 27); + textBoxPrice.TabIndex = 7; // - // textBox2 + // textBoxName // - textBox2.Location = new Point(98, 13); - textBox2.Name = "textBox2"; - textBox2.Size = new Size(244, 23); - textBox2.TabIndex = 8; + textBoxName.Location = new Point(112, 17); + textBoxName.Margin = new Padding(3, 4, 3, 4); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(278, 27); + textBoxName.TabIndex = 8; // // FormSushi // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(700, 338); - Controls.Add(textBox2); - Controls.Add(textBox1); + ClientSize = new Size(800, 451); + Controls.Add(textBoxName); + Controls.Add(textBoxPrice); Controls.Add(label2); Controls.Add(label1); - Controls.Add(button3); - Controls.Add(button2); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); Controls.Add(groupBox1); - Margin = new Padding(3, 2, 3, 2); Name = "FormSushi"; Text = "Суши"; - ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); groupBox1.ResumeLayout(false); ResumeLayout(false); PerformLayout(); @@ -192,19 +216,19 @@ #endregion - private Button button1; - private DataGridView dataGridView1; + private Button buttonAdd; + private DataGridView dataGridView; private GroupBox groupBox1; - private Button button6; - private Button button5; - private Button button4; - private Button button2; - private Button button3; - private DataGridViewTextBoxColumn ComponentName; - private DataGridViewTextBoxColumn ComponentCount; + private Button buttonRef; + private Button buttonDel; + private Button buttonUpd; + private Button buttonSave; + private Button buttonCancel; private Label label1; private Label label2; - private TextBox textBox1; - private TextBox textBox2; + private TextBox textBoxPrice; + private TextBox textBoxName; + private DataGridViewTextBoxColumn ComponentName; + private DataGridViewTextBoxColumn ComponentCount; } } \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormSushi.cs b/SushiBar/SushiBarView/Forms/FormSushi.cs index 45ea6b4..5cfab53 100644 --- a/SushiBar/SushiBarView/Forms/FormSushi.cs +++ b/SushiBar/SushiBarView/Forms/FormSushi.cs @@ -1,20 +1,35 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace SushiBarView.Forms +namespace SushiBarView.Forms { - public partial class FormSushi : Form + public partial class FormSushi { - public FormSushi() + private void buttonAdd_Click(object sender, EventArgs e) { - InitializeComponent(); + ButtonAdd_Click(sender, e); + } + + private void buttonUpd_Click(object sender, EventArgs e) + { + ButtonUpd_Click(sender, e); + } + + private void buttonDel_Click(object sender, EventArgs e) + { + ButtonDel_Click(sender, e); + } + + private void buttonRef_Click(object sender, EventArgs e) + { + ButtonRef_Click(sender, e); + } + + private void buttonSave_Click(object sender, EventArgs e) + { + ButtonSave_Click(sender, e); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + ButtonCancel_Click(sender, e); } } } diff --git a/SushiBar/SushiBarView/Forms/FormSushi.resx b/SushiBar/SushiBarView/Forms/FormSushi.resx index 729c93c..29c43a9 100644 --- a/SushiBar/SushiBarView/Forms/FormSushi.resx +++ b/SushiBar/SushiBarView/Forms/FormSushi.resx @@ -123,10 +123,4 @@ True - - True - - - True - \ No newline at end of file diff --git a/SushiBar/SushiBarView/Forms/FormSushiLogic.cs b/SushiBar/SushiBarView/Forms/FormSushiLogic.cs new file mode 100644 index 0000000..b658d42 --- /dev/null +++ b/SushiBar/SushiBarView/Forms/FormSushiLogic.cs @@ -0,0 +1,201 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.SearchModels; +using SushiBarDataModels.Models; + +namespace SushiBarView.Forms +{ + public partial class FormSushi : Form + { + private readonly ILogger _logger; + private readonly ISushiLogic _logic; + private int? _id; + private Dictionary _sushiComponents; + public int Id { set { _id = value; } } + public FormSushi(ILogger logger, ISushiLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + _sushiComponents = new Dictionary(); + } + private void FormSushi_Load(object sender, EventArgs e) + { + if (_id.HasValue) + { + _logger.LogInformation("Загрузка изделия"); + try + { + var view = _logic.ReadElement(new SushiSearchModel + { + Id = _id.Value + }); + if (view != null) + { + textBoxName.Text = view.SushiName; + textBoxPrice.Text = view.Price.ToString(); + _sushiComponents = view.SushiComponents ?? new Dictionary(); + LoadData(); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void LoadData() + { + _logger.LogInformation("Загрузка компонент изделия"); + try + { + if (_sushiComponents != null) + { + dataGridView.Rows.Clear(); + foreach (var pc in _sushiComponents) + { + dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 }); + } + textBoxPrice.Text = CalcPrice().ToString(); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки компонент изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + private void ButtonAdd_Click(object sender, EventArgs e) + { + var service = + Program.ServiceProvider?.GetService(typeof(FormSushiComponent)); + if (service is FormSushiComponent form) + { + + if (form.ShowDialog() == DialogResult.OK) + { + if (form.ComponentModel == null) + { + return; + } + _logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count); + if (_sushiComponents.ContainsKey(form.Id)) + { + _sushiComponents[form.Id] = (form.ComponentModel, form.Count); + } + else + { + _sushiComponents.Add(form.Id, (form.ComponentModel, form.Count)); + } + LoadData(); + } + } + } + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent)); + if (service is FormSushiComponent form) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); + form.Id = id; + form.Count = _sushiComponents[id].Item2; + if (form.ShowDialog() == DialogResult.OK) + { + if (form.ComponentModel == null) + { + return; + } + _logger.LogInformation("Изменение компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count); + _sushiComponents[form.Id] = (form.ComponentModel, form.Count); + LoadData(); + } + } + } + } + private void ButtonDel_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + try + { + _logger.LogInformation("Удаление компонента: { ComponentName} - { Count}", dataGridView.SelectedRows[0].Cells[1].Value); + _sushiComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + LoadData(); + } + } + } + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + private void ButtonSave_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxName.Text)) + { + MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (string.IsNullOrEmpty(textBoxPrice.Text)) + { + MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (_sushiComponents == null || _sushiComponents.Count == 0) + { + MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + _logger.LogInformation("Сохранение изделия"); + try + { + var model = new SushiBindingModel + { + Id = _id ?? 0, + SushiName = textBoxName.Text, + Price = Convert.ToDouble(textBoxPrice.Text), + SushiComponents = _sushiComponents + }; + var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + private double CalcPrice() + { + double price = 0; + foreach (var elem in _sushiComponents) + { + price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2); + } + return Math.Round(price * 1.1, 2); + } + } +} diff --git a/SushiBar/SushiBarView/Program.cs b/SushiBar/SushiBarView/Program.cs index aff4891..874a82e 100644 --- a/SushiBar/SushiBarView/Program.cs +++ b/SushiBar/SushiBarView/Program.cs @@ -5,6 +5,7 @@ using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.StoragesContracts; using SushiBarListImplement.Implements; +using SushiBarView.Forms; namespace SushiBarView { @@ -24,7 +25,8 @@ namespace SushiBarView var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); - //Application.Run(_serviceProvider.GetRequiredService); + + Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) { @@ -36,10 +38,17 @@ namespace SushiBarView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); + + services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/SushiBar/SushiBarView/nlog.config b/SushiBar/SushiBarView/nlog.config new file mode 100644 index 0000000..af70d20 --- /dev/null +++ b/SushiBar/SushiBarView/nlog.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file -- 2.25.1 From abb8e99957d171b7d2b136e430122dfd40565840 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Tue, 13 Feb 2024 21:10:12 +0400 Subject: [PATCH 11/22] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B0=D0=B5=D1=82=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/Form1.Designer.cs | 39 --------- SushiBar/SushiBar/Form1.cs | 10 --- SushiBar/SushiBar/Form1.resx | 120 ---------------------------- SushiBar/SushiBar/Program.cs | 17 ---- SushiBar/SushiBar/SushiBar.csproj | 11 --- 5 files changed, 197 deletions(-) delete mode 100644 SushiBar/SushiBar/Form1.Designer.cs delete mode 100644 SushiBar/SushiBar/Form1.cs delete mode 100644 SushiBar/SushiBar/Form1.resx delete mode 100644 SushiBar/SushiBar/Program.cs delete mode 100644 SushiBar/SushiBar/SushiBar.csproj diff --git a/SushiBar/SushiBar/Form1.Designer.cs b/SushiBar/SushiBar/Form1.Designer.cs deleted file mode 100644 index b5f899b..0000000 --- a/SushiBar/SushiBar/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace SushiBar -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} \ No newline at end of file diff --git a/SushiBar/SushiBar/Form1.cs b/SushiBar/SushiBar/Form1.cs deleted file mode 100644 index 0eaa471..0000000 --- a/SushiBar/SushiBar/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SushiBar -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/SushiBar/SushiBar/Form1.resx b/SushiBar/SushiBar/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/SushiBar/SushiBar/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs deleted file mode 100644 index 402417b..0000000 --- a/SushiBar/SushiBar/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace SushiBar -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); - } - } -} \ No newline at end of file diff --git a/SushiBar/SushiBar/SushiBar.csproj b/SushiBar/SushiBar/SushiBar.csproj deleted file mode 100644 index b57c89e..0000000 --- a/SushiBar/SushiBar/SushiBar.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - WinExe - net6.0-windows - enable - true - enable - - - \ No newline at end of file -- 2.25.1 From 9e84a378bf18a0fe93f4b04012223ff689c6875a Mon Sep 17 00:00:00 2001 From: bekodeg Date: Tue, 13 Feb 2024 21:37:47 +0400 Subject: [PATCH 12/22] =?UTF-8?q?=D0=BD=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar.sln | 52 +++++++++---------- .../Forms/FormComponent.Designer.cs | 0 .../Forms/FormComponent.cs | 0 .../Forms/FormComponent.resx | 0 .../Forms/FormComponent.ru.resx | 0 .../Forms/FormComponentLogic.cs | 0 .../Forms/FormComponents.Designer.cs | 0 .../Forms/FormComponents.cs | 0 .../Forms/FormComponents.resx | 0 .../Forms/FormComponentsLogic.cs | 0 .../Forms/FormCreateOrder.Designer.cs | 0 .../Forms/FormCreateOrder.cs | 0 .../Forms/FormCreateOrder.resx | 0 .../Forms/FormCreateOrderLogic.cs | 0 .../Forms/FormMain.Designer.cs | 0 .../Forms/FormMain.cs | 0 .../Forms/FormMain.resx | 0 .../Forms/FormMainLogic.cs | 0 .../Forms/FormSushi.Designer.cs | 0 .../Forms/FormSushi.cs | 0 .../Forms/FormSushi.resx | 0 .../Forms/FormSushiComponent.Designer.cs | 0 .../Forms/FormSushiComponent.cs | 0 .../Forms/FormSushiComponent.resx | 0 .../Forms/FormSushiComponentLogic.cs | 0 .../Forms/FormSushiLogic.cs | 0 .../{SushiBarView => SushiBar}/Program.cs | 0 .../{SushiBarView => SushiBar}/nlog.config | 0 28 files changed, 26 insertions(+), 26 deletions(-) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponent.Designer.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponent.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponent.resx (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponent.ru.resx (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponentLogic.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponents.Designer.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponents.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponents.resx (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormComponentsLogic.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormCreateOrder.Designer.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormCreateOrder.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormCreateOrder.resx (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormCreateOrderLogic.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormMain.Designer.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormMain.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormMain.resx (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormMainLogic.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushi.Designer.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushi.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushi.resx (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushiComponent.Designer.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushiComponent.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushiComponent.resx (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushiComponentLogic.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Forms/FormSushiLogic.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/Program.cs (100%) rename SushiBar/{SushiBarView => SushiBar}/nlog.config (100%) diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index 588ef02..6fd8544 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{968304F1-7A64-49F1-B27A-48AED7C7754D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiBar.csproj", "{FA7992B7-E081-4E09-9CED-48394FA38B31}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarBusinessLogic", "SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{2657FF86-010E-4A49-9D3F-01FCCAC286B1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarBusinessLogic", "SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{CD8F84A5-5665-49EC-9630-F27A3176BA47}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{2D04F87F-2348-4540-9DCB-44A72201FA1B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarListImplement", "SushiBarListImplement\SushiBarListImplement.csproj", "{A9E33D09-7C81-4D94-9A06-CF8A347D5740}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarView", "SushiBarView\SushiBarView.csproj", "{BCB90098-D537-4516-8DBA-450FEF6B479D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarListImplement", "SushiBarListImplement\SushiBarListImplement.csproj", "{FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -19,31 +19,31 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {968304F1-7A64-49F1-B27A-48AED7C7754D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {968304F1-7A64-49F1-B27A-48AED7C7754D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {968304F1-7A64-49F1-B27A-48AED7C7754D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {968304F1-7A64-49F1-B27A-48AED7C7754D}.Release|Any CPU.Build.0 = Release|Any CPU - {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D3DDD3BE-863D-42E3-8CE7-FE527C5ADA13}.Release|Any CPU.Build.0 = Release|Any CPU - {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD8F84A5-5665-49EC-9630-F27A3176BA47}.Release|Any CPU.Build.0 = Release|Any CPU - {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A9E33D09-7C81-4D94-9A06-CF8A347D5740}.Release|Any CPU.Build.0 = Release|Any CPU - {BCB90098-D537-4516-8DBA-450FEF6B479D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BCB90098-D537-4516-8DBA-450FEF6B479D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BCB90098-D537-4516-8DBA-450FEF6B479D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BCB90098-D537-4516-8DBA-450FEF6B479D}.Release|Any CPU.Build.0 = Release|Any CPU + {FA7992B7-E081-4E09-9CED-48394FA38B31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA7992B7-E081-4E09-9CED-48394FA38B31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA7992B7-E081-4E09-9CED-48394FA38B31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA7992B7-E081-4E09-9CED-48394FA38B31}.Release|Any CPU.Build.0 = Release|Any CPU + {2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Release|Any CPU.Build.0 = Release|Any CPU + {2D04F87F-2348-4540-9DCB-44A72201FA1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D04F87F-2348-4540-9DCB-44A72201FA1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D04F87F-2348-4540-9DCB-44A72201FA1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D04F87F-2348-4540-9DCB-44A72201FA1B}.Release|Any CPU.Build.0 = Release|Any CPU + {8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Release|Any CPU.Build.0 = Release|Any CPU + {FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {5C5DF432-32EF-4281-A1A9-8B849939EEEF} + SolutionGuid = {28DB1CDE-A61B-4A26-A1F8-14D39B4DE40B} EndGlobalSection EndGlobal diff --git a/SushiBar/SushiBarView/Forms/FormComponent.Designer.cs b/SushiBar/SushiBar/Forms/FormComponent.Designer.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponent.Designer.cs rename to SushiBar/SushiBar/Forms/FormComponent.Designer.cs diff --git a/SushiBar/SushiBarView/Forms/FormComponent.cs b/SushiBar/SushiBar/Forms/FormComponent.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponent.cs rename to SushiBar/SushiBar/Forms/FormComponent.cs diff --git a/SushiBar/SushiBarView/Forms/FormComponent.resx b/SushiBar/SushiBar/Forms/FormComponent.resx similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponent.resx rename to SushiBar/SushiBar/Forms/FormComponent.resx diff --git a/SushiBar/SushiBarView/Forms/FormComponent.ru.resx b/SushiBar/SushiBar/Forms/FormComponent.ru.resx similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponent.ru.resx rename to SushiBar/SushiBar/Forms/FormComponent.ru.resx diff --git a/SushiBar/SushiBarView/Forms/FormComponentLogic.cs b/SushiBar/SushiBar/Forms/FormComponentLogic.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponentLogic.cs rename to SushiBar/SushiBar/Forms/FormComponentLogic.cs diff --git a/SushiBar/SushiBarView/Forms/FormComponents.Designer.cs b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponents.Designer.cs rename to SushiBar/SushiBar/Forms/FormComponents.Designer.cs diff --git a/SushiBar/SushiBarView/Forms/FormComponents.cs b/SushiBar/SushiBar/Forms/FormComponents.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponents.cs rename to SushiBar/SushiBar/Forms/FormComponents.cs diff --git a/SushiBar/SushiBarView/Forms/FormComponents.resx b/SushiBar/SushiBar/Forms/FormComponents.resx similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponents.resx rename to SushiBar/SushiBar/Forms/FormComponents.resx diff --git a/SushiBar/SushiBarView/Forms/FormComponentsLogic.cs b/SushiBar/SushiBar/Forms/FormComponentsLogic.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormComponentsLogic.cs rename to SushiBar/SushiBar/Forms/FormComponentsLogic.cs diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrder.Designer.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormCreateOrder.Designer.cs rename to SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrder.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormCreateOrder.cs rename to SushiBar/SushiBar/Forms/FormCreateOrder.cs diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrder.resx b/SushiBar/SushiBar/Forms/FormCreateOrder.resx similarity index 100% rename from SushiBar/SushiBarView/Forms/FormCreateOrder.resx rename to SushiBar/SushiBar/Forms/FormCreateOrder.resx diff --git a/SushiBar/SushiBarView/Forms/FormCreateOrderLogic.cs b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormCreateOrderLogic.cs rename to SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs diff --git a/SushiBar/SushiBarView/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormMain.Designer.cs rename to SushiBar/SushiBar/Forms/FormMain.Designer.cs diff --git a/SushiBar/SushiBarView/Forms/FormMain.cs b/SushiBar/SushiBar/Forms/FormMain.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormMain.cs rename to SushiBar/SushiBar/Forms/FormMain.cs diff --git a/SushiBar/SushiBarView/Forms/FormMain.resx b/SushiBar/SushiBar/Forms/FormMain.resx similarity index 100% rename from SushiBar/SushiBarView/Forms/FormMain.resx rename to SushiBar/SushiBar/Forms/FormMain.resx diff --git a/SushiBar/SushiBarView/Forms/FormMainLogic.cs b/SushiBar/SushiBar/Forms/FormMainLogic.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormMainLogic.cs rename to SushiBar/SushiBar/Forms/FormMainLogic.cs diff --git a/SushiBar/SushiBarView/Forms/FormSushi.Designer.cs b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushi.Designer.cs rename to SushiBar/SushiBar/Forms/FormSushi.Designer.cs diff --git a/SushiBar/SushiBarView/Forms/FormSushi.cs b/SushiBar/SushiBar/Forms/FormSushi.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushi.cs rename to SushiBar/SushiBar/Forms/FormSushi.cs diff --git a/SushiBar/SushiBarView/Forms/FormSushi.resx b/SushiBar/SushiBar/Forms/FormSushi.resx similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushi.resx rename to SushiBar/SushiBar/Forms/FormSushi.resx diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponent.Designer.cs b/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushiComponent.Designer.cs rename to SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponent.cs b/SushiBar/SushiBar/Forms/FormSushiComponent.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushiComponent.cs rename to SushiBar/SushiBar/Forms/FormSushiComponent.cs diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponent.resx b/SushiBar/SushiBar/Forms/FormSushiComponent.resx similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushiComponent.resx rename to SushiBar/SushiBar/Forms/FormSushiComponent.resx diff --git a/SushiBar/SushiBarView/Forms/FormSushiComponentLogic.cs b/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushiComponentLogic.cs rename to SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs diff --git a/SushiBar/SushiBarView/Forms/FormSushiLogic.cs b/SushiBar/SushiBar/Forms/FormSushiLogic.cs similarity index 100% rename from SushiBar/SushiBarView/Forms/FormSushiLogic.cs rename to SushiBar/SushiBar/Forms/FormSushiLogic.cs diff --git a/SushiBar/SushiBarView/Program.cs b/SushiBar/SushiBar/Program.cs similarity index 100% rename from SushiBar/SushiBarView/Program.cs rename to SushiBar/SushiBar/Program.cs diff --git a/SushiBar/SushiBarView/nlog.config b/SushiBar/SushiBar/nlog.config similarity index 100% rename from SushiBar/SushiBarView/nlog.config rename to SushiBar/SushiBar/nlog.config -- 2.25.1 From ad66d408e30a2c4c8812531f7d1b3ccef26b51ea Mon Sep 17 00:00:00 2001 From: bekodeg Date: Tue, 13 Feb 2024 21:56:03 +0400 Subject: [PATCH 13/22] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=D0=B9=D0=BC=D1=81=D0=BF=D0=B5=D0=B9=D1=81=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/Forms/FormComponent.Designer.cs | 2 +- SushiBar/SushiBar/Forms/FormComponent.cs | 11 +---------- SushiBar/SushiBar/Forms/FormComponentLogic.cs | 2 +- SushiBar/SushiBar/Forms/FormComponents.Designer.cs | 2 +- SushiBar/SushiBar/Forms/FormComponents.cs | 2 +- SushiBar/SushiBar/Forms/FormComponentsLogic.cs | 4 ++-- SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs | 2 +- SushiBar/SushiBar/Forms/FormCreateOrder.cs | 2 +- SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs | 2 +- SushiBar/SushiBar/Forms/FormMain.Designer.cs | 2 +- SushiBar/SushiBar/Forms/FormMain.cs | 2 +- SushiBar/SushiBar/Forms/FormMainLogic.cs | 3 ++- SushiBar/SushiBar/Forms/FormSushi.Designer.cs | 2 +- SushiBar/SushiBar/Forms/FormSushi.cs | 2 +- .../SushiBar/Forms/FormSushiComponent.Designer.cs | 2 +- SushiBar/SushiBar/Forms/FormSushiComponent.cs | 2 +- SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs | 2 +- SushiBar/SushiBar/Forms/FormSushiLogic.cs | 9 ++++----- SushiBar/SushiBar/Program.cs | 4 ++-- 19 files changed, 25 insertions(+), 34 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormComponent.Designer.cs b/SushiBar/SushiBar/Forms/FormComponent.Designer.cs index 7c52e81..dcc8389 100644 --- a/SushiBar/SushiBar/Forms/FormComponent.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormComponent.Designer.cs @@ -1,4 +1,4 @@ -namespace SushiBarView +namespace SushiBar.Forms { partial class FormComponent { diff --git a/SushiBar/SushiBar/Forms/FormComponent.cs b/SushiBar/SushiBar/Forms/FormComponent.cs index f541ef5..1c22dbe 100644 --- a/SushiBar/SushiBar/Forms/FormComponent.cs +++ b/SushiBar/SushiBar/Forms/FormComponent.cs @@ -1,14 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace SushiBarView +namespace SushiBar.Forms { public partial class FormComponent { diff --git a/SushiBar/SushiBar/Forms/FormComponentLogic.cs b/SushiBar/SushiBar/Forms/FormComponentLogic.cs index 28ea2ba..7225978 100644 --- a/SushiBar/SushiBar/Forms/FormComponentLogic.cs +++ b/SushiBar/SushiBar/Forms/FormComponentLogic.cs @@ -3,7 +3,7 @@ using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModels; using Microsoft.Extensions.Logging; -namespace SushiBarView +namespace SushiBar.Forms { public partial class FormComponent : Form { diff --git a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs index 616bc5c..4fc6149 100644 --- a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs @@ -1,4 +1,4 @@ -namespace SushiBarView +namespace SushiBar.Forms { partial class FormComponents { diff --git a/SushiBar/SushiBar/Forms/FormComponents.cs b/SushiBar/SushiBar/Forms/FormComponents.cs index b858c9c..a2b5925 100644 --- a/SushiBar/SushiBar/Forms/FormComponents.cs +++ b/SushiBar/SushiBar/Forms/FormComponents.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SushiBarView +namespace SushiBar.Forms { public partial class FormComponents { diff --git a/SushiBar/SushiBar/Forms/FormComponentsLogic.cs b/SushiBar/SushiBar/Forms/FormComponentsLogic.cs index e937e38..73c5f5b 100644 --- a/SushiBar/SushiBar/Forms/FormComponentsLogic.cs +++ b/SushiBar/SushiBar/Forms/FormComponentsLogic.cs @@ -1,9 +1,9 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using Microsoft.Extensions.Logging; +using SushiView; - -namespace SushiBarView +namespace SushiBar.Forms { public partial class FormComponents : Form { diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs index bbe3ee3..8078759 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs @@ -1,4 +1,4 @@ -namespace SushiBarView.Forms +namespace SushiBar.Forms { partial class FormCreateOrder { diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.cs index cddc482..901f376 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SushiBarView.Forms +namespace SushiBar.Forms { public partial class FormCreateOrder { diff --git a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs index 50619f0..35bc1e7 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SushiBarView.Forms +namespace SushiBar.Forms { public partial class FormCreateOrder : Form { diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index b5f46a1..dbfe99d 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -1,4 +1,4 @@ -namespace SushiBarView.Forms +namespace SushiBar.Forms { partial class FormMain { diff --git a/SushiBar/SushiBar/Forms/FormMain.cs b/SushiBar/SushiBar/Forms/FormMain.cs index a990127..101beb2 100644 --- a/SushiBar/SushiBar/Forms/FormMain.cs +++ b/SushiBar/SushiBar/Forms/FormMain.cs @@ -1,4 +1,4 @@ -namespace SushiBarView.Forms +namespace SushiBar.Forms { public partial class FormMain { diff --git a/SushiBar/SushiBar/Forms/FormMainLogic.cs b/SushiBar/SushiBar/Forms/FormMainLogic.cs index d0b0a2c..cfb0a01 100644 --- a/SushiBar/SushiBar/Forms/FormMainLogic.cs +++ b/SushiBar/SushiBar/Forms/FormMainLogic.cs @@ -1,9 +1,10 @@ using Microsoft.Extensions.Logging; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; +using SushiView; using System.Windows.Forms; -namespace SushiBarView.Forms +namespace SushiBar.Forms { public partial class FormMain : Form { diff --git a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs index 45988af..3d2a278 100644 --- a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs @@ -1,4 +1,4 @@ -namespace SushiBarView.Forms +namespace SushiBar.Forms { partial class FormSushi { diff --git a/SushiBar/SushiBar/Forms/FormSushi.cs b/SushiBar/SushiBar/Forms/FormSushi.cs index 5cfab53..8e40fa5 100644 --- a/SushiBar/SushiBar/Forms/FormSushi.cs +++ b/SushiBar/SushiBar/Forms/FormSushi.cs @@ -1,4 +1,4 @@ -namespace SushiBarView.Forms +namespace SushiBar.Forms { public partial class FormSushi { diff --git a/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs b/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs index 63d4bfb..147cb44 100644 --- a/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs @@ -1,4 +1,4 @@ -namespace SushiBarView.Forms +namespace SushiBar.Forms { partial class FormSushiComponent { diff --git a/SushiBar/SushiBar/Forms/FormSushiComponent.cs b/SushiBar/SushiBar/Forms/FormSushiComponent.cs index 7a7479a..994a0b3 100644 --- a/SushiBar/SushiBar/Forms/FormSushiComponent.cs +++ b/SushiBar/SushiBar/Forms/FormSushiComponent.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SushiBarView.Forms +namespace SushiBar.Forms { public partial class FormSushiComponent { diff --git a/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs b/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs index 37f116b..a776a59 100644 --- a/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs +++ b/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SushiBarView.Forms +namespace SushiBar.Forms { partial class FormSushiComponent : Form { diff --git a/SushiBar/SushiBar/Forms/FormSushiLogic.cs b/SushiBar/SushiBar/Forms/FormSushiLogic.cs index b658d42..a7d0cf2 100644 --- a/SushiBar/SushiBar/Forms/FormSushiLogic.cs +++ b/SushiBar/SushiBar/Forms/FormSushiLogic.cs @@ -3,8 +3,9 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModels; using SushiBarDataModels.Models; +using SushiView; -namespace SushiBarView.Forms +namespace SushiBar.Forms { public partial class FormSushi : Form { @@ -64,14 +65,12 @@ namespace SushiBarView.Forms catch (Exception ex) { _logger.LogError(ex, "Ошибка загрузки компонент изделия"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void ButtonAdd_Click(object sender, EventArgs e) { - var service = - Program.ServiceProvider?.GetService(typeof(FormSushiComponent)); + var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent)); if (service is FormSushiComponent form) { diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index 874a82e..7013d20 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -5,9 +5,9 @@ using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.StoragesContracts; using SushiBarListImplement.Implements; -using SushiBarView.Forms; +using SushiBar.Forms; -namespace SushiBarView +namespace SushiView { internal static class Program { -- 2.25.1 From 9b4045dc16a6dcdb5ead0131ea66fb9d44d72842 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Wed, 14 Feb 2024 09:58:18 +0400 Subject: [PATCH 14/22] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B8=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forms/FormCreateOrder.Designer.cs | 2 +- .../SushiBar/Forms/FormCreateOrderLogic.cs | 17 ++- SushiBar/SushiBar/Forms/FormMain.Designer.cs | 37 ++++-- SushiBar/SushiBar/Forms/FormMain.cs | 10 ++ SushiBar/SushiBar/Forms/FormMainLogic.cs | 28 +++- .../SushiBar/Forms/FormSushis.Designer.cs | 114 +++++++++++++++++ SushiBar/SushiBar/Forms/FormSushis.cs | 35 +++++ SushiBar/SushiBar/Forms/FormSushis.resx | 120 ++++++++++++++++++ SushiBar/SushiBar/Forms/FormSushisLogic.cs | 105 +++++++++++++++ SushiBar/SushiBar/Program.cs | 2 + .../DataListSingleton.cs | 2 +- .../Implements/ComponentStorage.cs | 2 +- .../Implements/OrderStorage.cs | 2 +- .../Implements/SushiStorage.cs | 2 +- 14 files changed, 459 insertions(+), 19 deletions(-) create mode 100644 SushiBar/SushiBar/Forms/FormSushis.Designer.cs create mode 100644 SushiBar/SushiBar/Forms/FormSushis.cs create mode 100644 SushiBar/SushiBar/Forms/FormSushis.resx create mode 100644 SushiBar/SushiBar/Forms/FormSushisLogic.cs diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs index 8078759..becf85e 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs @@ -122,7 +122,7 @@ Controls.Add(buttonCancel); Controls.Add(buttonSave); Name = "FormCreateOrder"; - Text = "FormCreateOrder"; + Text = "Заказ"; ResumeLayout(false); PerformLayout(); } diff --git a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs index 35bc1e7..e9c9c0b 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace SushiBar.Forms { @@ -24,8 +25,20 @@ namespace SushiBar.Forms } private void FormCreateOrder_Load(object sender, EventArgs e) { - _logger.LogInformation("Загрузка изделий для заказа"); - // прописать логику + try + { + var list = _logicS.ReadList(null); + if (list != null) + { + comboBoxSushi.Items.AddRange(list.ToArray()); + } + _logger.LogInformation("Загрузка суши для заказа"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки суши"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } private void CalcSum() { diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index dbfe99d..1de243a 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -30,7 +30,9 @@ { dataGridView = new DataGridView(); menuStrip1 = new MenuStrip(); - SushiToolStripMenuItem = new ToolStripMenuItem(); + ToolStripMenuItem = new ToolStripMenuItem(); + sushiToolStripMenuItem = new ToolStripMenuItem(); + componentsToolStripMenuItem = new ToolStripMenuItem(); buttonCreateOrder = new Button(); buttonTakeOrderInWork = new Button(); buttonOrderReady = new Button(); @@ -53,19 +55,33 @@ // menuStrip1 // menuStrip1.ImageScalingSize = new Size(20, 20); - menuStrip1.Items.AddRange(new ToolStripItem[] { SushiToolStripMenuItem }); + menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenuItem }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; menuStrip1.Size = new Size(1190, 28); menuStrip1.TabIndex = 1; menuStrip1.Text = "menuStrip1"; // - // SushiToolStripMenuItem + // ToolStripMenuItem // - SushiToolStripMenuItem.Name = "SushiToolStripMenuItem"; - SushiToolStripMenuItem.Size = new Size(117, 24); - SushiToolStripMenuItem.Text = "Справочники"; - SushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click; + ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sushiToolStripMenuItem, componentsToolStripMenuItem }); + ToolStripMenuItem.Name = "ToolStripMenuItem"; + ToolStripMenuItem.Size = new Size(117, 24); + ToolStripMenuItem.Text = "Справочники"; + // + // sushiToolStripMenuItem + // + sushiToolStripMenuItem.Name = "sushiToolStripMenuItem"; + sushiToolStripMenuItem.Size = new Size(224, 26); + sushiToolStripMenuItem.Text = "Суши"; + sushiToolStripMenuItem.Click += sushiToolStripMenuItem_Click; + // + // componentsToolStripMenuItem + // + componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; + componentsToolStripMenuItem.Size = new Size(224, 26); + componentsToolStripMenuItem.Text = "Компоненты"; + componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click; // // buttonCreateOrder // @@ -131,7 +147,7 @@ Controls.Add(menuStrip1); MainMenuStrip = menuStrip1; Name = "FormMain"; - Text = "FormMain"; + Text = "Сушибар"; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); @@ -149,5 +165,10 @@ private Button buttonOrderReady; private Button buttonIssuedOrder; private Button buttonRef; + private ToolStripMenuItem сушиToolStripMenuItem; + private ToolStripMenuItem компонентыToolStripMenuItem; + private ToolStripMenuItem ToolStripMenuItem; + private ToolStripMenuItem sushiToolStripMenuItem; + private ToolStripMenuItem componentsToolStripMenuItem; } } \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormMain.cs b/SushiBar/SushiBar/Forms/FormMain.cs index 101beb2..f9a5708 100644 --- a/SushiBar/SushiBar/Forms/FormMain.cs +++ b/SushiBar/SushiBar/Forms/FormMain.cs @@ -26,5 +26,15 @@ { ButtonRef_Click(sender, e); } + + private void sushiToolStripMenuItem_Click(object sender, EventArgs e) + { + SushiToolStripMenuItem_Click(sender, e); + } + + private void componentsToolStripMenuItem_Click(object sender, EventArgs e) + { + ComponentsToolStripMenuItem_Click(sender, e); + } } } diff --git a/SushiBar/SushiBar/Forms/FormMainLogic.cs b/SushiBar/SushiBar/Forms/FormMainLogic.cs index cfb0a01..bc3e58a 100644 --- a/SushiBar/SushiBar/Forms/FormMainLogic.cs +++ b/SushiBar/SushiBar/Forms/FormMainLogic.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using SushiView; @@ -22,10 +23,25 @@ namespace SushiBar.Forms } private void LoadData() { - _logger.LogInformation("Загрузка заказов"); - // прописать логику + try + { + var list = _orderLogic.ReadList(null); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["SushiId"].Visible = false; + dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + } + _logger.LogInformation("Загрузка заказов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки суши"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } - private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs + private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); @@ -36,7 +52,11 @@ namespace SushiBar.Forms } private void SushiToolStripMenuItem_Click(object sender, EventArgs e) { - // прописать логику + var service = Program.ServiceProvider?.GetService(typeof(FormSushis)); + if (service is FormSushis form) + { + form.ShowDialog(); + } } private void ButtonCreateOrder_Click(object sender, EventArgs e) { diff --git a/SushiBar/SushiBar/Forms/FormSushis.Designer.cs b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs new file mode 100644 index 0000000..cb77827 --- /dev/null +++ b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs @@ -0,0 +1,114 @@ +namespace SushiBar.Forms +{ + partial class FormSushis + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + buttonRef = new Button(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(0, 0); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(668, 450); + dataGridView.TabIndex = 1; + // + // buttonRef + // + buttonRef.Location = new Point(674, 117); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(114, 29); + buttonRef.TabIndex = 8; + buttonRef.Text = "Обновить"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += buttonRef_Click; + // + // buttonDel + // + buttonDel.Location = new Point(674, 82); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(114, 29); + buttonDel.TabIndex = 7; + buttonDel.Text = "Удалить"; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += buttonDel_Click; + // + // buttonUpd + // + buttonUpd.Location = new Point(674, 47); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(114, 29); + buttonUpd.TabIndex = 6; + buttonUpd.Text = "Изменить"; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += buttonUpd_Click; + // + // buttonAdd + // + buttonAdd.Location = new Point(674, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(114, 29); + buttonAdd.TabIndex = 5; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // FormSushis + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(buttonRef); + Controls.Add(buttonDel); + Controls.Add(buttonUpd); + Controls.Add(buttonAdd); + Controls.Add(dataGridView); + Name = "FormSushis"; + Text = "Суши"; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Button buttonRef; + private Button buttonDel; + private Button buttonUpd; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormSushis.cs b/SushiBar/SushiBar/Forms/FormSushis.cs new file mode 100644 index 0000000..6a12f95 --- /dev/null +++ b/SushiBar/SushiBar/Forms/FormSushis.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SushiBar.Forms +{ + public partial class FormSushis + { + private void buttonAdd_Click(object sender, EventArgs e) + { + ButtonAdd_Click(sender, e); + } + + private void buttonUpd_Click(object sender, EventArgs e) + { + ButtonUpd_Click(sender, e); + } + + private void buttonDel_Click(object sender, EventArgs e) + { + ButtonDel_Click(sender, e); + } + + private void buttonRef_Click(object sender, EventArgs e) + { + ButtonRef_Click(sender, e); + } + } +} diff --git a/SushiBar/SushiBar/Forms/FormSushis.resx b/SushiBar/SushiBar/Forms/FormSushis.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/SushiBar/SushiBar/Forms/FormSushis.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormSushisLogic.cs b/SushiBar/SushiBar/Forms/FormSushisLogic.cs new file mode 100644 index 0000000..1b789c3 --- /dev/null +++ b/SushiBar/SushiBar/Forms/FormSushisLogic.cs @@ -0,0 +1,105 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using SushiView; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SushiBar.Forms +{ + public partial class FormSushis : Form + { + private readonly ILogger _logger; + private readonly ISushiLogic _logic; + public FormSushis(ILogger logger, ISushiLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + private void FormSushis_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() + { + try + { + var list = _logic.ReadList(null); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + } + _logger.LogInformation("Загрузка суши"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки суши"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonAdd_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormSushi)); + if (service is FormSushi form) + { + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = Program.ServiceProvider?.GetService(typeof(FormSushi)); + if (service is FormSushi form) + { + form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + } + private void ButtonDel_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Удаление компонента"); + try + { + if (!_logic.Delete(new SushiBindingModel + { + Id = id + })) + { + throw new Exception("Ошибка при удалении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка удаления компонента"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + } + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + } +} diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index 7013d20..74ce596 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -26,6 +26,8 @@ namespace SushiView ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); + ILogger logger = _serviceProvider.GetService(); + Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) diff --git a/SushiBar/SushiBarListImplement/DataListSingleton.cs b/SushiBar/SushiBarListImplement/DataListSingleton.cs index c02c6c7..3df79fa 100644 --- a/SushiBar/SushiBarListImplement/DataListSingleton.cs +++ b/SushiBar/SushiBarListImplement/DataListSingleton.cs @@ -15,7 +15,7 @@ namespace SushiBarListImplement Sushis = new List(); } - public static DataListSingleton GetInsance() + public static DataListSingleton GetInstance() { if (_instance == null) { diff --git a/SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs b/SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs index e242577..1fea2c0 100644 --- a/SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs +++ b/SushiBar/SushiBarListImplement/Implements/ComponentStorage.cs @@ -11,7 +11,7 @@ namespace SushiBarListImplement.Implements private readonly DataListSingleton _source; public ComponentStorage() { - _source = DataListSingleton.GetInsance(); + _source = DataListSingleton.GetInstance(); } public List GetFullList() { diff --git a/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs b/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs index 6635a4d..2aeb437 100644 --- a/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs +++ b/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs @@ -11,7 +11,7 @@ namespace SushiBarListImplement.Implements private readonly DataListSingleton _source; public OrderStorage() { - _source = DataListSingleton.GetInsance(); + _source = DataListSingleton.GetInstance(); } public List GetFullList() { diff --git a/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs b/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs index 7ed32ac..4e2454f 100644 --- a/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs +++ b/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs @@ -11,7 +11,7 @@ namespace SushiBarListImplement.Implements private readonly DataListSingleton _source; public SushiStorage() { - _source = DataListSingleton.GetInsance(); + _source = DataListSingleton.GetInstance(); } public List GetFullList() { -- 2.25.1 From e1abf80e6288d3710441301c8ecd8f0e27e9c1ac Mon Sep 17 00:00:00 2001 From: bekodeg Date: Wed, 14 Feb 2024 11:18:54 +0400 Subject: [PATCH 15/22] =?UTF-8?q?=D1=84=D0=B8=D0=B3=20=D0=B7=D0=BD=D0=B0?= =?UTF-8?q?=D0=B5=D1=82,=20=D1=87=D1=82=D0=BE=20=D1=8F=20=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D1=8E=20=D0=BD=D0=B5=20=D1=82=D0=B0=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/Forms/FormComponentsLogic.cs | 1 - SushiBar/SushiBar/Forms/FormMain.Designer.cs | 3 --- SushiBar/SushiBar/Forms/FormMainLogic.cs | 1 - SushiBar/SushiBar/Forms/FormSushiLogic.cs | 1 - SushiBar/SushiBar/Forms/FormSushisLogic.cs | 7 ------- SushiBar/SushiBar/Program.cs | 12 +++++------- SushiBar/SushiBar/nlog.config | 10 ++++------ 7 files changed, 9 insertions(+), 26 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormComponentsLogic.cs b/SushiBar/SushiBar/Forms/FormComponentsLogic.cs index 73c5f5b..7943174 100644 --- a/SushiBar/SushiBar/Forms/FormComponentsLogic.cs +++ b/SushiBar/SushiBar/Forms/FormComponentsLogic.cs @@ -1,7 +1,6 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using Microsoft.Extensions.Logging; -using SushiView; namespace SushiBar.Forms { diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index 1de243a..2a6b24a 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -159,14 +159,11 @@ private DataGridView dataGridView; private MenuStrip menuStrip1; - private ToolStripMenuItem SushiToolStripMenuItem; private Button buttonCreateOrder; private Button buttonTakeOrderInWork; private Button buttonOrderReady; private Button buttonIssuedOrder; private Button buttonRef; - private ToolStripMenuItem сушиToolStripMenuItem; - private ToolStripMenuItem компонентыToolStripMenuItem; private ToolStripMenuItem ToolStripMenuItem; private ToolStripMenuItem sushiToolStripMenuItem; private ToolStripMenuItem componentsToolStripMenuItem; diff --git a/SushiBar/SushiBar/Forms/FormMainLogic.cs b/SushiBar/SushiBar/Forms/FormMainLogic.cs index bc3e58a..a617c62 100644 --- a/SushiBar/SushiBar/Forms/FormMainLogic.cs +++ b/SushiBar/SushiBar/Forms/FormMainLogic.cs @@ -2,7 +2,6 @@ using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; -using SushiView; using System.Windows.Forms; namespace SushiBar.Forms diff --git a/SushiBar/SushiBar/Forms/FormSushiLogic.cs b/SushiBar/SushiBar/Forms/FormSushiLogic.cs index a7d0cf2..a87d886 100644 --- a/SushiBar/SushiBar/Forms/FormSushiLogic.cs +++ b/SushiBar/SushiBar/Forms/FormSushiLogic.cs @@ -3,7 +3,6 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModels; using SushiBarDataModels.Models; -using SushiView; namespace SushiBar.Forms { diff --git a/SushiBar/SushiBar/Forms/FormSushisLogic.cs b/SushiBar/SushiBar/Forms/FormSushisLogic.cs index 1b789c3..7e0904e 100644 --- a/SushiBar/SushiBar/Forms/FormSushisLogic.cs +++ b/SushiBar/SushiBar/Forms/FormSushisLogic.cs @@ -1,13 +1,6 @@ using Microsoft.Extensions.Logging; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; -using SushiView; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; namespace SushiBar.Forms { diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index 74ce596..0627eda 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -1,20 +1,20 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; +using SushiBar.Forms; using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.StoragesContracts; using SushiBarListImplement.Implements; -using SushiBar.Forms; -namespace SushiView +namespace SushiBar { internal static class Program { private static ServiceProvider? _serviceProvider; public static ServiceProvider? ServiceProvider => _serviceProvider; /// - /// The main entry point for the application. + /// The main entry point for the application. /// [STAThread] static void Main() @@ -25,9 +25,6 @@ namespace SushiView var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); - - ILogger logger = _serviceProvider.GetService(); - Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) @@ -51,6 +48,7 @@ namespace SushiView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } } -} \ No newline at end of file +} diff --git a/SushiBar/SushiBar/nlog.config b/SushiBar/SushiBar/nlog.config index af70d20..aad59db 100644 --- a/SushiBar/SushiBar/nlog.config +++ b/SushiBar/SushiBar/nlog.config @@ -1,13 +1,11 @@ - + - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + autoReload="true" internalLogLevel="Info"> - + - -- 2.25.1 From 31655eb3246b8ea5e78668e15575f6e405944197 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Thu, 22 Feb 2024 10:56:17 +0400 Subject: [PATCH 16/22] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B1=D0=B0=D0=B3=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BB=D0=BE=D0=B3=D0=B5=D1=80=D0=BE=D0=BC,=20=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D0=B0=D1=8E=D1=89=D0=B8=D1=85=20=D1=81?= =?UTF-8?q?=D0=B8=D0=B3=D0=BD=D0=B0=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SushiBar/Forms/FormComponent.Designer.cs | 1 + SushiBar/SushiBar/Forms/FormComponent.resx | 270 +++++++++--------- SushiBar/SushiBar/Forms/FormComponent.ru.resx | 12 - .../SushiBar/Forms/FormComponents.Designer.cs | 1 + .../Forms/FormCreateOrder.Designer.cs | 1 + .../SushiBar/Forms/FormCreateOrderLogic.cs | 6 - SushiBar/SushiBar/Forms/FormMain.Designer.cs | 5 +- SushiBar/SushiBar/Forms/FormSushi.Designer.cs | 16 +- SushiBar/SushiBar/Forms/FormSushi.resx | 3 + .../SushiBar/Forms/FormSushiComponentLogic.cs | 5 - SushiBar/SushiBar/Forms/FormSushiLogic.cs | 4 +- .../SushiBar/Forms/FormSushis.Designer.cs | 16 +- SushiBar/SushiBar/Program.cs | 1 + .../BusinessLogics/OrderLogic.cs | 2 +- .../BusinessLogics/SushiLogic.cs | 2 +- 15 files changed, 173 insertions(+), 172 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormComponent.Designer.cs b/SushiBar/SushiBar/Forms/FormComponent.Designer.cs index dcc8389..d1047dd 100644 --- a/SushiBar/SushiBar/Forms/FormComponent.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormComponent.Designer.cs @@ -82,6 +82,7 @@ Controls.Add(textBoxName); Controls.Add(label1); Name = "FormComponent"; + Load += this.FormComponent_Load; ResumeLayout(false); PerformLayout(); } diff --git a/SushiBar/SushiBar/Forms/FormComponent.resx b/SushiBar/SushiBar/Forms/FormComponent.resx index ac033b7..e8bc8e2 100644 --- a/SushiBar/SushiBar/Forms/FormComponent.resx +++ b/SushiBar/SushiBar/Forms/FormComponent.resx @@ -117,163 +117,58 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - FormComponent - - - $this - - - $this - - - 4 - - - buttonCancel - - - 800, 450 + + 68, 6 - - - 3 - - - $this - - - System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 1 - - - textBoxCost - - - $this - - - $this - - - 8, 20 - - - 4 - - - System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - button1 - - - System.Windows.Forms.Form, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 0 - - - textBox1 - - - System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 95, 85 - - - 1 - - + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 12, 42 + + 0 - - 3 + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - $this + + + 1 - + $this 0 - - System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 68, 6 - - - 0 - - - 222, 85 - - - label1 - - - 4 - - - System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 5 - - - 1 - buttonSave - - 222, 85 - - - FormComponent - 12, 9 - - 95, 85 + + 4 - - label2 + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 + + $this - - 5 + + FormComponent - + 1 - - System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 800, 450 - + 2 - - 5 - - - textBoxName + + button2 $this @@ -281,8 +176,14 @@ System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 95, 85 + + + $this + + + 3 95, 39 @@ -290,11 +191,110 @@ 95, 6 - + + $this + + + 95, 85 + + + FormComponent + + + 0 + + + 222, 85 + + + System.Windows.Forms.Form, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 5 + + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + $this + + + 5 + + + 1 + + + $this + + + label1 + + + 1 + + + System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + label2 + + + 8, 20 + + + textBox1 + + 2 - - button2 + + 5 + + + $this + + + button1 + + + buttonCancel + + + textBoxName + + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 222, 85 + + + textBoxCost + + + 3 + + + 4 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 + + + 4 + + + System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 12, 42 ru diff --git a/SushiBar/SushiBar/Forms/FormComponent.ru.resx b/SushiBar/SushiBar/Forms/FormComponent.ru.resx index 81e7eef..14672e4 100644 --- a/SushiBar/SushiBar/Forms/FormComponent.ru.resx +++ b/SushiBar/SushiBar/Forms/FormComponent.ru.resx @@ -147,30 +147,18 @@ Цена - - 95, 85 - 121, 29 - - 4 - Сохранить NoControl - - 222, 85 - 119, 29 - - 5 - Отмена diff --git a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs index 4fc6149..b8388ed 100644 --- a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs @@ -99,6 +99,7 @@ Controls.Add(dataGridView); Name = "FormComponents"; Text = "Компоненты"; + Load += this.FormComponents_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); } diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs index becf85e..858efb1 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs @@ -123,6 +123,7 @@ Controls.Add(buttonSave); Name = "FormCreateOrder"; Text = "Заказ"; + Load += this.FormCreateOrder_Load; ResumeLayout(false); PerformLayout(); } diff --git a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs index e9c9c0b..d93c6a4 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs @@ -2,12 +2,6 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; namespace SushiBar.Forms { diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index 2a6b24a..6006e8e 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -72,14 +72,14 @@ // sushiToolStripMenuItem // sushiToolStripMenuItem.Name = "sushiToolStripMenuItem"; - sushiToolStripMenuItem.Size = new Size(224, 26); + sushiToolStripMenuItem.Size = new Size(182, 26); sushiToolStripMenuItem.Text = "Суши"; sushiToolStripMenuItem.Click += sushiToolStripMenuItem_Click; // // componentsToolStripMenuItem // componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; - componentsToolStripMenuItem.Size = new Size(224, 26); + componentsToolStripMenuItem.Size = new Size(182, 26); componentsToolStripMenuItem.Text = "Компоненты"; componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click; // @@ -148,6 +148,7 @@ MainMenuStrip = menuStrip1; Name = "FormMain"; Text = "Сушибар"; + Load += this.FormMain_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); diff --git a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs index 3d2a278..088ba1e 100644 --- a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs @@ -30,6 +30,7 @@ { buttonAdd = new Button(); dataGridView = new DataGridView(); + ID = new DataGridViewTextBoxColumn(); ComponentName = new DataGridViewTextBoxColumn(); ComponentCount = new DataGridViewTextBoxColumn(); groupBox1 = new GroupBox(); @@ -62,7 +63,7 @@ dataGridView.AllowUserToAddRows = false; dataGridView.AllowUserToDeleteRows = false; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Columns.AddRange(new DataGridViewColumn[] { ComponentName, ComponentCount }); + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, ComponentName, ComponentCount }); dataGridView.Dock = DockStyle.Left; dataGridView.Location = new Point(3, 24); dataGridView.Margin = new Padding(3, 4, 3, 4); @@ -73,18 +74,29 @@ dataGridView.Size = new Size(630, 267); dataGridView.TabIndex = 1; // + // ID + // + ID.HeaderText = ""; + ID.MinimumWidth = 6; + ID.Name = "ID"; + ID.ReadOnly = true; + ID.Visible = false; + ID.Width = 125; + // // ComponentName // ComponentName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ComponentName.HeaderText = "Компонент"; ComponentName.MinimumWidth = 6; ComponentName.Name = "ComponentName"; + ComponentName.ReadOnly = true; // // ComponentCount // ComponentCount.HeaderText = "Количество"; ComponentCount.MinimumWidth = 6; ComponentCount.Name = "ComponentCount"; + ComponentCount.ReadOnly = true; ComponentCount.Width = 125; // // groupBox1 @@ -208,6 +220,7 @@ Controls.Add(groupBox1); Name = "FormSushi"; Text = "Суши"; + Load += this.FormSushi_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); groupBox1.ResumeLayout(false); ResumeLayout(false); @@ -228,6 +241,7 @@ private Label label2; private TextBox textBoxPrice; private TextBox textBoxName; + private DataGridViewTextBoxColumn ID; private DataGridViewTextBoxColumn ComponentName; private DataGridViewTextBoxColumn ComponentCount; } diff --git a/SushiBar/SushiBar/Forms/FormSushi.resx b/SushiBar/SushiBar/Forms/FormSushi.resx index 29c43a9..b17d555 100644 --- a/SushiBar/SushiBar/Forms/FormSushi.resx +++ b/SushiBar/SushiBar/Forms/FormSushi.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + True diff --git a/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs b/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs index a776a59..bcbd12e 100644 --- a/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs +++ b/SushiBar/SushiBar/Forms/FormSushiComponentLogic.cs @@ -1,11 +1,6 @@ using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SushiBar.Forms { diff --git a/SushiBar/SushiBar/Forms/FormSushiLogic.cs b/SushiBar/SushiBar/Forms/FormSushiLogic.cs index a87d886..9df5936 100644 --- a/SushiBar/SushiBar/Forms/FormSushiLogic.cs +++ b/SushiBar/SushiBar/Forms/FormSushiLogic.cs @@ -54,9 +54,9 @@ namespace SushiBar.Forms if (_sushiComponents != null) { dataGridView.Rows.Clear(); - foreach (var pc in _sushiComponents) + foreach (var sc in _sushiComponents) { - dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 }); + dataGridView.Rows.Add(new object[] { sc.Key, sc.Value.Item1.ComponentName, sc.Value.Item2 }); } textBoxPrice.Text = CalcPrice().ToString(); } diff --git a/SushiBar/SushiBar/Forms/FormSushis.Designer.cs b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs index cb77827..ba06d1d 100644 --- a/SushiBar/SushiBar/Forms/FormSushis.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs @@ -38,18 +38,19 @@ // // dataGridView // + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Dock = DockStyle.Left; dataGridView.Location = new Point(0, 0); dataGridView.Name = "dataGridView"; - dataGridView.RowHeadersWidth = 51; + dataGridView.RowHeadersWidth = 70; dataGridView.RowTemplate.Height = 29; - dataGridView.Size = new Size(668, 450); + dataGridView.Size = new Size(762, 450); dataGridView.TabIndex = 1; // // buttonRef // - buttonRef.Location = new Point(674, 117); + buttonRef.Location = new Point(768, 117); buttonRef.Name = "buttonRef"; buttonRef.Size = new Size(114, 29); buttonRef.TabIndex = 8; @@ -59,7 +60,7 @@ // // buttonDel // - buttonDel.Location = new Point(674, 82); + buttonDel.Location = new Point(768, 82); buttonDel.Name = "buttonDel"; buttonDel.Size = new Size(114, 29); buttonDel.TabIndex = 7; @@ -69,7 +70,7 @@ // // buttonUpd // - buttonUpd.Location = new Point(674, 47); + buttonUpd.Location = new Point(768, 47); buttonUpd.Name = "buttonUpd"; buttonUpd.Size = new Size(114, 29); buttonUpd.TabIndex = 6; @@ -79,7 +80,7 @@ // // buttonAdd // - buttonAdd.Location = new Point(674, 12); + buttonAdd.Location = new Point(768, 12); buttonAdd.Name = "buttonAdd"; buttonAdd.Size = new Size(114, 29); buttonAdd.TabIndex = 5; @@ -91,7 +92,7 @@ // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(893, 450); Controls.Add(buttonRef); Controls.Add(buttonDel); Controls.Add(buttonUpd); @@ -99,6 +100,7 @@ Controls.Add(dataGridView); Name = "FormSushis"; Text = "Суши"; + Load += this.FormSushis_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); } diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index 0627eda..430a8f7 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -25,6 +25,7 @@ namespace SushiBar var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); + ILogger logger = _serviceProvider.GetService(); Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs index 22b6922..7b16179 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs @@ -12,7 +12,7 @@ namespace SushiBarBusinessLogic.BusinessLogics { private readonly ILogger _logger; private readonly IOrderStorage _orderStorage; - public OrderLogic(ILogger logger, IOrderStorage orderStorage) + public OrderLogic(ILogger logger, IOrderStorage orderStorage) { _logger = logger; _orderStorage = orderStorage; diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/SushiLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/SushiLogic.cs index 2cf5260..0a1fa92 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/SushiLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/SushiLogic.cs @@ -11,7 +11,7 @@ namespace SushiBarBusinessLogic.BusinessLogics { private readonly ILogger _logger; private readonly ISushiStorage _sushiStorage; - public SushiLogic(ILogger logger, ISushiStorage sushiStorage) + public SushiLogic(ILogger logger, ISushiStorage sushiStorage) { _logger = logger; _sushiStorage = sushiStorage; -- 2.25.1 From 6d93b025362e213fa256063d1268572893c130c0 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Sat, 24 Feb 2024 18:41:00 +0400 Subject: [PATCH 17/22] =?UTF-8?q?=D0=B2=D1=80=D0=BE=D0=B4=D0=B5=20=D0=B2?= =?UTF-8?q?=D1=81=D1=91=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forms/FormCreateOrder.Designer.cs | 4 +- SushiBar/SushiBar/Forms/FormCreateOrder.cs | 10 +++ .../SushiBar/Forms/FormCreateOrderLogic.cs | 16 ++-- SushiBar/SushiBar/Forms/FormMainLogic.cs | 6 +- SushiBar/SushiBar/Forms/FormSushisLogic.cs | 1 + .../BusinessLogics/OrderLogic.cs | 77 ++++++++++--------- .../Implements/OrderStorage.cs | 33 ++++++-- 7 files changed, 95 insertions(+), 52 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs index 858efb1..7ac7d1a 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs @@ -91,6 +91,7 @@ textBoxCount.Name = "textBoxCount"; textBoxCount.Size = new Size(272, 27); textBoxCount.TabIndex = 5; + textBoxCount.TextChanged += textBoxCount_TextChanged; // // textBoxSum // @@ -107,6 +108,7 @@ comboBoxSushi.Name = "comboBoxSushi"; comboBoxSushi.Size = new Size(272, 28); comboBoxSushi.TabIndex = 7; + comboBoxSushi.SelectedIndexChanged += comboBoxSushi_SelectedIndexChanged; // // FormCreateOrder // @@ -123,7 +125,7 @@ Controls.Add(buttonSave); Name = "FormCreateOrder"; Text = "Заказ"; - Load += this.FormCreateOrder_Load; + Load += FormCreateOrder_Load; ResumeLayout(false); PerformLayout(); } diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.cs index 901f376..216ce4f 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.cs @@ -21,5 +21,15 @@ namespace SushiBar.Forms { ButtonCancel_Click(sender, e); } + + private void textBoxCount_TextChanged(object sender, EventArgs e) + { + TextBoxCount_TextChanged(sender, e); + } + + private void comboBoxSushi_SelectedIndexChanged(object sender, EventArgs e) + { + ComboBoxSushi_SelectedIndexChanged(sender, e); + } } } diff --git a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs index d93c6a4..4801e2e 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrderLogic.cs @@ -1,7 +1,10 @@ using Microsoft.Extensions.Logging; +using Microsoft.VisualBasic.Logging; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System.Windows.Forms; namespace SushiBar.Forms { @@ -21,12 +24,15 @@ namespace SushiBar.Forms { try { - var list = _logicS.ReadList(null); - if (list != null) - { - comboBoxSushi.Items.AddRange(list.ToArray()); - } _logger.LogInformation("Загрузка суши для заказа"); + List? _list = _logicS.ReadList(null); + if (_list != null) + { + comboBoxSushi.DisplayMember = "SushiName"; + comboBoxSushi.ValueMember = "Id"; + comboBoxSushi.DataSource = _list; + comboBoxSushi.SelectedItem = null; + } } catch (Exception ex) { diff --git a/SushiBar/SushiBar/Forms/FormMainLogic.cs b/SushiBar/SushiBar/Forms/FormMainLogic.cs index a617c62..7aab080 100644 --- a/SushiBar/SushiBar/Forms/FormMainLogic.cs +++ b/SushiBar/SushiBar/Forms/FormMainLogic.cs @@ -2,6 +2,7 @@ using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; +using SushiBarDataModels.Enums; using System.Windows.Forms; namespace SushiBar.Forms @@ -40,8 +41,7 @@ namespace SushiBar.Forms MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void ComponentsToolStripMenuItem_Click(object sender, EventArgs - e) + private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); if (service is FormComponents form) @@ -74,7 +74,7 @@ namespace SushiBar.Forms _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); try { - var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id }); + var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id}); if (!operationResult) { throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); diff --git a/SushiBar/SushiBar/Forms/FormSushisLogic.cs b/SushiBar/SushiBar/Forms/FormSushisLogic.cs index 7e0904e..caefccd 100644 --- a/SushiBar/SushiBar/Forms/FormSushisLogic.cs +++ b/SushiBar/SushiBar/Forms/FormSushisLogic.cs @@ -27,6 +27,7 @@ namespace SushiBar.Forms { dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["SushiComponents"].Visible = false; dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка суши"); diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs index 7b16179..4d66099 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs @@ -49,57 +49,58 @@ namespace SushiBarBusinessLogic.BusinessLogics } public bool TakeOrderInWork(OrderBindingModel model) { - CheckModel(model); - if (model.Status != OrderStatus.Принят) - { - _logger.LogWarning("Wrong Order Status"); - _logger.LogWarning("Insert operation failed"); - return false; - } - model.Status = OrderStatus.Выполняется; - if (_orderStorage.Update(model) == null) - { - _logger.LogWarning("Insert operation failed"); - return false; - } - return true; + return ToNextStatus(model, OrderStatus.Выполняется); } public bool DeliveryOrder(OrderBindingModel model) { - CheckModel(model); - if (model.Status != OrderStatus.Выполняется) + return ToNextStatus(model, OrderStatus.Выдан); + } + + public bool FinishOrder(OrderBindingModel model) + { + return ToNextStatus(model, OrderStatus.Готов); + } + + public bool ToNextStatus(OrderBindingModel model, OrderStatus orderStatus) + { + CheckModel(model, false); + var element = _orderStorage.GetElement(new OrderSearchModel() { - _logger.LogWarning("Wrong Order Status"); - _logger.LogWarning("Insert operation failed"); + Id = model.Id + }); + if (element == null) + { + throw new ArgumentNullException(nameof(element)); + } + + model.SushiId = element.SushiId; + model.DateCreate = element.DateCreate; + model.DateImplement = element.DateImplement; + model.Status = element.Status; + model.Count = element.Count; + model.Sum = element.Sum; + + if (model.Status != orderStatus - 1) + { + _logger.LogWarning("Status update to " + orderStatus + " operation failed"); return false; } - model.Status = OrderStatus.Готов; + model.Status = orderStatus; + + if (model.Status == OrderStatus.Выдан) + { + model.DateImplement = DateTime.Now; + } + if (_orderStorage.Update(model) == null) { - _logger.LogWarning("Insert operation failed"); + model.Status--; + _logger.LogWarning("Changing status operation faled"); return false; } return true; } - public bool FinishOrder(OrderBindingModel model) - { - CheckModel(model); - if (model.Status != OrderStatus.Готов) - { - _logger.LogWarning("Wrong Order Status"); - _logger.LogWarning("Insert operation failed"); - return false; - } - model.Status = OrderStatus.Выдан; - if (_orderStorage.Update(model) == null) - { - _logger.LogWarning("Insert operation failed"); - return false; - } - return true; - } - private void CheckModel(OrderBindingModel model, bool withParams = true) { if (model == null) diff --git a/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs b/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs index 2aeb437..29483f7 100644 --- a/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs +++ b/SushiBar/SushiBarListImplement/Implements/OrderStorage.cs @@ -18,13 +18,24 @@ namespace SushiBarListImplement.Implements var result = new List(); foreach (var order in _source.Orders) { - result.Add(order.GetViewModel); + result.Add(AttachSushiName(order.GetViewModel)); } return result; } public List GetFilteredList(OrderSearchModel model) { var result = new List(); + if (model == null || !model.Id.HasValue) + { + return result; + } + foreach (var order in _source.Orders) + { + if (order.Id == model.Id) + { + result.Add(AttachSushiName(order.GetViewModel)); + } + } return result; } public OrderViewModel? GetElement(OrderSearchModel model) @@ -37,7 +48,7 @@ namespace SushiBarListImplement.Implements { if (model.Id.HasValue && order.Id == model.Id) { - return order.GetViewModel; + return AttachSushiName(order.GetViewModel); } } return null; @@ -58,7 +69,7 @@ namespace SushiBarListImplement.Implements return null; } _source.Orders.Add(newOrder); - return newOrder.GetViewModel; + return AttachSushiName(newOrder.GetViewModel); } public OrderViewModel? Update(OrderBindingModel model) { @@ -67,7 +78,7 @@ namespace SushiBarListImplement.Implements if (order.Id == model.Id) { order.Update(model); - return order.GetViewModel; + return AttachSushiName(order.GetViewModel); } } return null; @@ -80,10 +91,22 @@ namespace SushiBarListImplement.Implements { var element = _source.Orders[i]; _source.Orders.RemoveAt(i); - return element.GetViewModel; + return AttachSushiName(element.GetViewModel); } } return null; } + private OrderViewModel AttachSushiName(OrderViewModel model) + { + foreach (var sushi in _source.Sushis) + { + if (sushi.Id == model.SushiId) + { + model.SushiName = sushi.SushiName; + return model; + } + } + return model; + } } } -- 2.25.1 From bd87dba5874ce605f708a90f4b2dc656d2ade74f Mon Sep 17 00:00:00 2001 From: bekodeg Date: Tue, 27 Feb 2024 15:00:11 +0400 Subject: [PATCH 18/22] =?UTF-8?q?=D0=B8=D0=B7=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=82=20=D1=80=D1=83=D0=B4?= =?UTF-8?q?=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=B4=D0=B5=D0=B1?= =?UTF-8?q?=D0=B0=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index 430a8f7..0627eda 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -25,7 +25,6 @@ namespace SushiBar var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); - ILogger logger = _serviceProvider.GetService(); Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) -- 2.25.1 From b3ea0977f04c944d26496b5d564afd4bbba32345 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Wed, 28 Feb 2024 09:18:34 +0400 Subject: [PATCH 19/22] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B8=D0=B5=20=D0=BA=D0=BE=D1=80=D0=B5=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20=D1=84=D0=BE=D1=80=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/Forms/FormComponents.Designer.cs | 3 ++- SushiBar/SushiBar/Forms/FormMain.Designer.cs | 3 ++- SushiBar/SushiBar/Forms/FormMainLogic.cs | 1 - SushiBar/SushiBar/Forms/FormSushi.Designer.cs | 3 ++- SushiBar/SushiBar/Forms/FormSushis.Designer.cs | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs index b8388ed..6497064 100644 --- a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs @@ -44,6 +44,7 @@ dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.Size = new Size(668, 408); dataGridView.TabIndex = 0; // @@ -99,7 +100,7 @@ Controls.Add(dataGridView); Name = "FormComponents"; Text = "Компоненты"; - Load += this.FormComponents_Load; + Load += FormComponents_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); } diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index 6006e8e..5482404 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -49,6 +49,7 @@ dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.Size = new Size(980, 407); dataGridView.TabIndex = 0; // @@ -148,7 +149,7 @@ MainMenuStrip = menuStrip1; Name = "FormMain"; Text = "Сушибар"; - Load += this.FormMain_Load; + Load += FormMain_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); diff --git a/SushiBar/SushiBar/Forms/FormMainLogic.cs b/SushiBar/SushiBar/Forms/FormMainLogic.cs index 7aab080..7d96481 100644 --- a/SushiBar/SushiBar/Forms/FormMainLogic.cs +++ b/SushiBar/SushiBar/Forms/FormMainLogic.cs @@ -29,7 +29,6 @@ namespace SushiBar.Forms if (list != null) { dataGridView.DataSource = list; - dataGridView.Columns["Id"].Visible = false; dataGridView.Columns["SushiId"].Visible = false; dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } diff --git a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs index 088ba1e..ba6aac9 100644 --- a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs @@ -71,6 +71,7 @@ dataGridView.ReadOnly = true; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 25; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.Size = new Size(630, 267); dataGridView.TabIndex = 1; // @@ -220,7 +221,7 @@ Controls.Add(groupBox1); Name = "FormSushi"; Text = "Суши"; - Load += this.FormSushi_Load; + Load += FormSushi_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); groupBox1.ResumeLayout(false); ResumeLayout(false); diff --git a/SushiBar/SushiBar/Forms/FormSushis.Designer.cs b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs index ba06d1d..eb92582 100644 --- a/SushiBar/SushiBar/Forms/FormSushis.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs @@ -45,6 +45,7 @@ dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 70; dataGridView.RowTemplate.Height = 29; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.Size = new Size(762, 450); dataGridView.TabIndex = 1; // @@ -100,7 +101,7 @@ Controls.Add(dataGridView); Name = "FormSushis"; Text = "Суши"; - Load += this.FormSushis_Load; + Load += FormSushis_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); } -- 2.25.1 From 9e34022abf5ccef6b499d8a83ebe8f78b2519af7 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Sun, 5 May 2024 13:54:40 +0400 Subject: [PATCH 20/22] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D1=84=D0=BE=D1=80=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SushiBar/Forms/FormComponent.Designer.cs | 7 +- SushiBar/SushiBar/Forms/FormComponent.resx | 268 +++++++++--------- .../SushiBar/Forms/FormComponents.Designer.cs | 22 +- .../Forms/FormCreateOrder.Designer.cs | 6 +- SushiBar/SushiBar/Forms/FormMain.Designer.cs | 5 +- SushiBar/SushiBar/Forms/FormSushi.Designer.cs | 8 +- SushiBar/SushiBar/Forms/FormSushi.resx | 9 + .../Forms/FormSushiComponent.Designer.cs | 4 + .../SushiBar/Forms/FormSushis.Designer.cs | 2 +- 9 files changed, 177 insertions(+), 154 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormComponent.Designer.cs b/SushiBar/SushiBar/Forms/FormComponent.Designer.cs index d1047dd..ad848b9 100644 --- a/SushiBar/SushiBar/Forms/FormComponent.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormComponent.Designer.cs @@ -74,15 +74,18 @@ // FormComponent // resources.ApplyResources(this, "$this"); - AutoScaleMode = AutoScaleMode.Font; + AutoScaleMode = AutoScaleMode.None; Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(textBoxCost); Controls.Add(label2); Controls.Add(textBoxName); Controls.Add(label1); + MaximizeBox = false; Name = "FormComponent"; - Load += this.FormComponent_Load; + ShowInTaskbar = false; + TopMost = true; + Load += FormComponent_Load; ResumeLayout(false); PerformLayout(); } diff --git a/SushiBar/SushiBar/Forms/FormComponent.resx b/SushiBar/SushiBar/Forms/FormComponent.resx index e8bc8e2..4cf9735 100644 --- a/SushiBar/SushiBar/Forms/FormComponent.resx +++ b/SushiBar/SushiBar/Forms/FormComponent.resx @@ -117,184 +117,184 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 68, 6 - - - System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 0 - - - System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - 1 - - - $this - - - 0 - buttonSave - - 12, 9 + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 4 - - - System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - FormComponent - - - 1 - - - 800, 450 - - - 2 - - - button2 - - - $this - - - System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 95, 85 - - - $this - - - 3 - - - 95, 39 - - - 95, 6 - - - $this - - - 95, 85 - - - FormComponent - - - 0 - - - 222, 85 - - - System.Windows.Forms.Form, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 5 - - + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this + + System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + $this - - 5 + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 1 - - + $this - - label1 + + 0 - - 1 + + + 222, 85 - - System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 95, 39 - - label2 + + buttonCancel 8, 20 - - textBox1 + + label1 + + System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + FormComponent + + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 2 + + System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 800, 450 + + + 5 + + + 2 + + + 222, 85 + + + $this + + + 0 + + + 68, 6 + + + FormComponent + + + 4 + + + 1 + + + 5 + + + $this + + + 12, 9 + + + 3 + + + $this + 5 + + textBox1 + + + 1 + + + 1 + + + 95, 85 + $this + + textBoxCost + + + 3 + + + 1 + + + 4 + + + $this + button1 - - buttonCancel + + button2 + + + 0 + + + 95, 85 + + + $this + + + System.Windows.Forms.Form, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 12, 42 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 textBoxName - - System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 222, 85 - - - textBoxCost - - - 3 - - - 4 - - - System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 0 + + label2 4 - - System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 95, 6 - - 12, 42 + + 0 ru diff --git a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs index 6497064..b68809c 100644 --- a/SushiBar/SushiBar/Forms/FormComponents.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormComponents.Designer.cs @@ -38,21 +38,21 @@ // // dataGridView // + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Dock = DockStyle.Left; dataGridView.Location = new Point(0, 0); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(668, 408); + dataGridView.Size = new Size(694, 408); dataGridView.TabIndex = 0; // // buttonAdd // - buttonAdd.Location = new Point(674, 12); + buttonAdd.Location = new Point(700, 12); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(114, 29); + buttonAdd.Size = new Size(180, 29); buttonAdd.TabIndex = 1; buttonAdd.Text = "Добавить"; buttonAdd.UseVisualStyleBackColor = true; @@ -60,9 +60,9 @@ // // buttonUpd // - buttonUpd.Location = new Point(674, 47); + buttonUpd.Location = new Point(700, 47); buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(114, 29); + buttonUpd.Size = new Size(180, 29); buttonUpd.TabIndex = 2; buttonUpd.Text = "Изменить"; buttonUpd.UseVisualStyleBackColor = true; @@ -70,9 +70,9 @@ // // buttonDel // - buttonDel.Location = new Point(674, 82); + buttonDel.Location = new Point(700, 82); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(114, 29); + buttonDel.Size = new Size(180, 29); buttonDel.TabIndex = 3; buttonDel.Text = "Удалить"; buttonDel.UseVisualStyleBackColor = true; @@ -80,9 +80,9 @@ // // buttonRef // - buttonRef.Location = new Point(674, 117); + buttonRef.Location = new Point(700, 117); buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(114, 29); + buttonRef.Size = new Size(180, 29); buttonRef.TabIndex = 4; buttonRef.Text = "Обновить"; buttonRef.UseVisualStyleBackColor = true; @@ -92,7 +92,7 @@ // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 408); + ClientSize = new Size(892, 408); Controls.Add(buttonRef); Controls.Add(buttonDel); Controls.Add(buttonUpd); diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs index 7ac7d1a..22d1beb 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs @@ -112,8 +112,7 @@ // // FormCreateOrder // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; + AutoScaleMode = AutoScaleMode.None; ClientSize = new Size(403, 152); Controls.Add(comboBoxSushi); Controls.Add(textBoxSum); @@ -123,7 +122,10 @@ Controls.Add(label1); Controls.Add(buttonCancel); Controls.Add(buttonSave); + MaximizeBox = false; + MinimizeBox = false; Name = "FormCreateOrder"; + ShowInTaskbar = false; Text = "Заказ"; Load += FormCreateOrder_Load; ResumeLayout(false); diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index 5482404..e2eb16f 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -45,12 +45,13 @@ // dataGridView // dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(12, 31); + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(0, 28); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(980, 407); + dataGridView.Size = new Size(980, 422); dataGridView.TabIndex = 0; // // menuStrip1 diff --git a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs index ba6aac9..83ce316 100644 --- a/SushiBar/SushiBar/Forms/FormSushi.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushi.Designer.cs @@ -62,9 +62,9 @@ // dataGridView.AllowUserToAddRows = false; dataGridView.AllowUserToDeleteRows = false; + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, ComponentName, ComponentCount }); - dataGridView.Dock = DockStyle.Left; dataGridView.Location = new Point(3, 24); dataGridView.Margin = new Padding(3, 4, 3, 4); dataGridView.Name = "dataGridView"; @@ -72,7 +72,7 @@ dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 25; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(630, 267); + dataGridView.Size = new Size(630, 263); dataGridView.TabIndex = 1; // // ID @@ -219,8 +219,12 @@ Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(groupBox1); + MaximizeBox = false; + MinimizeBox = false; Name = "FormSushi"; + ShowInTaskbar = false; Text = "Суши"; + TopMost = true; Load += FormSushi_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); groupBox1.ResumeLayout(false); diff --git a/SushiBar/SushiBar/Forms/FormSushi.resx b/SushiBar/SushiBar/Forms/FormSushi.resx index b17d555..610eb88 100644 --- a/SushiBar/SushiBar/Forms/FormSushi.resx +++ b/SushiBar/SushiBar/Forms/FormSushi.resx @@ -126,4 +126,13 @@ True + + True + + + True + + + True + \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs b/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs index 147cb44..0563bb3 100644 --- a/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs @@ -100,8 +100,12 @@ Controls.Add(comboBoxComponent); Controls.Add(label2); Controls.Add(label1); + MaximizeBox = false; + MinimizeBox = false; Name = "FormSushiComponent"; + ShowInTaskbar = false; Text = "Компонент Изделия"; + TopMost = true; ResumeLayout(false); PerformLayout(); } diff --git a/SushiBar/SushiBar/Forms/FormSushis.Designer.cs b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs index eb92582..b340685 100644 --- a/SushiBar/SushiBar/Forms/FormSushis.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormSushis.Designer.cs @@ -38,9 +38,9 @@ // // dataGridView // + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Dock = DockStyle.Left; dataGridView.Location = new Point(0, 0); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 70; -- 2.25.1 From 95c13d3b6ee0cfc36df077299e29626b4efad435 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Sun, 5 May 2024 18:58:33 +0400 Subject: [PATCH 21/22] aaaaa --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3d05129..26212b2 100644 --- a/.gitignore +++ b/.gitignore @@ -397,5 +397,3 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml - -*.csproj -- 2.25.1 From da472583a81ac4576bfa7932973c4440f70265b9 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Sun, 5 May 2024 19:15:36 +0400 Subject: [PATCH 22/22] =?UTF-8?q?=D0=B1=D0=B5=D0=B7=D1=83=D0=BC=D0=B8?= =?UTF-8?q?=D0=B5..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/SushiBar.csproj | 40 +++++++++++++++++++ .../SushiBarBusinessLogic.csproj | 20 ++++++++++ .../SushiBarContracts.csproj | 13 ++++++ .../SushiBarDataModels.csproj | 9 +++++ .../SushiBarListImplement.csproj | 14 +++++++ 5 files changed, 96 insertions(+) create mode 100644 SushiBar/SushiBar/SushiBar.csproj create mode 100644 SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj create mode 100644 SushiBar/SushiBarContracts/SushiBarContracts.csproj create mode 100644 SushiBar/SushiBarDataModels/SushiBarDataModels.csproj create mode 100644 SushiBar/SushiBarListImplement/SushiBarListImplement.csproj diff --git a/SushiBar/SushiBar/SushiBar.csproj b/SushiBar/SushiBar/SushiBar.csproj new file mode 100644 index 0000000..dfe9d68 --- /dev/null +++ b/SushiBar/SushiBar/SushiBar.csproj @@ -0,0 +1,40 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + PreserveNewest + + + Always + + + + \ No newline at end of file diff --git a/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj b/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj new file mode 100644 index 0000000..e944f4d --- /dev/null +++ b/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj @@ -0,0 +1,20 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + 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/SushiBarDataModels/SushiBarDataModels.csproj b/SushiBar/SushiBarDataModels/SushiBarDataModels.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/SushiBar/SushiBarDataModels/SushiBarDataModels.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj b/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj new file mode 100644 index 0000000..00e2c96 --- /dev/null +++ b/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj @@ -0,0 +1,14 @@ + + + + net6.0 + enable + enable + + + + + + + + -- 2.25.1