From f7498bf306ff91ef72d25f6f569450ccb7159bb3 Mon Sep 17 00:00:00 2001 From: leoevgeniy <98206383+leoevgeniy@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:15:31 +0400 Subject: [PATCH 1/3] Lab1 --- CarpentryWorkshop/CarpentryWorkshop.sln | 26 +- .../BusinessLogics/ComponentLogic.cs | 108 +++++++++ .../BusinessLogics/OrderLogic.cs | 141 +++++++++++ .../BusinessLogics/WoodLogic.cs | 108 +++++++++ .../CarpentryWorkshopBusinessLogic.csproj | 18 ++ .../CarpentryWorkshopBusinessLogic/Class1.cs | 7 + .../BindingModels/ComponentBindingModel.cs | 17 ++ .../BindingModels/OrderBindingModel .cs | 22 ++ .../BindingModels/WoodBindingModel.cs | 22 ++ .../IComponentLogic.cs | 21 ++ .../BusinessLogicsContracts/IOrderLogic.cs | 21 ++ .../BusinessLogicsContracts/IWoodLogic.cs | 20 ++ ...CarpentryWorkshopContracts - Backup.csproj | 13 + .../CarpentryWorkshopContracts.csproj | 13 + .../CarpentryWorkshopContracts/Class1.cs | 7 + .../SearchModels/ComponentSearchModel.cs | 15 ++ .../SearchModels/OrderSearchModel.cs | 13 + .../SearchModels/WoodSearchModel.cs | 15 ++ .../StoragesContracts/IComponentStorage.cs | 21 ++ .../StoragesContracts/IOrderStorage.cs | 21 ++ .../StoragesContracts/IWoodStorage.cs | 21 ++ .../ViewModels/ComponentViewModel.cs | 20 ++ .../ViewModels/OrderViewModel.cs | 30 +++ .../ViewModels/WoodViewModel.cs | 24 ++ .../CarpentryWorkshopDataModels.csproj | 9 + .../CarpentryWorkshopDataModels/Class1.cs | 7 + .../Enums/OrderStatus.cs | 16 ++ .../CarpentryWorkshopDataModels/IId.cs | 13 + .../Models/IComponentModel.cs | 14 ++ .../Models/IOrderModel.cs | 24 ++ .../Models/IWoodModel.cs | 15 ++ ...entryWorkshopListImplement - Backup.csproj | 14 ++ .../CarpentryWorkshopListImplement.csproj | 14 ++ .../CarpentryWorkshopListImplement/Class1.cs | 7 + .../DataListSingleton.cs | 26 ++ .../Implements/ComponentStorage.cs | 106 ++++++++ .../Implements/OrderStorage.cs | 106 ++++++++ .../Implements/WoodStorage.cs | 106 ++++++++ .../Models/Component.cs | 46 ++++ .../Models/Order.cs | 68 ++++++ .../Models/Wood.cs | 50 ++++ .../CarpentryWorkshopView.csproj | 16 +- .../FormComponent.Designer.cs | 119 +++++++++ .../CarpentryWorkshopView/FormComponent.cs | 77 ++++++ .../CarpentryWorkshopView/FormComponent.resx | 60 +++++ .../FormComponents.Designer.cs | 114 +++++++++ .../CarpentryWorkshopView/FormComponents.cs | 107 ++++++++ .../CarpentryWorkshopView/FormComponents.resx | 120 +++++++++ .../FormCreateOrder.Designer.cs | 144 +++++++++++ .../CarpentryWorkshopView/FormCreateOrder.cs | 112 +++++++++ .../FormCreateOrder.resx | 120 +++++++++ .../FormMain.Designer.cs | 176 ++++++++++++++ .../CarpentryWorkshopView/FormMain.cs | 148 ++++++++++++ .../CarpentryWorkshopView/FormMain.resx | 63 +++++ .../FormWood.Designer.cs | 228 ++++++++++++++++++ .../CarpentryWorkshopView/FormWood.cs | 201 +++++++++++++++ .../CarpentryWorkshopView/FormWood.resx | 120 +++++++++ .../FormWoodComponent.Designer.cs | 120 +++++++++ .../FormWoodComponent.cs | 72 ++++++ .../FormWoodComponent.resx | 120 +++++++++ .../FormWoods.Designer.cs | 115 +++++++++ .../CarpentryWorkshopView/FormWoods.cs | 109 +++++++++ .../CarpentryWorkshopView/FormWoods.resx | 60 +++++ .../CarpentryWorkshopView/Program.cs | 38 ++- 64 files changed, 3940 insertions(+), 4 deletions(-) create mode 100644 CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ComponentLogic.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/WoodLogic.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopBusinessLogic/CarpentryWorkshopBusinessLogic.csproj create mode 100644 CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/ComponentBindingModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/OrderBindingModel .cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/WoodBindingModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IComponentLogic.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IOrderLogic.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IWoodLogic.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts - Backup.csproj create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts.csproj create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/ComponentSearchModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/OrderSearchModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/WoodSearchModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IComponentStorage.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IOrderStorage.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IWoodStorage.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ComponentViewModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/OrderViewModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/WoodViewModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/CarpentryWorkshopDataModels.csproj create mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/Enums/OrderStatus.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/IId.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IComponentModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IOrderModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IWoodModel.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement - Backup.csproj create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement.csproj create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/DataListSingleton.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/ComponentStorage.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/OrderStorage.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/WoodStorage.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Component.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Order.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Wood.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormComponent.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormComponents.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormComponents.resx create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.resx create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormMain.resx create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWood.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWood.resx create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.resx create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWoods.cs create mode 100644 CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx diff --git a/CarpentryWorkshop/CarpentryWorkshop.sln b/CarpentryWorkshop/CarpentryWorkshop.sln index c80e98f..93931cb 100644 --- a/CarpentryWorkshop/CarpentryWorkshop.sln +++ b/CarpentryWorkshop/CarpentryWorkshop.sln @@ -3,7 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34525.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarpentryWorkshopView", "CarpentryWorkshopView\CarpentryWorkshopView.csproj", "{05E7ED43-7FFA-4A83-A657-CA65534C13FC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarpentryWorkshopView", "CarpentryWorkshopView\CarpentryWorkshopView.csproj", "{05E7ED43-7FFA-4A83-A657-CA65534C13FC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarpentryWorkshopDataModels", "CarpentryWorkshopDataModels\CarpentryWorkshopDataModels.csproj", "{51C3F3EB-334C-4332-9C80-6C90D30CD784}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarpentryWorkshopContracts", "CarpentryWorkshopContracts\CarpentryWorkshopContracts.csproj", "{9BBF135A-E35B-41D2-94AE-F05B314EF524}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarpentryWorkshopBusinessLogic", "CarpentryWorkshopBusinessLogic\CarpentryWorkshopBusinessLogic.csproj", "{7F85F9BE-C8D3-4F1A-827B-455B7B2A596A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarpentryWorkshopListImplement", "CarpentryWorkshopListImplement\CarpentryWorkshopListImplement.csproj", "{7E6ED317-4FB2-426A-BF69-C03148A5D00D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +23,22 @@ Global {05E7ED43-7FFA-4A83-A657-CA65534C13FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {05E7ED43-7FFA-4A83-A657-CA65534C13FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {05E7ED43-7FFA-4A83-A657-CA65534C13FC}.Release|Any CPU.Build.0 = Release|Any CPU + {51C3F3EB-334C-4332-9C80-6C90D30CD784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51C3F3EB-334C-4332-9C80-6C90D30CD784}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51C3F3EB-334C-4332-9C80-6C90D30CD784}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51C3F3EB-334C-4332-9C80-6C90D30CD784}.Release|Any CPU.Build.0 = Release|Any CPU + {9BBF135A-E35B-41D2-94AE-F05B314EF524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BBF135A-E35B-41D2-94AE-F05B314EF524}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BBF135A-E35B-41D2-94AE-F05B314EF524}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BBF135A-E35B-41D2-94AE-F05B314EF524}.Release|Any CPU.Build.0 = Release|Any CPU + {7F85F9BE-C8D3-4F1A-827B-455B7B2A596A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F85F9BE-C8D3-4F1A-827B-455B7B2A596A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F85F9BE-C8D3-4F1A-827B-455B7B2A596A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F85F9BE-C8D3-4F1A-827B-455B7B2A596A}.Release|Any CPU.Build.0 = Release|Any CPU + {7E6ED317-4FB2-426A-BF69-C03148A5D00D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E6ED317-4FB2-426A-BF69-C03148A5D00D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E6ED317-4FB2-426A-BF69-C03148A5D00D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E6ED317-4FB2-426A-BF69-C03148A5D00D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ComponentLogic.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ComponentLogic.cs new file mode 100644 index 0000000..64de97c --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ComponentLogic.cs @@ -0,0 +1,108 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.StoragesContracts; +using CarpentryWorkshopContracts.ViewModels; +using Microsoft.Extensions.Logging; + + +namespace CarpentryWorkshopBusinessLogic.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/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs new file mode 100644 index 0000000..07795aa --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs @@ -0,0 +1,141 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.StoragesContracts; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopDataModels.Enums; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopBusinessLogic.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) + { + _orderStorage.Insert(new OrderBindingModel + { + WoodId = model.WoodId, + WoodName = model.WoodName, + Count = model.Count, + Sum = model.Sum, + Status = OrderStatus.Принят, + DateCreate = DateTime.Now + }); ; + return true; + } + public bool TakeOrderInWork(OrderBindingModel model) + { + var order = _orderStorage.GetElement(new OrderSearchModel + { + Id = model.Id + }); + if (order == null) + { + throw new Exception("Элемент не найден"); + } + if (order.Status.ToString() != "Принят") + { + throw new Exception("Заказ не в статусе \"Принят\""); + } + _orderStorage.Update(new OrderBindingModel + { + Id = order.Id, + WoodId = order.WoodId, + WoodName = order.WoodName, + Count = order.Count, + Sum = order.Sum, + DateCreate = order.DateCreate, + + Status = OrderStatus.Выполняется + }); + return true; + } + public bool FinishOrder(OrderBindingModel model) + { + var order = _orderStorage.GetElement(new OrderSearchModel + { + Id = model.Id + }); + if (order == null) + { + throw new Exception("Не найден заказ"); + } + if (order.Status.ToString() != "Выполняется") + { + throw new Exception("Заказ не в статусе \"Выполняется\""); + } + _orderStorage.Update(new OrderBindingModel + { + Id = order.Id, + WoodId = order.WoodId, + WoodName = order.WoodName, + Count = order.Count, + Sum = order.Sum, + DateCreate = order.DateCreate, + DateImplement = DateTime.Now, + Status = OrderStatus.Готов + }); + return true; + } + public bool DeliveryOrder(OrderBindingModel model) + { + var order = _orderStorage.GetElement(new OrderSearchModel + { + Id = model.Id + }); + if (order == null) + { + throw new Exception("Не найден заказ"); + } + + if (order.Status.ToString() != "Готов") + { + throw new Exception("Заказ не в статусе \"Готов\""); + } + + _orderStorage.Update(new OrderBindingModel + { + Id = order.Id, + WoodId = order.WoodId, + WoodName = order.WoodName, + Count = order.Count, + Sum = order.Sum, + DateCreate = order.DateCreate, + DateImplement = order.DateImplement, + Status = OrderStatus.Выдан + }); + return true; + + } + + + + + + + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/WoodLogic.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/WoodLogic.cs new file mode 100644 index 0000000..dc5b8bd --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/WoodLogic.cs @@ -0,0 +1,108 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.StoragesContracts; +using CarpentryWorkshopContracts.ViewModels; +using Microsoft.Extensions.Logging; + + +namespace CarpentryWorkshopBusinessLogic.BusinessLogics +{ + public class WoodLogic : IWoodLogic + { + private readonly ILogger _logger; + private readonly IWoodStorage _woodStorage; + public WoodLogic(ILogger logger, IWoodStorage woodStorage) + { + _logger = logger; + _woodStorage = woodStorage; + } + public List? ReadList(WoodSearchModel? model) + { + _logger.LogInformation("ReadList. WoodName:{WoodName}. Id:{ Id}", model?.WoodName, model?.Id); + var list = model == null ? _woodStorage.GetFullList() : _woodStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + public WoodViewModel? ReadElement(WoodSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. WoodName:{WoodName}. Id:{ Id}", model.WoodName, model.Id); + var element = _woodStorage.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(WoodBindingModel model) + { + CheckModel(model); + if (_woodStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + public bool Update(WoodBindingModel model) + { + CheckModel(model); + if (_woodStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + public bool Delete(WoodBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_woodStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + private void CheckModel(WoodBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.WoodName)) + { + throw new ArgumentNullException("Нет названия компонента", nameof(model.WoodName)); + } + if (model.Price <= 0) + { + throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Price)); + } + _logger.LogInformation("Wood. WoodName:{WoodName}. Cost:{ Cost}. Id: { Id}", model.WoodName, model.Price, model.Id); + var element = _woodStorage.GetElement(new WoodSearchModel + { + WoodName = model.WoodName + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Компонент с таким названием уже есть"); + } + } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/CarpentryWorkshopBusinessLogic.csproj b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/CarpentryWorkshopBusinessLogic.csproj new file mode 100644 index 0000000..c14d81b --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/CarpentryWorkshopBusinessLogic.csproj @@ -0,0 +1,18 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs new file mode 100644 index 0000000..41846ac --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs @@ -0,0 +1,7 @@ +namespace CarpentryWorkshopBusinessLogic +{ + public class Class1 + { + + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/ComponentBindingModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..21104df --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CarpentryWorkshopDataModels.Models; + +namespace CarpentryWorkshopContracts.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/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/OrderBindingModel .cs b/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/OrderBindingModel .cs new file mode 100644 index 0000000..c44a424 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/OrderBindingModel .cs @@ -0,0 +1,22 @@ +using CarpentryWorkshopDataModels.Enums; +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.BindingModels +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + public int WoodId { get; set; } + public string WoodName { get; set; } = string.Empty; + 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/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/WoodBindingModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/WoodBindingModel.cs new file mode 100644 index 0000000..f66f667 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/BindingModels/WoodBindingModel.cs @@ -0,0 +1,22 @@ +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.BindingModels +{ + public class WoodBindingModel : IWoodModel + { + public int Id { get; set; } + public string WoodName { get; set; } = string.Empty; + public double Price { get; set; } + public Dictionary WoodComponents + { + get; + set; + } = new(); + } + +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IComponentLogic.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..4d09334 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,21 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.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/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IOrderLogic.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..99635fc --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,21 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.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/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IWoodLogic.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IWoodLogic.cs new file mode 100644 index 0000000..cd8851c --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IWoodLogic.cs @@ -0,0 +1,20 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.BusinessLogicsContracts +{ + public interface IWoodLogic + { + List? ReadList(WoodSearchModel? model); + WoodViewModel? ReadElement(WoodSearchModel model); + bool Create(WoodBindingModel model); + bool Update(WoodBindingModel model); + bool Delete(WoodBindingModel model); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts - Backup.csproj b/CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts - Backup.csproj new file mode 100644 index 0000000..6ef3d42 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts - Backup.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts.csproj b/CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts.csproj new file mode 100644 index 0000000..0b9dbf3 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/CarpentryWorkshopContracts.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs new file mode 100644 index 0000000..f3b82ff --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs @@ -0,0 +1,7 @@ +namespace CarpentryWorkshopContracts +{ + public class Class1 + { + + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/ComponentSearchModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..d584872 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + public string? ComponentName { get; set; } + } + +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/OrderSearchModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..3742a76 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/WoodSearchModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/WoodSearchModel.cs new file mode 100644 index 0000000..b5ac7bd --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/SearchModels/WoodSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.SearchModels +{ + public class WoodSearchModel + { + public int? Id { get; set; } + public string? WoodName { get; set; } + } + +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IComponentStorage.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..376e749 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,21 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.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/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IOrderStorage.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..46f834e --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,21 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.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/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IWoodStorage.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IWoodStorage.cs new file mode 100644 index 0000000..1903f96 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/StoragesContracts/IWoodStorage.cs @@ -0,0 +1,21 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.StoragesContracts +{ + public interface IWoodStorage + { + List GetFullList(); + List GetFilteredList(WoodSearchModel model); + WoodViewModel? GetElement(WoodSearchModel model); + WoodViewModel? Insert(WoodBindingModel model); + WoodViewModel? Update(WoodBindingModel model); + WoodViewModel? Delete(WoodBindingModel model); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ComponentViewModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..0c17489 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,20 @@ +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.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/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/OrderViewModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..13214ca --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,30 @@ +using CarpentryWorkshopDataModels.Enums; +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + public int WoodId { get; set; } + [DisplayName("Изделие")] + public string WoodName { 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/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/WoodViewModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/WoodViewModel.cs new file mode 100644 index 0000000..6c8ce4e --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/WoodViewModel.cs @@ -0,0 +1,24 @@ +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.ViewModels +{ + public class WoodViewModel : IWoodModel + { + public int Id { get; set; } + [DisplayName("Название изделия")] + public string WoodName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Price { get; set; } + public Dictionary WoodComponents + { + get; + set; + } = new(); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/CarpentryWorkshopDataModels.csproj b/CarpentryWorkshop/CarpentryWorkshopDataModels/CarpentryWorkshopDataModels.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDataModels/CarpentryWorkshopDataModels.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs new file mode 100644 index 0000000..d63c74f --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs @@ -0,0 +1,7 @@ +namespace CarpentryWorkshopDataModels +{ + public class Class1 + { + + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/Enums/OrderStatus.cs b/CarpentryWorkshop/CarpentryWorkshopDataModels/Enums/OrderStatus.cs new file mode 100644 index 0000000..95a94e6 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDataModels/Enums/OrderStatus.cs @@ -0,0 +1,16 @@ + + +namespace CarpentryWorkshopDataModels.Enums +{ + /// + /// Статус заказа + /// + public enum OrderStatus + { + Неизвестен = -1, + Принят = 0, + Выполняется = 1, + Готов = 2, + Выдан = 3 + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/IId.cs b/CarpentryWorkshop/CarpentryWorkshopDataModels/IId.cs new file mode 100644 index 0000000..0abec29 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDataModels/IId.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopDataModels +{ + public interface IId + { + int Id { get; } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IComponentModel.cs b/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IComponentModel.cs new file mode 100644 index 0000000..3d73c34 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IComponentModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopDataModels.Models +{ + public interface IComponentModel : IId + { + string ComponentName { get; } + double Cost { get; } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IOrderModel.cs b/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IOrderModel.cs new file mode 100644 index 0000000..7276b02 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IOrderModel.cs @@ -0,0 +1,24 @@ +using CarpentryWorkshopDataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopDataModels.Models +{ + public interface IOrderModel : IId + { + int WoodId { get; } + string WoodName + { + get; + } + + int Count { get; } + double Sum { get; } + OrderStatus Status { get; } + DateTime DateCreate { get; } + DateTime? DateImplement { get; } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IWoodModel.cs b/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IWoodModel.cs new file mode 100644 index 0000000..62833c2 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDataModels/Models/IWoodModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopDataModels.Models +{ + public interface IWoodModel : IId + { + string WoodName { get; } + double Price { get; } + Dictionary WoodComponents { get; } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement - Backup.csproj b/CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement - Backup.csproj new file mode 100644 index 0000000..f7e2631 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement - Backup.csproj @@ -0,0 +1,14 @@ + + + + net6.0 + enable + enable + + + + + + + + diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement.csproj b/CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement.csproj new file mode 100644 index 0000000..f7e2631 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/CarpentryWorkshopListImplement.csproj @@ -0,0 +1,14 @@ + + + + net6.0 + enable + enable + + + + + + + + diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs new file mode 100644 index 0000000..f141ed7 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs @@ -0,0 +1,7 @@ +namespace CarpentryWorkshopListImplement +{ + public class Class1 + { + + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/DataListSingleton.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/DataListSingleton.cs new file mode 100644 index 0000000..9813b2a --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/DataListSingleton.cs @@ -0,0 +1,26 @@ +using CarpentryWorkshopListImplement.Models; + +namespace CarpentryWorkshopListImplement +{ + public class DataListSingleton + { + private static DataListSingleton? _instance; + public List Components { get; set; } + public List Orders { get; set; } + public List Woods { get; set; } + private DataListSingleton() + { + Components = new List(); + Orders = new List(); + Woods = new List(); + } + public static DataListSingleton GetInstance() + { + if (_instance == null) + { + _instance = new DataListSingleton(); + } + return _instance; + } + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/ComponentStorage.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/ComponentStorage.cs new file mode 100644 index 0000000..59ce081 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/ComponentStorage.cs @@ -0,0 +1,106 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.StoragesContracts; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopListImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopListImplement.Implements +{ + public class ComponentStorage : IComponentStorage + { + private readonly DataListSingleton _source; + public ComponentStorage() + { + _source = DataListSingleton.GetInstance(); + } + 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/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/OrderStorage.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..937e23b --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/OrderStorage.cs @@ -0,0 +1,106 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.StoragesContracts; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopListImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopListImplement.Implements +{ + public class OrderStorage : IOrderStorage + { + private readonly DataListSingleton _source; + public OrderStorage() + { + _source = DataListSingleton.GetInstance(); + } + 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(); + if (model.Id == null) + { + return result; + } + foreach (var order in _source.Orders) + { + if (order.Id.Equals(model.Id)) + { + result.Add(order.GetViewModel); + } + } + return result; + } + public OrderViewModel? GetElement(OrderSearchModel model) + { + if (model.Id == null && !model.Id.HasValue) + { + return null; + } + foreach (var order in _source.Orders) + { + if ((model.Id != null && order.Id == model.Id) || + (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/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/WoodStorage.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/WoodStorage.cs new file mode 100644 index 0000000..b200e72 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/Implements/WoodStorage.cs @@ -0,0 +1,106 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.StoragesContracts; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopListImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopListImplement.Implements +{ + public class WoodStorage : IWoodStorage + { + private readonly DataListSingleton _source; + public WoodStorage() + { + _source = DataListSingleton.GetInstance(); + } + public List GetFullList() + { + var result = new List(); + foreach (var wood in _source.Woods) + { + result.Add(wood.GetViewModel); + } + return result; + } + public List GetFilteredList(WoodSearchModel model) + { + var result = new List(); + if (string.IsNullOrEmpty(model.WoodName)) + { + return result; + } + foreach (var wood in _source.Woods) + { + if (wood.WoodName.Contains(model.WoodName)) + { + result.Add(wood.GetViewModel); + } + } + return result; + } + public WoodViewModel? GetElement(WoodSearchModel model) + { + if (string.IsNullOrEmpty(model.WoodName) && !model.Id.HasValue) + { + return null; + } + foreach (var wood in _source.Woods) + { + if ((!string.IsNullOrEmpty(model.WoodName) && wood.WoodName == model.WoodName) || + (model.Id.HasValue && wood.Id == model.Id)) + { + return wood.GetViewModel; + } + } + return null; + } + public WoodViewModel? Insert(WoodBindingModel model) + { + model.Id = 1; + foreach (var wood in _source.Woods) + { + if (model.Id <= wood.Id) + { + model.Id = wood.Id + 1; + } + } + var newWood = Wood.Create(model); + if (newWood == null) + { + return null; + } + _source.Woods.Add(newWood); + return newWood.GetViewModel; + } + public WoodViewModel? Update(WoodBindingModel model) + { + foreach (var wood in _source.Woods) + { + if (wood.Id == model.Id) + { + wood.Update(model); + return wood.GetViewModel; + } + } + return null; + } + public WoodViewModel? Delete(WoodBindingModel model) + { + for (int i = 0; i < _source.Woods.Count; ++i) + { + if (_source.Woods[i].Id == model.Id) + { + var element = _source.Woods[i]; + _source.Woods.RemoveAt(i); + return element.GetViewModel; + } + } + return null; + } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Component.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Component.cs new file mode 100644 index 0000000..dca7185 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Component.cs @@ -0,0 +1,46 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopListImplement.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/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Order.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Order.cs new file mode 100644 index 0000000..f48279e --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Order.cs @@ -0,0 +1,68 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopDataModels.Enums; +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopListImplement.Models +{ + public class Order : IOrderModel + { + public int Id { get; set; } + public int WoodId { get; set; } + public string WoodName { get; set; } = string.Empty; + public int Count { get; set; } + public double Sum { get; set; } + public OrderStatus Status { get; set; } + public DateTime DateCreate { get; set; } + public DateTime? DateImplement { get; set; } + public static Order? Create(OrderBindingModel? model) + { + if (model == null) + { + return null; + } + return new Order() + { + Id = model.Id, + WoodId = model.WoodId, + WoodName = model.WoodName, + Count = model.Count, + Sum = model.Sum, + Status = model.Status, + DateCreate = model.DateCreate, + DateImplement = model.DateImplement + }; + } + public void Update(OrderBindingModel? model) + { + if (model == null) + { + return; + } + WoodId = model.WoodId; + WoodName = model.WoodName; + Count = model.Count; + Sum = model.Sum; + Status = model.Status; + DateCreate = model.DateCreate; + DateImplement = model.DateImplement; + } + public OrderViewModel GetViewModel => new() + { + Id = Id, + WoodId = WoodId, + WoodName = WoodName, + Count = Count, + Sum = Sum, + Status = Status, + DateCreate = DateCreate, + DateImplement = DateImplement + }; + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Wood.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Wood.cs new file mode 100644 index 0000000..63742e6 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopListImplement/Models/Wood.cs @@ -0,0 +1,50 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopListImplement.Models +{ + public class Wood : IWoodModel + { + public int Id { get; private set; } + public string WoodName { get; private set; } = string.Empty; + public double Price { get; private set; } + public Dictionary WoodComponents { get; private set; } = new Dictionary(); + public static Wood? Create(WoodBindingModel? model) + { + if (model == null) + { + return null; + } + return new Wood() + { + Id = model.Id, + WoodName = model.WoodName, + Price = model.Price, + WoodComponents = model.WoodComponents + }; + } + public void Update(WoodBindingModel? model) + { + if (model == null) + { + return; + } + WoodName = model.WoodName; + Price = model.Price; + WoodComponents = model.WoodComponents; + } + public WoodViewModel GetViewModel => new() + { + Id = Id, + WoodName = WoodName, + Price = Price, + WoodComponents = WoodComponents + }; + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopView/CarpentryWorkshopView.csproj b/CarpentryWorkshop/CarpentryWorkshopView/CarpentryWorkshopView.csproj index 663fdb8..7aa773d 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/CarpentryWorkshopView.csproj +++ b/CarpentryWorkshop/CarpentryWorkshopView/CarpentryWorkshopView.csproj @@ -2,10 +2,24 @@ WinExe - net8.0-windows + net6.0-windows enable true enable + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs new file mode 100644 index 0000000..df40fe6 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs @@ -0,0 +1,119 @@ +namespace CarpentryWorkshopView +{ + 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() + { + this.ButtonSave = new System.Windows.Forms.Button(); + this.ButtonCancel = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.textBoxCost = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // ButtonSave + // + this.ButtonSave.Location = new System.Drawing.Point(135, 77); + this.ButtonSave.Name = "ButtonSave"; + this.ButtonSave.Size = new System.Drawing.Size(86, 23); + this.ButtonSave.TabIndex = 0; + this.ButtonSave.Text = "Сохранение"; + this.ButtonSave.UseVisualStyleBackColor = true; + this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click); + // + // ButtonCancel + // + this.ButtonCancel.Location = new System.Drawing.Point(227, 77); + this.ButtonCancel.Name = "ButtonCancel"; + this.ButtonCancel.Size = new System.Drawing.Size(75, 23); + this.ButtonCancel.TabIndex = 1; + this.ButtonCancel.Text = "Отмена"; + this.ButtonCancel.UseVisualStyleBackColor = true; + this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(62, 15); + this.label1.TabIndex = 2; + this.label1.Text = "Название:"; + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(80, 12); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(222, 23); + this.textBoxName.TabIndex = 3; + // + // textBoxCost + // + this.textBoxCost.Location = new System.Drawing.Point(80, 41); + this.textBoxCost.Name = "textBoxCost"; + this.textBoxCost.Size = new System.Drawing.Size(222, 23); + this.textBoxCost.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(38, 15); + this.label2.TabIndex = 5; + this.label2.Text = "Цена:"; + // + // FormComponent + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(311, 112); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBoxCost); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.label1); + this.Controls.Add(this.ButtonCancel); + this.Controls.Add(this.ButtonSave); + this.Name = "FormComponent"; + this.Text = "FormComponent"; + this.Load += new System.EventHandler(this.FormComponent_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button ButtonSave; + private System.Windows.Forms.Button ButtonCancel; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBoxName; + private TextBox textBoxCost; + private Label label2; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.cs new file mode 100644 index 0000000..1f2204f --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.cs @@ -0,0 +1,77 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using Microsoft.Extensions.Logging; + +namespace CarpentryWorkshopView +{ + 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/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs new file mode 100644 index 0000000..9d08aab --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs @@ -0,0 +1,114 @@ +namespace CarpentryWorkshopView +{ + 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() + { + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.ButtonAdd = new System.Windows.Forms.Button(); + this.ButtonUpd = new System.Windows.Forms.Button(); + this.ButtonDel = new System.Windows.Forms.Button(); + this.ButtonRef = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView + // + this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Location = new System.Drawing.Point(0, 0); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowTemplate.Height = 25; + this.dataGridView.Size = new System.Drawing.Size(414, 426); + this.dataGridView.TabIndex = 0; + // + // ButtonAdd + // + this.ButtonAdd.Location = new System.Drawing.Point(429, 12); + this.ButtonAdd.Name = "ButtonAdd"; + this.ButtonAdd.Size = new System.Drawing.Size(101, 23); + this.ButtonAdd.TabIndex = 1; + this.ButtonAdd.Text = "Добавить"; + this.ButtonAdd.UseVisualStyleBackColor = true; + this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click); + // + // ButtonUpd + // + this.ButtonUpd.Location = new System.Drawing.Point(429, 51); + this.ButtonUpd.Name = "ButtonUpd"; + this.ButtonUpd.Size = new System.Drawing.Size(101, 23); + this.ButtonUpd.TabIndex = 2; + this.ButtonUpd.Text = "Изменить"; + this.ButtonUpd.UseVisualStyleBackColor = true; + this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click); + // + // ButtonDel + // + this.ButtonDel.Location = new System.Drawing.Point(429, 91); + this.ButtonDel.Name = "ButtonDel"; + this.ButtonDel.Size = new System.Drawing.Size(101, 23); + this.ButtonDel.TabIndex = 3; + this.ButtonDel.Text = "Удалить"; + this.ButtonDel.UseVisualStyleBackColor = true; + this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click); + // + // ButtonRef + // + this.ButtonRef.Location = new System.Drawing.Point(429, 133); + this.ButtonRef.Name = "ButtonRef"; + this.ButtonRef.Size = new System.Drawing.Size(101, 23); + this.ButtonRef.TabIndex = 4; + this.ButtonRef.Text = "Обновить"; + this.ButtonRef.UseVisualStyleBackColor = true; + this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); + // + // FormComponents + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(542, 428); + this.Controls.Add(this.ButtonRef); + this.Controls.Add(this.ButtonDel); + this.Controls.Add(this.ButtonUpd); + this.Controls.Add(this.ButtonAdd); + this.Controls.Add(this.dataGridView); + this.Name = "FormComponents"; + this.Text = "Экипировка"; + this.Load += new System.EventHandler(this.FormComponents_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView; + private System.Windows.Forms.Button ButtonAdd; + private System.Windows.Forms.Button ButtonUpd; + private System.Windows.Forms.Button ButtonDel; + private System.Windows.Forms.Button ButtonRef; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.cs new file mode 100644 index 0000000..b6fe4f3 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.cs @@ -0,0 +1,107 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopDataModels.Models; +using Microsoft.Extensions.Logging; +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 CarpentryWorkshopView +{ + 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/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/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/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs new file mode 100644 index 0000000..6171571 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs @@ -0,0 +1,144 @@ +namespace CarpentryWorkshopView +{ + 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() + { + this.labelWood = new System.Windows.Forms.Label(); + this.labelCount = new System.Windows.Forms.Label(); + this.labelSum = new System.Windows.Forms.Label(); + this.comboBoxWood = new System.Windows.Forms.ComboBox(); + this.textBoxCount = new System.Windows.Forms.TextBox(); + this.textBoxSum = new System.Windows.Forms.TextBox(); + this.ButtonSave = new System.Windows.Forms.Button(); + this.ButtonCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // labelWood + // + this.labelWood.AutoSize = true; + this.labelWood.Location = new System.Drawing.Point(12, 8); + this.labelWood.Name = "labelWood"; + this.labelWood.Size = new System.Drawing.Size(43, 15); + this.labelWood.TabIndex = 0; + this.labelWood.Text = "Набор"; + // + // labelCount + // + this.labelCount.AutoSize = true; + this.labelCount.Location = new System.Drawing.Point(12, 37); + this.labelCount.Name = "labelCount"; + this.labelCount.Size = new System.Drawing.Size(72, 15); + this.labelCount.TabIndex = 1; + this.labelCount.Text = "Количество"; + // + // labelSum + // + this.labelSum.AutoSize = true; + this.labelSum.Location = new System.Drawing.Point(12, 66); + this.labelSum.Name = "labelSum"; + this.labelSum.Size = new System.Drawing.Size(45, 15); + this.labelSum.TabIndex = 2; + this.labelSum.Text = "Сумма"; + // + // comboBoxWood + // + this.comboBoxWood.FormattingEnabled = true; + this.comboBoxWood.Location = new System.Drawing.Point(121, 5); + this.comboBoxWood.Name = "comboBoxWood"; + this.comboBoxWood.Size = new System.Drawing.Size(292, 23); + this.comboBoxWood.TabIndex = 3; + this.comboBoxWood.SelectedIndexChanged += new System.EventHandler(this.comboBoxWood_SelectedIndexChanged); + // + // textBoxCount + // + this.textBoxCount.Location = new System.Drawing.Point(121, 34); + this.textBoxCount.Name = "textBoxCount"; + this.textBoxCount.Size = new System.Drawing.Size(292, 23); + this.textBoxCount.TabIndex = 4; + this.textBoxCount.TextChanged += new System.EventHandler(this.textBoxCount_TextChanged); + // + // textBoxSum + // + this.textBoxSum.Location = new System.Drawing.Point(121, 63); + this.textBoxSum.Name = "textBoxSum"; + this.textBoxSum.Size = new System.Drawing.Size(292, 23); + this.textBoxSum.TabIndex = 5; + // + // ButtonSave + // + this.ButtonSave.Location = new System.Drawing.Point(257, 92); + this.ButtonSave.Name = "ButtonSave"; + this.ButtonSave.Size = new System.Drawing.Size(75, 23); + this.ButtonSave.TabIndex = 6; + this.ButtonSave.Text = "Сохранить"; + this.ButtonSave.UseVisualStyleBackColor = true; + this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click); + // + // ButtonCancel + // + this.ButtonCancel.Location = new System.Drawing.Point(338, 92); + this.ButtonCancel.Name = "ButtonCancel"; + this.ButtonCancel.Size = new System.Drawing.Size(75, 23); + this.ButtonCancel.TabIndex = 7; + this.ButtonCancel.Text = "Отмена"; + this.ButtonCancel.UseVisualStyleBackColor = true; + this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + // + // FormCreateOrder + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(425, 126); + this.Controls.Add(this.ButtonCancel); + this.Controls.Add(this.ButtonSave); + this.Controls.Add(this.textBoxSum); + this.Controls.Add(this.textBoxCount); + this.Controls.Add(this.comboBoxWood); + this.Controls.Add(this.labelSum); + this.Controls.Add(this.labelCount); + this.Controls.Add(this.labelWood); + this.Name = "FormCreateOrder"; + this.Text = "Заказ"; + this.Load += new System.EventHandler(this.FormCreateOrder_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelWood; + private System.Windows.Forms.Label labelCount; + private System.Windows.Forms.Label labelSum; + private System.Windows.Forms.ComboBox comboBoxWood; + private System.Windows.Forms.TextBox textBoxCount; + private System.Windows.Forms.TextBox textBoxSum; + private System.Windows.Forms.Button ButtonSave; + private System.Windows.Forms.Button ButtonCancel; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.cs new file mode 100644 index 0000000..93590ae --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.cs @@ -0,0 +1,112 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopContracts.ViewModels; +using Microsoft.Extensions.Logging; +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 CarpentryWorkshopView +{ + public partial class FormCreateOrder : Form + { + private readonly ILogger _logger; + private readonly IWoodLogic _logicP; + private readonly IOrderLogic _logicO; + public FormCreateOrder(ILogger logger, IWoodLogic logicP, IOrderLogic logicO) + { + InitializeComponent(); + _logger = logger; + _logicP = logicP; + _logicO = logicO; + } + private void FormCreateOrder_Load(object sender, EventArgs e) + { + _logger.LogInformation("Загрузка изделий для заказа"); + // прописать логику + List list = _logicP.ReadList(null); + if (list != null) + { + comboBoxWood.DisplayMember = "WoodName"; + comboBoxWood.ValueMember = "Id"; + comboBoxWood.DataSource = list; + comboBoxWood.SelectedItem = null; + } + } + private void CalcSum() + { + if (comboBoxWood.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text)) + { + try + { + int id = Convert.ToInt32(comboBoxWood.SelectedValue); + var wood = _logicP.ReadElement(new WoodSearchModel { Id = id }); + int count = Convert.ToInt32(textBoxCount.Text); + textBoxSum.Text = Math.Round(count * (wood?.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 comboBoxWood_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 (comboBoxWood.SelectedValue == null) + { + MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + _logger.LogInformation("Создание заказа"); + try + { + var operationResult = _logicO.CreateOrder(new OrderBindingModel + { + WoodId = Convert.ToInt32(comboBoxWood.SelectedValue), + WoodName = comboBoxWood.Text, + 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/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/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/CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs new file mode 100644 index 0000000..efe7222 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs @@ -0,0 +1,176 @@ +namespace CarpentryWorkshopView +{ + 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() + { + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.КомпонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ИзделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.ButtonCreateOrder = new System.Windows.Forms.Button(); + this.ButtonTakeOrderInWork = new System.Windows.Forms.Button(); + this.ButtonOrderReady = new System.Windows.Forms.Button(); + this.ButtonIssuedOrder = new System.Windows.Forms.Button(); + this.ButtonRef = new System.Windows.Forms.Button(); + this.menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.справочникиToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(896, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.КомпонентыToolStripMenuItem, + this.ИзделияToolStripMenuItem}); + this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20); + this.справочникиToolStripMenuItem.Text = "Справочники"; + // + // КомпонентыToolStripMenuItem + // + this.КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem"; + this.КомпонентыToolStripMenuItem.Size = new System.Drawing.Size(145, 22); + this.КомпонентыToolStripMenuItem.Text = "Компоненты"; + this.КомпонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click); + // + // ИзделияToolStripMenuItem + // + this.ИзделияToolStripMenuItem.Name = "ИзделияToolStripMenuItem"; + this.ИзделияToolStripMenuItem.Size = new System.Drawing.Size(145, 22); + this.ИзделияToolStripMenuItem.Text = "Изделия"; + this.ИзделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click); + // + // dataGridView + // + this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.EnableHeadersVisualStyles = false; + this.dataGridView.Location = new System.Drawing.Point(1, 32); + this.dataGridView.MultiSelect = false; + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowTemplate.Height = 25; + this.dataGridView.Size = new System.Drawing.Size(755, 243); + this.dataGridView.TabIndex = 1; + // + // ButtonCreateOrder + // + this.ButtonCreateOrder.Location = new System.Drawing.Point(762, 44); + this.ButtonCreateOrder.Name = "ButtonCreateOrder"; + this.ButtonCreateOrder.Size = new System.Drawing.Size(122, 23); + this.ButtonCreateOrder.TabIndex = 2; + this.ButtonCreateOrder.Text = "Создать заказ"; + this.ButtonCreateOrder.UseVisualStyleBackColor = true; + this.ButtonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click); + // + // ButtonTakeOrderInWork + // + this.ButtonTakeOrderInWork.Location = new System.Drawing.Point(762, 73); + this.ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork"; + this.ButtonTakeOrderInWork.Size = new System.Drawing.Size(122, 42); + this.ButtonTakeOrderInWork.TabIndex = 3; + this.ButtonTakeOrderInWork.Text = "Отдать на выполнение"; + this.ButtonTakeOrderInWork.UseVisualStyleBackColor = true; + this.ButtonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click); + // + // ButtonOrderReady + // + this.ButtonOrderReady.Location = new System.Drawing.Point(762, 121); + this.ButtonOrderReady.Name = "ButtonOrderReady"; + this.ButtonOrderReady.Size = new System.Drawing.Size(122, 23); + this.ButtonOrderReady.TabIndex = 4; + this.ButtonOrderReady.Text = "Заказ готов"; + this.ButtonOrderReady.UseVisualStyleBackColor = true; + this.ButtonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click); + // + // ButtonIssuedOrder + // + this.ButtonIssuedOrder.Location = new System.Drawing.Point(762, 150); + this.ButtonIssuedOrder.Name = "ButtonIssuedOrder"; + this.ButtonIssuedOrder.Size = new System.Drawing.Size(122, 23); + this.ButtonIssuedOrder.TabIndex = 5; + this.ButtonIssuedOrder.Text = "Заказ выдан"; + this.ButtonIssuedOrder.UseVisualStyleBackColor = true; + this.ButtonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click); + // + // ButtonRef + // + this.ButtonRef.Location = new System.Drawing.Point(762, 179); + this.ButtonRef.Name = "ButtonRef"; + this.ButtonRef.Size = new System.Drawing.Size(122, 23); + this.ButtonRef.TabIndex = 6; + this.ButtonRef.Text = "Обновить список"; + this.ButtonRef.UseVisualStyleBackColor = true; + this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(896, 280); + this.Controls.Add(this.ButtonRef); + this.Controls.Add(this.ButtonIssuedOrder); + this.Controls.Add(this.ButtonOrderReady); + this.Controls.Add(this.ButtonTakeOrderInWork); + this.Controls.Add(this.ButtonCreateOrder); + this.Controls.Add(this.dataGridView); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "FormMain"; + this.Text = "Сборка Набора"; + this.Load += new System.EventHandler(this.FormMain_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem справочникиToolStripMenuItem; + private System.Windows.Forms.DataGridView dataGridView; + private System.Windows.Forms.Button ButtonCreateOrder; + private System.Windows.Forms.Button ButtonTakeOrderInWork; + private System.Windows.Forms.Button ButtonOrderReady; + private System.Windows.Forms.Button ButtonIssuedOrder; + private System.Windows.Forms.Button ButtonRef; + private System.Windows.Forms.ToolStripMenuItem КомпонентыToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem ИзделияToolStripMenuItem; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs new file mode 100644 index 0000000..89a244e --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs @@ -0,0 +1,148 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; +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 CarpentryWorkshopView +{ + 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("Загрузка заказов"); + // прописать логику + try + { + var list = _orderLogic.ReadList(null); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns[1].Visible = false; + + } + _logger.LogInformation("Загрузка продуктов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки продуктов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); + if (service is FormComponents form) + { + form.ShowDialog(); + } + } + private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e) + { + // прописать логику + var service = Program.ServiceProvider?.GetService(typeof(FormWoods)); + if (service is FormWoods form) + { + form.ShowDialog(); + } + } + 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/CarpentryWorkshop/CarpentryWorkshopView/FormMain.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.resx new file mode 100644 index 0000000..938108a --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs new file mode 100644 index 0000000..49db64b --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs @@ -0,0 +1,228 @@ +namespace CarpentryWorkshopView +{ + partial class FormWood + { + /// + /// 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.labelName = new System.Windows.Forms.Label(); + this.labelPrice = new System.Windows.Forms.Label(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.textBoxPrice = new System.Windows.Forms.TextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.ButtonRef = new System.Windows.Forms.Button(); + this.ButtonDel = new System.Windows.Forms.Button(); + this.ButtonUpd = new System.Windows.Forms.Button(); + this.ButtonAdd = new System.Windows.Forms.Button(); + this.ButtonSave = new System.Windows.Forms.Button(); + this.ButtonCancel = new System.Windows.Forms.Button(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ComponentName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(12, 9); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(62, 15); + this.labelName.TabIndex = 0; + this.labelName.Text = "Название:"; + // + // labelPrice + // + this.labelPrice.AutoSize = true; + this.labelPrice.Location = new System.Drawing.Point(12, 41); + this.labelPrice.Name = "labelPrice"; + this.labelPrice.Size = new System.Drawing.Size(38, 15); + this.labelPrice.TabIndex = 1; + this.labelPrice.Text = "Цена:"; + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(94, 6); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(247, 23); + this.textBoxName.TabIndex = 2; + // + // textBoxPrice + // + this.textBoxPrice.Location = new System.Drawing.Point(94, 38); + this.textBoxPrice.Name = "textBoxPrice"; + this.textBoxPrice.Size = new System.Drawing.Size(100, 23); + this.textBoxPrice.TabIndex = 3; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.dataGridView); + this.groupBox1.Controls.Add(this.ButtonRef); + this.groupBox1.Controls.Add(this.ButtonDel); + this.groupBox1.Controls.Add(this.ButtonUpd); + this.groupBox1.Controls.Add(this.ButtonAdd); + this.groupBox1.Location = new System.Drawing.Point(12, 67); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(510, 338); + this.groupBox1.TabIndex = 4; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Компонент"; + // + // dataGridView + // + this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ID, + this.ComponentName, + this.Count}); + this.dataGridView.Location = new System.Drawing.Point(0, 21); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowTemplate.Height = 25; + this.dataGridView.Size = new System.Drawing.Size(394, 311); + this.dataGridView.TabIndex = 5; + // + // ButtonRef + // + this.ButtonRef.Location = new System.Drawing.Point(400, 169); + this.ButtonRef.Name = "ButtonRef"; + this.ButtonRef.Size = new System.Drawing.Size(106, 28); + this.ButtonRef.TabIndex = 4; + this.ButtonRef.Text = "Обновить"; + this.ButtonRef.UseVisualStyleBackColor = true; + this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); + // + // ButtonDel + // + this.ButtonDel.Location = new System.Drawing.Point(400, 135); + this.ButtonDel.Name = "ButtonDel"; + this.ButtonDel.Size = new System.Drawing.Size(106, 28); + this.ButtonDel.TabIndex = 3; + this.ButtonDel.Text = "Удалить"; + this.ButtonDel.UseVisualStyleBackColor = true; + this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click); + // + // ButtonUpd + // + this.ButtonUpd.Location = new System.Drawing.Point(400, 101); + this.ButtonUpd.Name = "ButtonUpd"; + this.ButtonUpd.Size = new System.Drawing.Size(106, 28); + this.ButtonUpd.TabIndex = 2; + this.ButtonUpd.Text = "Изменить"; + this.ButtonUpd.UseVisualStyleBackColor = true; + this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click); + // + // ButtonAdd + // + this.ButtonAdd.Location = new System.Drawing.Point(400, 67); + this.ButtonAdd.Name = "ButtonAdd"; + this.ButtonAdd.Size = new System.Drawing.Size(106, 28); + this.ButtonAdd.TabIndex = 1; + this.ButtonAdd.Text = "Добавить"; + this.ButtonAdd.UseVisualStyleBackColor = true; + this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click); + // + // ButtonSave + // + this.ButtonSave.Location = new System.Drawing.Point(354, 415); + this.ButtonSave.Name = "ButtonSave"; + this.ButtonSave.Size = new System.Drawing.Size(75, 23); + this.ButtonSave.TabIndex = 5; + this.ButtonSave.Text = "Сохранить"; + this.ButtonSave.UseVisualStyleBackColor = true; + this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click); + // + // ButtonCancel + // + this.ButtonCancel.Location = new System.Drawing.Point(435, 415); + this.ButtonCancel.Name = "ButtonCancel"; + this.ButtonCancel.Size = new System.Drawing.Size(75, 23); + this.ButtonCancel.TabIndex = 6; + this.ButtonCancel.Text = "Отмена"; + this.ButtonCancel.UseVisualStyleBackColor = true; + this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + // + // ID + // + this.ID.HeaderText = "Id"; + this.ID.Name = "ID"; + this.ID.Visible = false; + this.ID.Width = 250; + // + // ComponentName + // + this.ComponentName.HeaderText = "Компоненте"; + this.ComponentName.Name = "ComponentName"; + this.ComponentName.Width = 250; + // + // Count + // + this.Count.HeaderText = "Количество"; + this.Count.Name = "Count"; + // + // FormWood + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(536, 450); + this.Controls.Add(this.ButtonCancel); + this.Controls.Add(this.ButtonSave); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.textBoxPrice); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelPrice); + this.Controls.Add(this.labelName); + this.Name = "FormWood"; + this.Text = "Создание набора"; + this.Load += new System.EventHandler(this.FormWood_Load); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelName; + private System.Windows.Forms.Label labelPrice; + private System.Windows.Forms.TextBox textBoxName; + private System.Windows.Forms.TextBox textBoxPrice; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.DataGridView dataGridView; + private System.Windows.Forms.Button ButtonRef; + private System.Windows.Forms.Button ButtonDel; + private System.Windows.Forms.Button ButtonUpd; + private System.Windows.Forms.Button ButtonAdd; + private System.Windows.Forms.Button ButtonSave; + private System.Windows.Forms.Button ButtonCancel; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn ComponentName; + private System.Windows.Forms.DataGridViewTextBoxColumn Count; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWood.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.cs new file mode 100644 index 0000000..6032584 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.cs @@ -0,0 +1,201 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopDataModels.Models; +using Microsoft.Extensions.Logging; +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 CarpentryWorkshopView +{ + public partial class FormWood : Form + { + private readonly ILogger _logger; + private readonly IWoodLogic _logic; + private int? _id; + private Dictionary _woodComponents; + public int Id { set { _id = value; } } + public FormWood(ILogger logger, IWoodLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + _woodComponents = new Dictionary(); + } + private void FormWood_Load(object sender, EventArgs e) + { + if (_id.HasValue) + { + _logger.LogInformation("Загрузка изделия"); + try + { + var view = _logic.ReadElement(new WoodSearchModel { Id = _id.Value }); + if (view != null) + { + textBoxName.Text = view.WoodName; + textBoxPrice.Text = view.Price.ToString(); + _woodComponents = view.WoodComponents ?? new Dictionary(); + LoadData(); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void LoadData() + { + _logger.LogInformation("Загрузка компонент изделия"); + try + { + if (_woodComponents != null) + { + dataGridView.Rows.Clear(); + foreach (var pc in _woodComponents) + { + 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(FormWoodComponent)); + if (service is FormWoodComponent form) + { + if (form.ShowDialog() == DialogResult.OK) + { + if (form.ComponentModel == null) + { + return; + } + _logger.LogInformation("Добавление нового компонента: {ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count); + if (_woodComponents.ContainsKey(form.Id)) + { + _woodComponents[form.Id] = (form.ComponentModel, form.Count); + } + else + { + _woodComponents.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(FormWoodComponent)); + if (service is FormWoodComponent form) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); + form.Id = id; + form.Count = _woodComponents[id].Item2; + if (form.ShowDialog() == DialogResult.OK) + { + if (form.ComponentModel == null) + { + return; + } + _logger.LogInformation("Изменение компонента: {ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count); + _woodComponents[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); _woodComponents?.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 (_woodComponents == null || _woodComponents.Count == 0) + { + MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + _logger.LogInformation("Сохранение изделия"); + try + { + var model = new WoodBindingModel + { + Id = _id ?? 0, + WoodName = textBoxName.Text, + Price = Convert.ToDouble(textBoxPrice.Text), + WoodComponents = _woodComponents + }; + 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 _woodComponents) + { + price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2); + } + return Math.Round(price * 1.1, 2); + } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWood.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.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/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs new file mode 100644 index 0000000..ed2d6dd --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs @@ -0,0 +1,120 @@ +namespace CarpentryWorkshopView +{ + partial class FormWoodComponent + { + /// + /// 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.labelComponent = new System.Windows.Forms.Label(); + this.labelCount = new System.Windows.Forms.Label(); + this.textBoxCount = new System.Windows.Forms.TextBox(); + this.comboBoxComponent = new System.Windows.Forms.ComboBox(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonSave = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // labelComponent + // + this.labelComponent.AutoSize = true; + this.labelComponent.Location = new System.Drawing.Point(12, 9); + this.labelComponent.Name = "labelComponent"; + this.labelComponent.Size = new System.Drawing.Size(76, 15); + this.labelComponent.TabIndex = 0; + this.labelComponent.Text = "Экипировка:"; + // + // labelCount + // + this.labelCount.AutoSize = true; + this.labelCount.Location = new System.Drawing.Point(12, 37); + this.labelCount.Name = "labelCount"; + this.labelCount.Size = new System.Drawing.Size(75, 15); + this.labelCount.TabIndex = 1; + this.labelCount.Text = "Количество:"; + // + // textBoxCount + // + this.textBoxCount.Location = new System.Drawing.Point(90, 34); + this.textBoxCount.Name = "textBoxCount"; + this.textBoxCount.Size = new System.Drawing.Size(235, 23); + this.textBoxCount.TabIndex = 3; + // + // comboBoxComponent + // + this.comboBoxComponent.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxComponent.FormattingEnabled = true; + this.comboBoxComponent.Location = new System.Drawing.Point(90, 6); + this.comboBoxComponent.Name = "comboBoxComponent"; + this.comboBoxComponent.Size = new System.Drawing.Size(235, 23); + this.comboBoxComponent.TabIndex = 4; + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point(248, 63); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "Отмена"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // buttonSave + // + this.buttonSave.Location = new System.Drawing.Point(167, 63); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(75, 23); + this.buttonSave.TabIndex = 6; + this.buttonSave.Text = "Сохранить"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); + // + // FormWoodComponent + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(337, 97); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.comboBoxComponent); + this.Controls.Add(this.textBoxCount); + this.Controls.Add(this.labelCount); + this.Controls.Add(this.labelComponent); + this.Name = "FormWoodComponent"; + this.Text = "экипировка набора"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelComponent; + private System.Windows.Forms.Label labelCount; + private System.Windows.Forms.TextBox textBoxCount; + private System.Windows.Forms.ComboBox comboBoxComponent; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonSave; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs new file mode 100644 index 0000000..9852882 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs @@ -0,0 +1,72 @@ +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.ViewModels; +using CarpentryWorkshopDataModels.Models; +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 CarpentryWorkshopView +{ + public partial class FormWoodComponent : 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 FormWoodComponent(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/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.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/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs new file mode 100644 index 0000000..06e908f --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs @@ -0,0 +1,115 @@ +namespace CarpentryWorkshopView +{ + partial class FormWoods + { + /// + /// 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.dataGridView = new System.Windows.Forms.DataGridView(); + this.ButtonAdd = new System.Windows.Forms.Button(); + this.ButtonUpd = new System.Windows.Forms.Button(); + this.ButtonDel = new System.Windows.Forms.Button(); + this.ButtonRef = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView + // + this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Location = new System.Drawing.Point(0, 0); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowTemplate.Height = 25; + this.dataGridView.Size = new System.Drawing.Size(509, 448); + this.dataGridView.TabIndex = 0; + // + // ButtonAdd + // + this.ButtonAdd.Location = new System.Drawing.Point(526, 12); + this.ButtonAdd.Name = "ButtonAdd"; + this.ButtonAdd.Size = new System.Drawing.Size(127, 23); + this.ButtonAdd.TabIndex = 1; + this.ButtonAdd.Text = "Добавить"; + this.ButtonAdd.UseVisualStyleBackColor = true; + this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click); + // + // ButtonUpd + // + this.ButtonUpd.Location = new System.Drawing.Point(526, 41); + this.ButtonUpd.Name = "ButtonUpd"; + this.ButtonUpd.Size = new System.Drawing.Size(127, 23); + this.ButtonUpd.TabIndex = 2; + this.ButtonUpd.Text = "Изменить"; + this.ButtonUpd.UseVisualStyleBackColor = true; + this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click); + // + // ButtonDel + // + this.ButtonDel.Location = new System.Drawing.Point(526, 70); + this.ButtonDel.Name = "ButtonDel"; + this.ButtonDel.Size = new System.Drawing.Size(127, 23); + this.ButtonDel.TabIndex = 3; + this.ButtonDel.Text = "Удалить"; + this.ButtonDel.UseVisualStyleBackColor = true; + this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click); + // + // ButtonRef + // + this.ButtonRef.Location = new System.Drawing.Point(526, 99); + this.ButtonRef.Name = "ButtonRef"; + this.ButtonRef.Size = new System.Drawing.Size(127, 23); + this.ButtonRef.TabIndex = 4; + this.ButtonRef.Text = "Обновить"; + this.ButtonRef.UseVisualStyleBackColor = true; + this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); + // + // FormWoods + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(668, 450); + this.Controls.Add(this.ButtonRef); + this.Controls.Add(this.ButtonDel); + this.Controls.Add(this.ButtonUpd); + this.Controls.Add(this.ButtonAdd); + this.Controls.Add(this.dataGridView); + this.Name = "FormWoods"; + this.Text = "Набор"; + this.Load += new System.EventHandler(this.FormWoods_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView; + private System.Windows.Forms.Button ButtonAdd; + private System.Windows.Forms.Button ButtonUpd; + private System.Windows.Forms.Button ButtonDel; + private System.Windows.Forms.Button ButtonRef; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.cs new file mode 100644 index 0000000..4c96810 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.cs @@ -0,0 +1,109 @@ +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.SearchModels; +using CarpentryWorkshopDataModels.Models; +using Microsoft.Extensions.Logging; +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; +using static System.Windows.Forms.DataFormats; + +namespace CarpentryWorkshopView +{ + public partial class FormWoods : Form + { + private readonly ILogger _logger; + private readonly IWoodLogic _logic; + public FormWoods(ILogger logger, IWoodLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + private void FormWoods_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["WoodName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns[3].Visible = false; + + } + _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(FormWood)); + if (service is FormWood 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(FormWood)); + if (service is FormWood 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 WoodBindingModel { 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/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/CarpentryWorkshop/CarpentryWorkshopView/Program.cs b/CarpentryWorkshop/CarpentryWorkshopView/Program.cs index 3148d7b..efb4377 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/Program.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/Program.cs @@ -1,9 +1,19 @@ +using CarpentryWorkshopBusinessLogic.BusinessLogics; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +using CarpentryWorkshopContracts.StoragesContracts; +using CarpentryWorkshopListImplement.Implements; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NLog.Extensions.Logging; + namespace CarpentryWorkshopView { 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() @@ -11,7 +21,31 @@ namespace CarpentryWorkshopView // 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(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file -- 2.25.1 From 3e82d9e00d1eb56fdf72ae2b08298131747ec802 Mon Sep 17 00:00:00 2001 From: leoevgeniy <98206383+leoevgeniy@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:25:57 +0400 Subject: [PATCH 2/3] Some fixes --- .../BusinessLogics/OrderLogic.cs | 8 -------- .../CarpentryWorkshopBusinessLogic/Class1.cs | 7 ------- CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs | 7 ------- CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs | 7 ------- .../CarpentryWorkshopListImplement/Class1.cs | 7 ------- 5 files changed, 36 deletions(-) delete mode 100644 CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs delete mode 100644 CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs delete mode 100644 CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs delete mode 100644 CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs index 07795aa..73dd705 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs @@ -116,7 +116,6 @@ namespace CarpentryWorkshopBusinessLogic.BusinessLogics { throw new Exception("Заказ не в статусе \"Готов\""); } - _orderStorage.Update(new OrderBindingModel { Id = order.Id, @@ -129,13 +128,6 @@ namespace CarpentryWorkshopBusinessLogic.BusinessLogics Status = OrderStatus.Выдан }); return true; - } - - - - - - } } diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs deleted file mode 100644 index 41846ac..0000000 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CarpentryWorkshopBusinessLogic -{ - public class Class1 - { - - } -} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs deleted file mode 100644 index f3b82ff..0000000 --- a/CarpentryWorkshop/CarpentryWorkshopContracts/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CarpentryWorkshopContracts -{ - public class Class1 - { - - } -} diff --git a/CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs deleted file mode 100644 index d63c74f..0000000 --- a/CarpentryWorkshop/CarpentryWorkshopDataModels/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CarpentryWorkshopDataModels -{ - public class Class1 - { - - } -} diff --git a/CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs b/CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs deleted file mode 100644 index f141ed7..0000000 --- a/CarpentryWorkshop/CarpentryWorkshopListImplement/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CarpentryWorkshopListImplement -{ - public class Class1 - { - - } -} -- 2.25.1 From f242cf1cf5ca7c75e5f49605860717920b46272d Mon Sep 17 00:00:00 2001 From: leoevgeniy <98206383+leoevgeniy@users.noreply.github.com> Date: Tue, 20 Feb 2024 01:21:09 +0400 Subject: [PATCH 3/3] Fixes --- .../CarpentryWorkshopView/Form1.Designer.cs | 39 --- .../CarpentryWorkshopView/Form1.cs | 10 - .../CarpentryWorkshopView/Form1.resx | 120 -------- .../FormComponent.Designer.cs | 111 ++++--- .../CarpentryWorkshopView/FormComponent.resx | 62 +++- .../FormComponents.Designer.cs | 110 +++---- .../CarpentryWorkshopView/FormComponents.resx | 50 +-- .../FormCreateOrder.Designer.cs | 145 +++++---- .../FormCreateOrder.resx | 50 +-- .../FormWood.Designer.cs | 290 +++++++++--------- .../CarpentryWorkshopView/FormWood.resx | 50 +-- .../FormWoodComponent.Designer.cs | 114 +++---- .../FormWoodComponent.cs | 5 + .../FormWoodComponent.resx | 50 +-- .../FormWoods.Designer.cs | 111 ++++--- .../CarpentryWorkshopView/FormWoods.resx | 62 +++- 16 files changed, 664 insertions(+), 715 deletions(-) delete mode 100644 CarpentryWorkshop/CarpentryWorkshopView/Form1.Designer.cs delete mode 100644 CarpentryWorkshop/CarpentryWorkshopView/Form1.cs delete mode 100644 CarpentryWorkshop/CarpentryWorkshopView/Form1.resx diff --git a/CarpentryWorkshop/CarpentryWorkshopView/Form1.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/Form1.Designer.cs deleted file mode 100644 index 3a5ab7e..0000000 --- a/CarpentryWorkshop/CarpentryWorkshopView/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace CarpentryWorkshopView -{ - 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 - } -} diff --git a/CarpentryWorkshop/CarpentryWorkshopView/Form1.cs b/CarpentryWorkshop/CarpentryWorkshopView/Form1.cs deleted file mode 100644 index 288756f..0000000 --- a/CarpentryWorkshop/CarpentryWorkshopView/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace CarpentryWorkshopView -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/CarpentryWorkshop/CarpentryWorkshopView/Form1.resx b/CarpentryWorkshop/CarpentryWorkshopView/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/CarpentryWorkshop/CarpentryWorkshopView/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/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs index df40fe6..7012a0b 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.Designer.cs @@ -28,83 +28,82 @@ /// private void InitializeComponent() { - this.ButtonSave = new System.Windows.Forms.Button(); - this.ButtonCancel = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.textBoxName = new System.Windows.Forms.TextBox(); - this.textBoxCost = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.SuspendLayout(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + label1 = new Label(); + textBoxName = new TextBox(); + textBoxCost = new TextBox(); + label2 = new Label(); + SuspendLayout(); // // ButtonSave // - this.ButtonSave.Location = new System.Drawing.Point(135, 77); - this.ButtonSave.Name = "ButtonSave"; - this.ButtonSave.Size = new System.Drawing.Size(86, 23); - this.ButtonSave.TabIndex = 0; - this.ButtonSave.Text = "Сохранение"; - this.ButtonSave.UseVisualStyleBackColor = true; - this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click); + ButtonSave.Location = new Point(135, 77); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(86, 23); + ButtonSave.TabIndex = 0; + ButtonSave.Text = "Сохранение"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; // // ButtonCancel // - this.ButtonCancel.Location = new System.Drawing.Point(227, 77); - this.ButtonCancel.Name = "ButtonCancel"; - this.ButtonCancel.Size = new System.Drawing.Size(75, 23); - this.ButtonCancel.TabIndex = 1; - this.ButtonCancel.Text = "Отмена"; - this.ButtonCancel.UseVisualStyleBackColor = true; - this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + ButtonCancel.Location = new Point(227, 77); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(75, 23); + ButtonCancel.TabIndex = 1; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 15); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(62, 15); - this.label1.TabIndex = 2; - this.label1.Text = "Название:"; + label1.AutoSize = true; + label1.Location = new Point(12, 15); + label1.Name = "label1"; + label1.Size = new Size(62, 15); + label1.TabIndex = 2; + label1.Text = "Название:"; // // textBoxName // - this.textBoxName.Location = new System.Drawing.Point(80, 12); - this.textBoxName.Name = "textBoxName"; - this.textBoxName.Size = new System.Drawing.Size(222, 23); - this.textBoxName.TabIndex = 3; + textBoxName.Location = new Point(80, 12); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(222, 23); + textBoxName.TabIndex = 3; // // textBoxCost // - this.textBoxCost.Location = new System.Drawing.Point(80, 41); - this.textBoxCost.Name = "textBoxCost"; - this.textBoxCost.Size = new System.Drawing.Size(222, 23); - this.textBoxCost.TabIndex = 4; + textBoxCost.Location = new Point(80, 41); + textBoxCost.Name = "textBoxCost"; + textBoxCost.Size = new Size(222, 23); + textBoxCost.TabIndex = 4; // // label2 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 41); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(38, 15); - this.label2.TabIndex = 5; - this.label2.Text = "Цена:"; + label2.AutoSize = true; + label2.Location = new Point(12, 41); + label2.Name = "label2"; + label2.Size = new Size(38, 15); + label2.TabIndex = 5; + label2.Text = "Цена:"; // // FormComponent // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(311, 112); - this.Controls.Add(this.label2); - this.Controls.Add(this.textBoxCost); - this.Controls.Add(this.textBoxName); - this.Controls.Add(this.label1); - this.Controls.Add(this.ButtonCancel); - this.Controls.Add(this.ButtonSave); - this.Name = "FormComponent"; - this.Text = "FormComponent"; - this.Load += new System.EventHandler(this.FormComponent_Load); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(311, 112); + Controls.Add(label2); + Controls.Add(textBoxCost); + Controls.Add(textBoxName); + Controls.Add(label1); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Name = "FormComponent"; + Text = "Компонент"; + Load += FormComponent_Load; + ResumeLayout(false); + PerformLayout(); } #endregion diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx index f298a7b..af32865 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponent.resx @@ -1,4 +1,64 @@ - + + + diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs index 9d08aab..ad3c229 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.Designer.cs @@ -28,79 +28,79 @@ /// private void InitializeComponent() { - this.dataGridView = new System.Windows.Forms.DataGridView(); - this.ButtonAdd = new System.Windows.Forms.Button(); - this.ButtonUpd = new System.Windows.Forms.Button(); - this.ButtonDel = new System.Windows.Forms.Button(); - this.ButtonRef = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - this.SuspendLayout(); + dataGridView = new DataGridView(); + ButtonAdd = new Button(); + ButtonUpd = new Button(); + ButtonDel = new Button(); + ButtonRef = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); // // dataGridView // - this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Location = new System.Drawing.Point(0, 0); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowTemplate.Height = 25; - this.dataGridView.Size = new System.Drawing.Size(414, 426); - this.dataGridView.TabIndex = 0; + dataGridView.BackgroundColor = SystemColors.ControlLightLight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 0); + dataGridView.Name = "dataGridView"; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(414, 426); + dataGridView.TabIndex = 0; // // ButtonAdd // - this.ButtonAdd.Location = new System.Drawing.Point(429, 12); - this.ButtonAdd.Name = "ButtonAdd"; - this.ButtonAdd.Size = new System.Drawing.Size(101, 23); - this.ButtonAdd.TabIndex = 1; - this.ButtonAdd.Text = "Добавить"; - this.ButtonAdd.UseVisualStyleBackColor = true; - this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click); + ButtonAdd.Location = new Point(429, 12); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(101, 23); + ButtonAdd.TabIndex = 1; + ButtonAdd.Text = "Добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; // // ButtonUpd // - this.ButtonUpd.Location = new System.Drawing.Point(429, 51); - this.ButtonUpd.Name = "ButtonUpd"; - this.ButtonUpd.Size = new System.Drawing.Size(101, 23); - this.ButtonUpd.TabIndex = 2; - this.ButtonUpd.Text = "Изменить"; - this.ButtonUpd.UseVisualStyleBackColor = true; - this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click); + ButtonUpd.Location = new Point(429, 51); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(101, 23); + ButtonUpd.TabIndex = 2; + ButtonUpd.Text = "Изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; // // ButtonDel // - this.ButtonDel.Location = new System.Drawing.Point(429, 91); - this.ButtonDel.Name = "ButtonDel"; - this.ButtonDel.Size = new System.Drawing.Size(101, 23); - this.ButtonDel.TabIndex = 3; - this.ButtonDel.Text = "Удалить"; - this.ButtonDel.UseVisualStyleBackColor = true; - this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click); + ButtonDel.Location = new Point(429, 91); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(101, 23); + ButtonDel.TabIndex = 3; + ButtonDel.Text = "Удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; // // ButtonRef // - this.ButtonRef.Location = new System.Drawing.Point(429, 133); - this.ButtonRef.Name = "ButtonRef"; - this.ButtonRef.Size = new System.Drawing.Size(101, 23); - this.ButtonRef.TabIndex = 4; - this.ButtonRef.Text = "Обновить"; - this.ButtonRef.UseVisualStyleBackColor = true; - this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); + ButtonRef.Location = new Point(429, 133); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(101, 23); + ButtonRef.TabIndex = 4; + ButtonRef.Text = "Обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; // // FormComponents // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(542, 428); - this.Controls.Add(this.ButtonRef); - this.Controls.Add(this.ButtonDel); - this.Controls.Add(this.ButtonUpd); - this.Controls.Add(this.ButtonAdd); - this.Controls.Add(this.dataGridView); - this.Name = "FormComponents"; - this.Text = "Экипировка"; - this.Load += new System.EventHandler(this.FormComponents_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); - this.ResumeLayout(false); + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(542, 428); + Controls.Add(ButtonRef); + Controls.Add(ButtonDel); + Controls.Add(ButtonUpd); + Controls.Add(ButtonAdd); + Controls.Add(dataGridView); + Name = "FormComponents"; + Text = "Компоненты"; + Load += FormComponents_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); } #endregion diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.resx index 1af7de1..af32865 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.resx +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormComponents.resx @@ -1,17 +1,17 @@  - diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs index 6171571..50e4929 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.Designer.cs @@ -28,106 +28,105 @@ /// private void InitializeComponent() { - this.labelWood = new System.Windows.Forms.Label(); - this.labelCount = new System.Windows.Forms.Label(); - this.labelSum = new System.Windows.Forms.Label(); - this.comboBoxWood = new System.Windows.Forms.ComboBox(); - this.textBoxCount = new System.Windows.Forms.TextBox(); - this.textBoxSum = new System.Windows.Forms.TextBox(); - this.ButtonSave = new System.Windows.Forms.Button(); - this.ButtonCancel = new System.Windows.Forms.Button(); - this.SuspendLayout(); + labelWood = new Label(); + labelCount = new Label(); + labelSum = new Label(); + comboBoxWood = new ComboBox(); + textBoxCount = new TextBox(); + textBoxSum = new TextBox(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + SuspendLayout(); // // labelWood // - this.labelWood.AutoSize = true; - this.labelWood.Location = new System.Drawing.Point(12, 8); - this.labelWood.Name = "labelWood"; - this.labelWood.Size = new System.Drawing.Size(43, 15); - this.labelWood.TabIndex = 0; - this.labelWood.Text = "Набор"; + labelWood.AutoSize = true; + labelWood.Location = new Point(12, 8); + labelWood.Name = "labelWood"; + labelWood.Size = new Size(53, 15); + labelWood.TabIndex = 0; + labelWood.Text = "Изделие"; // // labelCount // - this.labelCount.AutoSize = true; - this.labelCount.Location = new System.Drawing.Point(12, 37); - this.labelCount.Name = "labelCount"; - this.labelCount.Size = new System.Drawing.Size(72, 15); - this.labelCount.TabIndex = 1; - this.labelCount.Text = "Количество"; + labelCount.AutoSize = true; + labelCount.Location = new Point(12, 37); + labelCount.Name = "labelCount"; + labelCount.Size = new Size(72, 15); + labelCount.TabIndex = 1; + labelCount.Text = "Количество"; // // labelSum // - this.labelSum.AutoSize = true; - this.labelSum.Location = new System.Drawing.Point(12, 66); - this.labelSum.Name = "labelSum"; - this.labelSum.Size = new System.Drawing.Size(45, 15); - this.labelSum.TabIndex = 2; - this.labelSum.Text = "Сумма"; + labelSum.AutoSize = true; + labelSum.Location = new Point(12, 66); + labelSum.Name = "labelSum"; + labelSum.Size = new Size(45, 15); + labelSum.TabIndex = 2; + labelSum.Text = "Сумма"; // // comboBoxWood // - this.comboBoxWood.FormattingEnabled = true; - this.comboBoxWood.Location = new System.Drawing.Point(121, 5); - this.comboBoxWood.Name = "comboBoxWood"; - this.comboBoxWood.Size = new System.Drawing.Size(292, 23); - this.comboBoxWood.TabIndex = 3; - this.comboBoxWood.SelectedIndexChanged += new System.EventHandler(this.comboBoxWood_SelectedIndexChanged); + comboBoxWood.FormattingEnabled = true; + comboBoxWood.Location = new Point(121, 5); + comboBoxWood.Name = "comboBoxWood"; + comboBoxWood.Size = new Size(292, 23); + comboBoxWood.TabIndex = 3; + comboBoxWood.SelectedIndexChanged += comboBoxWood_SelectedIndexChanged; // // textBoxCount // - this.textBoxCount.Location = new System.Drawing.Point(121, 34); - this.textBoxCount.Name = "textBoxCount"; - this.textBoxCount.Size = new System.Drawing.Size(292, 23); - this.textBoxCount.TabIndex = 4; - this.textBoxCount.TextChanged += new System.EventHandler(this.textBoxCount_TextChanged); + textBoxCount.Location = new Point(121, 34); + textBoxCount.Name = "textBoxCount"; + textBoxCount.Size = new Size(292, 23); + textBoxCount.TabIndex = 4; + textBoxCount.TextChanged += textBoxCount_TextChanged; // // textBoxSum // - this.textBoxSum.Location = new System.Drawing.Point(121, 63); - this.textBoxSum.Name = "textBoxSum"; - this.textBoxSum.Size = new System.Drawing.Size(292, 23); - this.textBoxSum.TabIndex = 5; + textBoxSum.Location = new Point(121, 63); + textBoxSum.Name = "textBoxSum"; + textBoxSum.Size = new Size(292, 23); + textBoxSum.TabIndex = 5; // // ButtonSave // - this.ButtonSave.Location = new System.Drawing.Point(257, 92); - this.ButtonSave.Name = "ButtonSave"; - this.ButtonSave.Size = new System.Drawing.Size(75, 23); - this.ButtonSave.TabIndex = 6; - this.ButtonSave.Text = "Сохранить"; - this.ButtonSave.UseVisualStyleBackColor = true; - this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click); + ButtonSave.Location = new Point(257, 92); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(75, 23); + ButtonSave.TabIndex = 6; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; // // ButtonCancel // - this.ButtonCancel.Location = new System.Drawing.Point(338, 92); - this.ButtonCancel.Name = "ButtonCancel"; - this.ButtonCancel.Size = new System.Drawing.Size(75, 23); - this.ButtonCancel.TabIndex = 7; - this.ButtonCancel.Text = "Отмена"; - this.ButtonCancel.UseVisualStyleBackColor = true; - this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + ButtonCancel.Location = new Point(338, 92); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(75, 23); + ButtonCancel.TabIndex = 7; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; // // FormCreateOrder // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(425, 126); - this.Controls.Add(this.ButtonCancel); - this.Controls.Add(this.ButtonSave); - this.Controls.Add(this.textBoxSum); - this.Controls.Add(this.textBoxCount); - this.Controls.Add(this.comboBoxWood); - this.Controls.Add(this.labelSum); - this.Controls.Add(this.labelCount); - this.Controls.Add(this.labelWood); - this.Name = "FormCreateOrder"; - this.Text = "Заказ"; - this.Load += new System.EventHandler(this.FormCreateOrder_Load); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(425, 126); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(textBoxSum); + Controls.Add(textBoxCount); + Controls.Add(comboBoxWood); + Controls.Add(labelSum); + Controls.Add(labelCount); + Controls.Add(labelWood); + Name = "FormCreateOrder"; + Text = "Заказ"; + Load += FormCreateOrder_Load; + ResumeLayout(false); + PerformLayout(); } #endregion diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.resx index 1af7de1..af32865 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.resx +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormCreateOrder.resx @@ -1,17 +1,17 @@  - diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs index 49db64b..1268bd9 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.Designer.cs @@ -28,183 +28,179 @@ /// private void InitializeComponent() { - this.labelName = new System.Windows.Forms.Label(); - this.labelPrice = new System.Windows.Forms.Label(); - this.textBoxName = new System.Windows.Forms.TextBox(); - this.textBoxPrice = new System.Windows.Forms.TextBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.dataGridView = new System.Windows.Forms.DataGridView(); - this.ButtonRef = new System.Windows.Forms.Button(); - this.ButtonDel = new System.Windows.Forms.Button(); - this.ButtonUpd = new System.Windows.Forms.Button(); - this.ButtonAdd = new System.Windows.Forms.Button(); - this.ButtonSave = new System.Windows.Forms.Button(); - this.ButtonCancel = new System.Windows.Forms.Button(); - this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ComponentName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - this.SuspendLayout(); + labelName = new Label(); + labelPrice = new Label(); + textBoxName = new TextBox(); + textBoxPrice = new TextBox(); + groupBox1 = new GroupBox(); + dataGridView = new DataGridView(); + ID = new DataGridViewTextBoxColumn(); + ComponentName = new DataGridViewTextBoxColumn(); + Count = new DataGridViewTextBoxColumn(); + ButtonRef = new Button(); + ButtonDel = new Button(); + ButtonUpd = new Button(); + ButtonAdd = new Button(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); // // labelName // - this.labelName.AutoSize = true; - this.labelName.Location = new System.Drawing.Point(12, 9); - this.labelName.Name = "labelName"; - this.labelName.Size = new System.Drawing.Size(62, 15); - this.labelName.TabIndex = 0; - this.labelName.Text = "Название:"; + labelName.AutoSize = true; + labelName.Location = new Point(12, 9); + labelName.Name = "labelName"; + labelName.Size = new Size(62, 15); + labelName.TabIndex = 0; + labelName.Text = "Название:"; // // labelPrice // - this.labelPrice.AutoSize = true; - this.labelPrice.Location = new System.Drawing.Point(12, 41); - this.labelPrice.Name = "labelPrice"; - this.labelPrice.Size = new System.Drawing.Size(38, 15); - this.labelPrice.TabIndex = 1; - this.labelPrice.Text = "Цена:"; + labelPrice.AutoSize = true; + labelPrice.Location = new Point(12, 41); + labelPrice.Name = "labelPrice"; + labelPrice.Size = new Size(38, 15); + labelPrice.TabIndex = 1; + labelPrice.Text = "Цена:"; // // textBoxName // - this.textBoxName.Location = new System.Drawing.Point(94, 6); - this.textBoxName.Name = "textBoxName"; - this.textBoxName.Size = new System.Drawing.Size(247, 23); - this.textBoxName.TabIndex = 2; + textBoxName.Location = new Point(94, 6); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(247, 23); + textBoxName.TabIndex = 2; // // textBoxPrice // - this.textBoxPrice.Location = new System.Drawing.Point(94, 38); - this.textBoxPrice.Name = "textBoxPrice"; - this.textBoxPrice.Size = new System.Drawing.Size(100, 23); - this.textBoxPrice.TabIndex = 3; + textBoxPrice.Location = new Point(94, 38); + textBoxPrice.Name = "textBoxPrice"; + textBoxPrice.Size = new Size(100, 23); + textBoxPrice.TabIndex = 3; // // groupBox1 // - this.groupBox1.Controls.Add(this.dataGridView); - this.groupBox1.Controls.Add(this.ButtonRef); - this.groupBox1.Controls.Add(this.ButtonDel); - this.groupBox1.Controls.Add(this.ButtonUpd); - this.groupBox1.Controls.Add(this.ButtonAdd); - this.groupBox1.Location = new System.Drawing.Point(12, 67); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(510, 338); - this.groupBox1.TabIndex = 4; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Компонент"; + groupBox1.Controls.Add(dataGridView); + groupBox1.Controls.Add(ButtonRef); + groupBox1.Controls.Add(ButtonDel); + groupBox1.Controls.Add(ButtonUpd); + groupBox1.Controls.Add(ButtonAdd); + groupBox1.Location = new Point(12, 67); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new Size(510, 338); + groupBox1.TabIndex = 4; + groupBox1.TabStop = false; + groupBox1.Text = "Компонент"; // // dataGridView // - this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.ID, - this.ComponentName, - this.Count}); - this.dataGridView.Location = new System.Drawing.Point(0, 21); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowTemplate.Height = 25; - this.dataGridView.Size = new System.Drawing.Size(394, 311); - this.dataGridView.TabIndex = 5; - // - // ButtonRef - // - this.ButtonRef.Location = new System.Drawing.Point(400, 169); - this.ButtonRef.Name = "ButtonRef"; - this.ButtonRef.Size = new System.Drawing.Size(106, 28); - this.ButtonRef.TabIndex = 4; - this.ButtonRef.Text = "Обновить"; - this.ButtonRef.UseVisualStyleBackColor = true; - this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); - // - // ButtonDel - // - this.ButtonDel.Location = new System.Drawing.Point(400, 135); - this.ButtonDel.Name = "ButtonDel"; - this.ButtonDel.Size = new System.Drawing.Size(106, 28); - this.ButtonDel.TabIndex = 3; - this.ButtonDel.Text = "Удалить"; - this.ButtonDel.UseVisualStyleBackColor = true; - this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click); - // - // ButtonUpd - // - this.ButtonUpd.Location = new System.Drawing.Point(400, 101); - this.ButtonUpd.Name = "ButtonUpd"; - this.ButtonUpd.Size = new System.Drawing.Size(106, 28); - this.ButtonUpd.TabIndex = 2; - this.ButtonUpd.Text = "Изменить"; - this.ButtonUpd.UseVisualStyleBackColor = true; - this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click); - // - // ButtonAdd - // - this.ButtonAdd.Location = new System.Drawing.Point(400, 67); - this.ButtonAdd.Name = "ButtonAdd"; - this.ButtonAdd.Size = new System.Drawing.Size(106, 28); - this.ButtonAdd.TabIndex = 1; - this.ButtonAdd.Text = "Добавить"; - this.ButtonAdd.UseVisualStyleBackColor = true; - this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click); - // - // ButtonSave - // - this.ButtonSave.Location = new System.Drawing.Point(354, 415); - this.ButtonSave.Name = "ButtonSave"; - this.ButtonSave.Size = new System.Drawing.Size(75, 23); - this.ButtonSave.TabIndex = 5; - this.ButtonSave.Text = "Сохранить"; - this.ButtonSave.UseVisualStyleBackColor = true; - this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click); - // - // ButtonCancel - // - this.ButtonCancel.Location = new System.Drawing.Point(435, 415); - this.ButtonCancel.Name = "ButtonCancel"; - this.ButtonCancel.Size = new System.Drawing.Size(75, 23); - this.ButtonCancel.TabIndex = 6; - this.ButtonCancel.Text = "Отмена"; - this.ButtonCancel.UseVisualStyleBackColor = true; - this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + dataGridView.BackgroundColor = SystemColors.ButtonHighlight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, ComponentName, Count }); + dataGridView.Location = new Point(0, 21); + dataGridView.Name = "dataGridView"; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(394, 311); + dataGridView.TabIndex = 5; // // ID // - this.ID.HeaderText = "Id"; - this.ID.Name = "ID"; - this.ID.Visible = false; - this.ID.Width = 250; + ID.HeaderText = "Id"; + ID.Name = "ID"; + ID.Visible = false; + ID.Width = 250; // // ComponentName // - this.ComponentName.HeaderText = "Компоненте"; - this.ComponentName.Name = "ComponentName"; - this.ComponentName.Width = 250; + ComponentName.HeaderText = "Компоненте"; + ComponentName.Name = "ComponentName"; + ComponentName.Width = 250; // // Count // - this.Count.HeaderText = "Количество"; - this.Count.Name = "Count"; + Count.HeaderText = "Количество"; + Count.Name = "Count"; + // + // ButtonRef + // + ButtonRef.Location = new Point(400, 169); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(106, 28); + ButtonRef.TabIndex = 4; + ButtonRef.Text = "Обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; + // + // ButtonDel + // + ButtonDel.Location = new Point(400, 135); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(106, 28); + ButtonDel.TabIndex = 3; + ButtonDel.Text = "Удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonUpd + // + ButtonUpd.Location = new Point(400, 101); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(106, 28); + ButtonUpd.TabIndex = 2; + ButtonUpd.Text = "Изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; + // + // ButtonAdd + // + ButtonAdd.Location = new Point(400, 67); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(106, 28); + ButtonAdd.TabIndex = 1; + ButtonAdd.Text = "Добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // ButtonSave + // + ButtonSave.Location = new Point(354, 415); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(75, 23); + ButtonSave.TabIndex = 5; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(435, 415); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(75, 23); + ButtonCancel.TabIndex = 6; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; // // FormWood // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(536, 450); - this.Controls.Add(this.ButtonCancel); - this.Controls.Add(this.ButtonSave); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.textBoxPrice); - this.Controls.Add(this.textBoxName); - this.Controls.Add(this.labelPrice); - this.Controls.Add(this.labelName); - this.Name = "FormWood"; - this.Text = "Создание набора"; - this.Load += new System.EventHandler(this.FormWood_Load); - this.groupBox1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(536, 450); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(groupBox1); + Controls.Add(textBoxPrice); + Controls.Add(textBoxName); + Controls.Add(labelPrice); + Controls.Add(labelName); + Name = "FormWood"; + Text = "Создание изделия"; + Load += FormWood_Load; + groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); } #endregion diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWood.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.resx index 1af7de1..af32865 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormWood.resx +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWood.resx @@ -1,17 +1,17 @@  - diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs index ed2d6dd..da9a366 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.Designer.cs @@ -28,84 +28,84 @@ /// private void InitializeComponent() { - this.labelComponent = new System.Windows.Forms.Label(); - this.labelCount = new System.Windows.Forms.Label(); - this.textBoxCount = new System.Windows.Forms.TextBox(); - this.comboBoxComponent = new System.Windows.Forms.ComboBox(); - this.buttonCancel = new System.Windows.Forms.Button(); - this.buttonSave = new System.Windows.Forms.Button(); - this.SuspendLayout(); + labelComponent = new Label(); + labelCount = new Label(); + textBoxCount = new TextBox(); + comboBoxComponent = new ComboBox(); + buttonCancel = new Button(); + buttonSave = new Button(); + SuspendLayout(); // // labelComponent // - this.labelComponent.AutoSize = true; - this.labelComponent.Location = new System.Drawing.Point(12, 9); - this.labelComponent.Name = "labelComponent"; - this.labelComponent.Size = new System.Drawing.Size(76, 15); - this.labelComponent.TabIndex = 0; - this.labelComponent.Text = "Экипировка:"; + labelComponent.AutoSize = true; + labelComponent.Location = new Point(12, 9); + labelComponent.Name = "labelComponent"; + labelComponent.Size = new Size(72, 15); + labelComponent.TabIndex = 0; + labelComponent.Text = "Компонент:"; + labelComponent.Click += labelComponent_Click; // // labelCount // - this.labelCount.AutoSize = true; - this.labelCount.Location = new System.Drawing.Point(12, 37); - this.labelCount.Name = "labelCount"; - this.labelCount.Size = new System.Drawing.Size(75, 15); - this.labelCount.TabIndex = 1; - this.labelCount.Text = "Количество:"; + labelCount.AutoSize = true; + labelCount.Location = new Point(12, 37); + labelCount.Name = "labelCount"; + labelCount.Size = new Size(75, 15); + labelCount.TabIndex = 1; + labelCount.Text = "Количество:"; // // textBoxCount // - this.textBoxCount.Location = new System.Drawing.Point(90, 34); - this.textBoxCount.Name = "textBoxCount"; - this.textBoxCount.Size = new System.Drawing.Size(235, 23); - this.textBoxCount.TabIndex = 3; + textBoxCount.Location = new Point(90, 34); + textBoxCount.Name = "textBoxCount"; + textBoxCount.Size = new Size(235, 23); + textBoxCount.TabIndex = 3; // // comboBoxComponent // - this.comboBoxComponent.BackColor = System.Drawing.SystemColors.Window; - this.comboBoxComponent.FormattingEnabled = true; - this.comboBoxComponent.Location = new System.Drawing.Point(90, 6); - this.comboBoxComponent.Name = "comboBoxComponent"; - this.comboBoxComponent.Size = new System.Drawing.Size(235, 23); - this.comboBoxComponent.TabIndex = 4; + comboBoxComponent.BackColor = SystemColors.Window; + comboBoxComponent.FormattingEnabled = true; + comboBoxComponent.Location = new Point(90, 6); + comboBoxComponent.Name = "comboBoxComponent"; + comboBoxComponent.Size = new Size(235, 23); + comboBoxComponent.TabIndex = 4; // // buttonCancel // - this.buttonCancel.Location = new System.Drawing.Point(248, 63); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(75, 23); - this.buttonCancel.TabIndex = 5; - this.buttonCancel.Text = "Отмена"; - this.buttonCancel.UseVisualStyleBackColor = true; - this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + buttonCancel.Location = new Point(248, 63); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(75, 23); + buttonCancel.TabIndex = 5; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; // // buttonSave // - this.buttonSave.Location = new System.Drawing.Point(167, 63); - this.buttonSave.Name = "buttonSave"; - this.buttonSave.Size = new System.Drawing.Size(75, 23); - this.buttonSave.TabIndex = 6; - this.buttonSave.Text = "Сохранить"; - this.buttonSave.UseVisualStyleBackColor = true; - this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); + buttonSave.Location = new Point(167, 63); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(75, 23); + buttonSave.TabIndex = 6; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; // // FormWoodComponent // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(337, 97); - this.Controls.Add(this.buttonSave); - this.Controls.Add(this.buttonCancel); - this.Controls.Add(this.comboBoxComponent); - this.Controls.Add(this.textBoxCount); - this.Controls.Add(this.labelCount); - this.Controls.Add(this.labelComponent); - this.Name = "FormWoodComponent"; - this.Text = "экипировка набора"; - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(337, 97); + Controls.Add(buttonSave); + Controls.Add(buttonCancel); + Controls.Add(comboBoxComponent); + Controls.Add(textBoxCount); + Controls.Add(labelCount); + Controls.Add(labelComponent); + Name = "FormWoodComponent"; + Text = "Компонент"; + ResumeLayout(false); + PerformLayout(); } #endregion diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs index 9852882..f0573da 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.cs @@ -68,5 +68,10 @@ namespace CarpentryWorkshopView DialogResult = DialogResult.Cancel; Close(); } + + private void labelComponent_Click(object sender, EventArgs e) + { + + } } } diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.resx index 1af7de1..af32865 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.resx +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoodComponent.resx @@ -1,17 +1,17 @@  - diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs index 06e908f..2fb231f 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.Designer.cs @@ -28,80 +28,79 @@ /// private void InitializeComponent() { - this.dataGridView = new System.Windows.Forms.DataGridView(); - this.ButtonAdd = new System.Windows.Forms.Button(); - this.ButtonUpd = new System.Windows.Forms.Button(); - this.ButtonDel = new System.Windows.Forms.Button(); - this.ButtonRef = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - this.SuspendLayout(); + dataGridView = new DataGridView(); + ButtonAdd = new Button(); + ButtonUpd = new Button(); + ButtonDel = new Button(); + ButtonRef = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); // // dataGridView // - this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Location = new System.Drawing.Point(0, 0); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowTemplate.Height = 25; - this.dataGridView.Size = new System.Drawing.Size(509, 448); - this.dataGridView.TabIndex = 0; + dataGridView.BackgroundColor = SystemColors.ButtonHighlight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 0); + dataGridView.Name = "dataGridView"; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(509, 448); + dataGridView.TabIndex = 0; // // ButtonAdd // - this.ButtonAdd.Location = new System.Drawing.Point(526, 12); - this.ButtonAdd.Name = "ButtonAdd"; - this.ButtonAdd.Size = new System.Drawing.Size(127, 23); - this.ButtonAdd.TabIndex = 1; - this.ButtonAdd.Text = "Добавить"; - this.ButtonAdd.UseVisualStyleBackColor = true; - this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click); + ButtonAdd.Location = new Point(526, 12); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(127, 23); + ButtonAdd.TabIndex = 1; + ButtonAdd.Text = "Добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; // // ButtonUpd // - this.ButtonUpd.Location = new System.Drawing.Point(526, 41); - this.ButtonUpd.Name = "ButtonUpd"; - this.ButtonUpd.Size = new System.Drawing.Size(127, 23); - this.ButtonUpd.TabIndex = 2; - this.ButtonUpd.Text = "Изменить"; - this.ButtonUpd.UseVisualStyleBackColor = true; - this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click); + ButtonUpd.Location = new Point(526, 41); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(127, 23); + ButtonUpd.TabIndex = 2; + ButtonUpd.Text = "Изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; // // ButtonDel // - this.ButtonDel.Location = new System.Drawing.Point(526, 70); - this.ButtonDel.Name = "ButtonDel"; - this.ButtonDel.Size = new System.Drawing.Size(127, 23); - this.ButtonDel.TabIndex = 3; - this.ButtonDel.Text = "Удалить"; - this.ButtonDel.UseVisualStyleBackColor = true; - this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click); + ButtonDel.Location = new Point(526, 70); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(127, 23); + ButtonDel.TabIndex = 3; + ButtonDel.Text = "Удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; // // ButtonRef // - this.ButtonRef.Location = new System.Drawing.Point(526, 99); - this.ButtonRef.Name = "ButtonRef"; - this.ButtonRef.Size = new System.Drawing.Size(127, 23); - this.ButtonRef.TabIndex = 4; - this.ButtonRef.Text = "Обновить"; - this.ButtonRef.UseVisualStyleBackColor = true; - this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); + ButtonRef.Location = new Point(526, 99); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(127, 23); + ButtonRef.TabIndex = 4; + ButtonRef.Text = "Обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; // // FormWoods // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(668, 450); - this.Controls.Add(this.ButtonRef); - this.Controls.Add(this.ButtonDel); - this.Controls.Add(this.ButtonUpd); - this.Controls.Add(this.ButtonAdd); - this.Controls.Add(this.dataGridView); - this.Name = "FormWoods"; - this.Text = "Набор"; - this.Load += new System.EventHandler(this.FormWoods_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); - this.ResumeLayout(false); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(668, 450); + Controls.Add(ButtonRef); + Controls.Add(ButtonDel); + Controls.Add(ButtonUpd); + Controls.Add(ButtonAdd); + Controls.Add(dataGridView); + Name = "FormWoods"; + Text = "Изделия"; + Load += FormWoods_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); } #endregion diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx index f298a7b..af32865 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormWoods.resx @@ -1,4 +1,64 @@ - + + + -- 2.25.1