From db49f3847775ac96f516abdc579353428de991f7 Mon Sep 17 00:00:00 2001 From: dasha Date: Tue, 28 Mar 2023 17:32:55 +0400 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B8=D0=B7=D0=BD=D0=B5=D1=81-=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeautySaloon/BeautySaloon.sln | 6 + .../BeautySaloonBusinessLogic.csproj | 13 +++ .../BeautySaloonBusinessLogic/ClientLogic.cs | 103 +++++++++++++++++ .../EmployeeLogic.cs | 107 ++++++++++++++++++ .../BeautySaloonBusinessLogic/OrderLogic.cs | 63 +++++++++++ .../PositionLogic.cs | 95 ++++++++++++++++ .../BeautySaloonBusinessLogic/ServiceLogic.cs | 95 ++++++++++++++++ .../BeautySaloonContracts.csproj | 4 - .../BindingModels/OrderBindingModel.cs | 3 +- .../BusinessLogicsContracts/IOrderLogic.cs | 1 - .../StoragesContracts/IClientStorage.cs | 16 +++ .../StoragesContracts/IEmployeeStorage.cs | 16 +++ .../StoragesContracts/IOrderStorage.cs | 16 +++ .../StoragesContracts/IPositionStorage.cs | 16 +++ .../StoragesContracts/IServiceStorage.cs | 16 +++ .../ViewModels/OrderViewModel.cs | 6 +- .../BeautySaloonDataModels/IOrderModel.cs | 2 +- .../BeautySaloonView/BeautySaloonView.csproj | 10 ++ ...Form1.Designer.cs => FormMain.Designer.cs} | 2 +- .../{Form1.cs => FormMain.cs} | 4 +- .../{Form1.resx => FormMain.resx} | 0 BeautySaloon/BeautySaloonView/Program.cs | 31 ++++- 22 files changed, 613 insertions(+), 12 deletions(-) create mode 100644 BeautySaloon/BeautySaloonBusinessLogic/BeautySaloonBusinessLogic.csproj create mode 100644 BeautySaloon/BeautySaloonBusinessLogic/ClientLogic.cs create mode 100644 BeautySaloon/BeautySaloonBusinessLogic/EmployeeLogic.cs create mode 100644 BeautySaloon/BeautySaloonBusinessLogic/OrderLogic.cs create mode 100644 BeautySaloon/BeautySaloonBusinessLogic/PositionLogic.cs create mode 100644 BeautySaloon/BeautySaloonBusinessLogic/ServiceLogic.cs create mode 100644 BeautySaloon/BeautySaloonContracts/StoragesContracts/IClientStorage.cs create mode 100644 BeautySaloon/BeautySaloonContracts/StoragesContracts/IEmployeeStorage.cs create mode 100644 BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs create mode 100644 BeautySaloon/BeautySaloonContracts/StoragesContracts/IPositionStorage.cs create mode 100644 BeautySaloon/BeautySaloonContracts/StoragesContracts/IServiceStorage.cs rename BeautySaloon/BeautySaloonView/{Form1.Designer.cs => FormMain.Designer.cs} (97%) rename BeautySaloon/BeautySaloonView/{Form1.cs => FormMain.cs} (58%) rename BeautySaloon/BeautySaloonView/{Form1.resx => FormMain.resx} (100%) diff --git a/BeautySaloon/BeautySaloon.sln b/BeautySaloon/BeautySaloon.sln index 4c7abb8..a62677b 100644 --- a/BeautySaloon/BeautySaloon.sln +++ b/BeautySaloon/BeautySaloon.sln @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautySaloonDataModels", "B EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySaloonContracts", "BeautySaloonContracts\BeautySaloonContracts.csproj", "{7494D3AF-2581-4128-9183-BB87A9DC4B10}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySaloonBusinessLogic", "BeautySaloonBusinessLogic\BeautySaloonBusinessLogic.csproj", "{E43A1394-BC9A-430B-B984-BCCD828FFF45}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {7494D3AF-2581-4128-9183-BB87A9DC4B10}.Debug|Any CPU.Build.0 = Debug|Any CPU {7494D3AF-2581-4128-9183-BB87A9DC4B10}.Release|Any CPU.ActiveCfg = Release|Any CPU {7494D3AF-2581-4128-9183-BB87A9DC4B10}.Release|Any CPU.Build.0 = Release|Any CPU + {E43A1394-BC9A-430B-B984-BCCD828FFF45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E43A1394-BC9A-430B-B984-BCCD828FFF45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E43A1394-BC9A-430B-B984-BCCD828FFF45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E43A1394-BC9A-430B-B984-BCCD828FFF45}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BeautySaloon/BeautySaloonBusinessLogic/BeautySaloonBusinessLogic.csproj b/BeautySaloon/BeautySaloonBusinessLogic/BeautySaloonBusinessLogic.csproj new file mode 100644 index 0000000..e696bb1 --- /dev/null +++ b/BeautySaloon/BeautySaloonBusinessLogic/BeautySaloonBusinessLogic.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/BeautySaloon/BeautySaloonBusinessLogic/ClientLogic.cs b/BeautySaloon/BeautySaloonBusinessLogic/ClientLogic.cs new file mode 100644 index 0000000..c05fe09 --- /dev/null +++ b/BeautySaloon/BeautySaloonBusinessLogic/ClientLogic.cs @@ -0,0 +1,103 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.BusinessLogicsContracts; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonBusinessLogic +{ + public class ClientLogic : IClientLogic + { + private readonly IClientStorage _clientStorage; + public ClientLogic(IClientStorage clientStorage) + { + _clientStorage = clientStorage; + } + public bool Create(ClientBindingModel model) + { + CheckModel(model); + if (_clientStorage.Insert(model) == null) + { + return false; + } + return true; + } + + public bool Delete(ClientBindingModel model) + { + CheckModel(model, false); + if (_clientStorage.Delete(model) == null) + { + return false; + } + return true; + } + + public ClientViewModel? ReadElement(ClientSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + var element = _clientStorage.GetElement(model); + if (element == null) + { + return null; + } + return element; + } + + public List? ReadList(ClientSearchModel? model) + { + var list = model == null ? _clientStorage.GetFullList() : + _clientStorage.GetFilteredList(model); + if (list == null) + { + return null; + } + return list; + } + + public bool Update(ClientBindingModel model) + { + CheckModel(model); + if (_clientStorage.Update(model) == null) + { + return false; + } + return true; + } + + private void CheckModel(ClientBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.Name)) + { + throw new ArgumentNullException("Нет имени клиента", nameof(model.Name)); + } + if (string.IsNullOrEmpty(model.Surname)) + { + throw new ArgumentNullException("Нет фамилии клиента", nameof(model.Surname)); + } + if (string.IsNullOrEmpty(model.Phone)) + { + throw new ArgumentNullException("Нет телефона клиента", nameof(model.Phone)); + } + var element = _clientStorage.GetElement(new ClientSearchModel + { + Phone = model.Phone + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Клиент с таким номером телефона уже есть"); + } + } + } +} diff --git a/BeautySaloon/BeautySaloonBusinessLogic/EmployeeLogic.cs b/BeautySaloon/BeautySaloonBusinessLogic/EmployeeLogic.cs new file mode 100644 index 0000000..1b9b7f2 --- /dev/null +++ b/BeautySaloon/BeautySaloonBusinessLogic/EmployeeLogic.cs @@ -0,0 +1,107 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.BusinessLogicsContracts; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonBusinessLogic +{ + public class EmployeeLogic : IEmployeeLogic + { + private readonly IEmployeeStorage _employeeStorage; + public EmployeeLogic(IEmployeeStorage employeeStorage) + { + _employeeStorage = employeeStorage; + } + public bool Create(EmployeeBindingModel model) + { + CheckModel(model); + if (_employeeStorage.Insert(model) == null) + { + return false; + } + return true; + } + + public bool Delete(EmployeeBindingModel model) + { + CheckModel(model, false); + if (_employeeStorage.Delete(model) == null) + { + return false; + } + return true; + } + + public EmployeeViewModel? ReadElement(EmployeeSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + var element = _employeeStorage.GetElement(model); + if (element == null) + { + return null; + } + return element; + } + + public List? ReadList(EmployeeSearchModel? model) + { + var list = model == null ? _employeeStorage.GetFullList() : + _employeeStorage.GetFilteredList(model); + if (list == null) + { + return null; + } + return list; + } + + public bool Update(EmployeeBindingModel model) + { + CheckModel(model); + if (_employeeStorage.Update(model) == null) + { + return false; + } + return true; + } + + private void CheckModel(EmployeeBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.Name)) + { + throw new ArgumentNullException("Нет имени сотрудника", nameof(model.Name)); + } + if (string.IsNullOrEmpty(model.Surname)) + { + throw new ArgumentNullException("Нет фамилии сотрудника", nameof(model.Surname)); + } + if (string.IsNullOrEmpty(model.Phone)) + { + throw new ArgumentNullException("Нет телефона сотрудника", nameof(model.Phone)); + } + if (model.PositionId <= 0) + { + throw new ArgumentNullException("Некорректный идентификатор у должности", nameof(model.PositionId)); + } + var element = _employeeStorage.GetElement(new EmployeeSearchModel + { + Phone = model.Phone + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Сотрудник с таким номером телефона уже есть"); + } + } + } +} diff --git a/BeautySaloon/BeautySaloonBusinessLogic/OrderLogic.cs b/BeautySaloon/BeautySaloonBusinessLogic/OrderLogic.cs new file mode 100644 index 0000000..e7a40cc --- /dev/null +++ b/BeautySaloon/BeautySaloonBusinessLogic/OrderLogic.cs @@ -0,0 +1,63 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.BusinessLogicsContracts; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonBusinessLogic +{ + public class OrderLogic : IOrderLogic + { + private readonly IOrderStorage _orderStorage; + public OrderLogic(IOrderStorage orderStorage) + { + _orderStorage = orderStorage; + } + public bool CreateOrder(OrderBindingModel model) + { + CheckModel(model); + if (_orderStorage.Insert(model) == null) + { + return false; + } + return true; + } + + public List? ReadList(OrderSearchModel? model) + { + var list = model == null ? _orderStorage.GetFullList() : + _orderStorage.GetFilteredList(model); + if (list == null) + { + return null; + } + return list; + } + + private void CheckModel(OrderBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.Sum <= 0) + { + throw new ArgumentNullException("Сумма заказа должна быть больше 0", nameof(model.Sum)); + } + if (model.ClientId <= 0) + { + throw new ArgumentNullException("Некорректный идентификатор клиента", + nameof(model.ClientId)); + } + if (model.EmployeeId <= 0) + { + throw new ArgumentNullException("Некорректный идентификатор сотрудника", + nameof(model.ClientId)); + } + } + } +} diff --git a/BeautySaloon/BeautySaloonBusinessLogic/PositionLogic.cs b/BeautySaloon/BeautySaloonBusinessLogic/PositionLogic.cs new file mode 100644 index 0000000..8e21bbf --- /dev/null +++ b/BeautySaloon/BeautySaloonBusinessLogic/PositionLogic.cs @@ -0,0 +1,95 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.BusinessLogicsContracts; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonBusinessLogic +{ + public class PositionLogic : IPositionLogic + { + private readonly IPositionStorage _positionStorage; + public PositionLogic(IPositionStorage positionStorage) + { + _positionStorage = positionStorage; + } + public bool Create(PositionBindingModel model) + { + CheckModel(model); + if (_positionStorage.Insert(model) == null) + { + return false; + } + return true; + } + + public bool Delete(PositionBindingModel model) + { + CheckModel(model, false); + if (_positionStorage.Delete(model) == null) + { + return false; + } + return true; + } + + public PositionViewModel? ReadElement(PositionSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + var element = _positionStorage.GetElement(model); + if (element == null) + { + return null; + } + return element; + } + + public List? ReadList(PositionSearchModel? model) + { + var list = model == null ? _positionStorage.GetFullList() : + _positionStorage.GetFilteredList(model); + if (list == null) + { + return null; + } + return list; + } + + public bool Update(PositionBindingModel model) + { + CheckModel(model); + if (_positionStorage.Update(model) == null) + { + return false; + } + return true; + } + + private void CheckModel(PositionBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.Name)) + { + throw new ArgumentNullException("Нет названия у должности", nameof(model.Name)); + } + var element = _positionStorage.GetElement(new PositionSearchModel + { + Name = model.Name + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Должность с таким названием уже есть"); + } + } + } +} diff --git a/BeautySaloon/BeautySaloonBusinessLogic/ServiceLogic.cs b/BeautySaloon/BeautySaloonBusinessLogic/ServiceLogic.cs new file mode 100644 index 0000000..cd958b0 --- /dev/null +++ b/BeautySaloon/BeautySaloonBusinessLogic/ServiceLogic.cs @@ -0,0 +1,95 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.BusinessLogicsContracts; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonBusinessLogic +{ + public class ServiceLogic : IServiceLogic + { + private readonly IServiceStorage _serviceStorage; + public ServiceLogic(IServiceStorage serviceStorage) + { + _serviceStorage = serviceStorage; + } + public bool Create(ServiceBindingModel model) + { + CheckModel(model); + if (_serviceStorage.Insert(model) == null) + { + return false; + } + return true; + } + + public bool Delete(ServiceBindingModel model) + { + CheckModel(model, false); + if (_serviceStorage.Delete(model) == null) + { + return false; + } + return true; + } + + public ServiceViewModel? ReadElement(ServiceSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + var element = _serviceStorage.GetElement(model); + if (element == null) + { + return null; + } + return element; + } + + public List? ReadList(ServiceSearchModel? model) + { + var list = model == null ? _serviceStorage.GetFullList() : + _serviceStorage.GetFilteredList(model); + if (list == null) + { + return null; + } + return list; + } + + public bool Update(ServiceBindingModel model) + { + CheckModel(model); + if (_serviceStorage.Update(model) == null) + { + return false; + } + return true; + } + + private void CheckModel(ServiceBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.Name)) + { + throw new ArgumentNullException("Нет названия у услуги", nameof(model.Name)); + } + var element = _serviceStorage.GetElement(new ServiceSearchModel + { + Name = model.Name + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Услуга с таким названием уже есть"); + } + } + } +} diff --git a/BeautySaloon/BeautySaloonContracts/BeautySaloonContracts.csproj b/BeautySaloon/BeautySaloonContracts/BeautySaloonContracts.csproj index d72f66d..b46dcf3 100644 --- a/BeautySaloon/BeautySaloonContracts/BeautySaloonContracts.csproj +++ b/BeautySaloon/BeautySaloonContracts/BeautySaloonContracts.csproj @@ -6,10 +6,6 @@ enable - - - - diff --git a/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs b/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs index f951e04..fdd8ce7 100644 --- a/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs +++ b/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs @@ -9,7 +9,8 @@ namespace BeautySaloonContracts.BindingModels public double Sum { get; set; } public int ClientId { get; set; } public int EmployeeId { get; set; } - public Dictionary OrderServices + + public Dictionary OrderServices { get; set; diff --git a/BeautySaloon/BeautySaloonContracts/BusinessLogicsContracts/IOrderLogic.cs b/BeautySaloon/BeautySaloonContracts/BusinessLogicsContracts/IOrderLogic.cs index 8c365eb..afe1e2f 100644 --- a/BeautySaloon/BeautySaloonContracts/BusinessLogicsContracts/IOrderLogic.cs +++ b/BeautySaloon/BeautySaloonContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -7,7 +7,6 @@ namespace BeautySaloonContracts.BusinessLogicsContracts public interface IOrderLogic { List? ReadList(OrderSearchModel? model); - bool CreateOrder(OrderBindingModel model); } } diff --git a/BeautySaloon/BeautySaloonContracts/StoragesContracts/IClientStorage.cs b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IClientStorage.cs new file mode 100644 index 0000000..7250eb2 --- /dev/null +++ b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IClientStorage.cs @@ -0,0 +1,16 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonContracts.StoragesContracts +{ + public interface IClientStorage + { + List GetFullList(); + List GetFilteredList(ClientSearchModel model); + ClientViewModel? GetElement(ClientSearchModel model); + ClientViewModel? Insert(ClientBindingModel model); + ClientViewModel? Update(ClientBindingModel model); + ClientViewModel? Delete(ClientBindingModel model); + } +} diff --git a/BeautySaloon/BeautySaloonContracts/StoragesContracts/IEmployeeStorage.cs b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IEmployeeStorage.cs new file mode 100644 index 0000000..62a2815 --- /dev/null +++ b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IEmployeeStorage.cs @@ -0,0 +1,16 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonContracts.StoragesContracts +{ + public interface IEmployeeStorage + { + List GetFullList(); + List GetFilteredList(EmployeeSearchModel model); + EmployeeViewModel? GetElement(EmployeeSearchModel model); + EmployeeViewModel? Insert(EmployeeBindingModel model); + EmployeeViewModel? Update(EmployeeBindingModel model); + EmployeeViewModel? Delete(EmployeeBindingModel model); + } +} diff --git a/BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..62d474c --- /dev/null +++ b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,16 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonContracts.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/BeautySaloon/BeautySaloonContracts/StoragesContracts/IPositionStorage.cs b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IPositionStorage.cs new file mode 100644 index 0000000..a6c8335 --- /dev/null +++ b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IPositionStorage.cs @@ -0,0 +1,16 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonContracts.StoragesContracts +{ + public interface IPositionStorage + { + List GetFullList(); + List GetFilteredList(PositionSearchModel model); + PositionViewModel? GetElement(PositionSearchModel model); + PositionViewModel? Insert(PositionBindingModel model); + PositionViewModel? Update(PositionBindingModel model); + PositionViewModel? Delete(PositionBindingModel model); + } +} diff --git a/BeautySaloon/BeautySaloonContracts/StoragesContracts/IServiceStorage.cs b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IServiceStorage.cs new file mode 100644 index 0000000..adb6b8a --- /dev/null +++ b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IServiceStorage.cs @@ -0,0 +1,16 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonContracts.StoragesContracts +{ + public interface IServiceStorage + { + List GetFullList(); + List GetFilteredList(ServiceSearchModel model); + ServiceViewModel? GetElement(ServiceSearchModel model); + ServiceViewModel? Insert(ServiceBindingModel model); + ServiceViewModel? Update(ServiceBindingModel model); + ServiceViewModel? Delete(ServiceBindingModel model); + } +} diff --git a/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs b/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs index 0f249f0..460c753 100644 --- a/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs +++ b/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs @@ -17,6 +17,10 @@ namespace BeautySaloonContracts.ViewModels public int EmployeeId { get; set; } [DisplayName("Продавец")] public string EmployeeName { get; set; } = string.Empty; - public Dictionary OrderServices { get; set; } = new(); + public Dictionary OrderServices + { + get; + set; + } = new(); } } diff --git a/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs b/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs index b2bbaf2..810ff4c 100644 --- a/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs +++ b/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs @@ -7,6 +7,6 @@ double Sum { get; } int ClientId { get; } int EmployeeId { get; } - Dictionary OrderServices { get; } + Dictionary OrderServices { get; } } } diff --git a/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj b/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj index b57c89e..9200065 100644 --- a/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj +++ b/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj @@ -8,4 +8,14 @@ enable + + + + + + + + + + \ No newline at end of file diff --git a/BeautySaloon/BeautySaloonView/Form1.Designer.cs b/BeautySaloon/BeautySaloonView/FormMain.Designer.cs similarity index 97% rename from BeautySaloon/BeautySaloonView/Form1.Designer.cs rename to BeautySaloon/BeautySaloonView/FormMain.Designer.cs index bba430b..b874383 100644 --- a/BeautySaloon/BeautySaloonView/Form1.Designer.cs +++ b/BeautySaloon/BeautySaloonView/FormMain.Designer.cs @@ -1,6 +1,6 @@ namespace BeautySaloonView { - partial class Form1 + partial class FormMain { /// /// Required designer variable. diff --git a/BeautySaloon/BeautySaloonView/Form1.cs b/BeautySaloon/BeautySaloonView/FormMain.cs similarity index 58% rename from BeautySaloon/BeautySaloonView/Form1.cs rename to BeautySaloon/BeautySaloonView/FormMain.cs index feebdb1..bfc866b 100644 --- a/BeautySaloon/BeautySaloonView/Form1.cs +++ b/BeautySaloon/BeautySaloonView/FormMain.cs @@ -1,8 +1,8 @@ namespace BeautySaloonView { - public partial class Form1 : Form + public partial class FormMain : Form { - public Form1() + public FormMain() { InitializeComponent(); } diff --git a/BeautySaloon/BeautySaloonView/Form1.resx b/BeautySaloon/BeautySaloonView/FormMain.resx similarity index 100% rename from BeautySaloon/BeautySaloonView/Form1.resx rename to BeautySaloon/BeautySaloonView/FormMain.resx diff --git a/BeautySaloon/BeautySaloonView/Program.cs b/BeautySaloon/BeautySaloonView/Program.cs index 1545c43..a08a70e 100644 --- a/BeautySaloon/BeautySaloonView/Program.cs +++ b/BeautySaloon/BeautySaloonView/Program.cs @@ -1,7 +1,14 @@ +using BeautySaloonBusinessLogic; +using BeautySaloonContracts.BusinessLogicsContracts; +using BeautySaloonContracts.StoragesContracts; +using Microsoft.Extensions.DependencyInjection; + namespace BeautySaloonView { internal static class Program { + private static ServiceProvider? _serviceProvider; + public static ServiceProvider? ServiceProvider => _serviceProvider; /// /// The main entry point for the application. /// @@ -11,7 +18,29 @@ namespace BeautySaloonView // 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.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