From 90e721c13512c984c7a39a6d672f629f38d1f62f Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Tue, 4 Apr 2023 15:17:26 +0400 Subject: [PATCH] =?UTF-8?q?Revert=20"=D0=9F=D1=80=D0=BE=D0=BC=D0=B5=D0=B6?= =?UTF-8?q?=D1=83=D1=82=D0=BE=D1=87=D0=BD=D1=8B=D0=B5=20=D1=81=D0=BE=D1=85?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F.=20=D0=AD=D1=82?= =?UTF-8?q?=D0=BE=20=D0=BA=D0=B0=D0=BF=D0=B5=D1=86"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1d73cccb0dbb8a68b89526e6d1b19a5bd4741fd9. --- .../Controllers/ImplementerController.cs | 16 ++++----- .../BlackmithWorkshopRestApi/Program.cs | 4 +-- .../BlacksmithWorkshop - Backup.csproj | 33 ------------------- .../BusinessLogic/WorkModeling.cs | 12 +++---- .../BindingModels/ImplementerBindingModel.cs | 22 ------------- .../IImplementerLogic.cs | 23 ------------- .../BusinessLogicsContracts/IWorkProcess.cs | 2 +- .../ViewModels/ImplementerViewModel.cs | 27 --------------- .../Models/IImplementerModel.cs | 5 +-- 9 files changed, 20 insertions(+), 124 deletions(-) delete mode 100644 BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop - Backup.csproj delete mode 100644 BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ImplementerBindingModel.cs delete mode 100644 BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IImplementerLogic.cs delete mode 100644 BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs rename BlacksmithWorkshop/{BlacksmithWorkshopDataModels => BlacksmithWorkshopDatabaseImplement}/Models/IImplementerModel.cs (74%) diff --git a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ImplementerController.cs b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ImplementerController.cs index 29e7a7a..6dc96c7 100644 --- a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ImplementerController.cs +++ b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ImplementerController.cs @@ -8,15 +8,15 @@ namespace BlacksmithWorkshopRestApi.Controllers { [Route("api/[controller]/[action]")] [ApiController] - public class ClientController : Controller + public class ImplementerController : Controller { private readonly ILogger _logger; private readonly IOrderLogic _order; - private readonly IClientLogic _logic; + private readonly IImplementerLogic _logic; - public ClientController(IOrderLogic order, IClientLogic logic, ILogger logger) + public ImplementerController(IOrderLogic order, IImplementerLogic logic, ILogger logger) { _logger = logger; _order = order; @@ -24,13 +24,13 @@ namespace BlacksmithWorkshopRestApi.Controllers } [HttpGet] - public ClientViewModel? Login(string login, string password) + public ImplementerViewModel? Login(string login, string password) { try { - return _logic.ReadElement(new ClientSearchModel + return _logic.ReadElement(new ImplementerSearchModel { - ClientFIO = login, + ImplementerFIO = login, Password = password }); } @@ -61,13 +61,13 @@ namespace BlacksmithWorkshopRestApi.Controllers } [HttpGet] - public OrderViewModel? GetClientOrder(int implementerId) + public OrderViewModel? GetImplementerOrder(int implementerId) { try { return _order.ReadElement(new OrderSearchModel { - ClientId = implementerId + ImplementerId = implementerId }); } catch (Exception ex) diff --git a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs index 4fc3bb6..017ef90 100644 --- a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs +++ b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs @@ -14,12 +14,12 @@ builder.Logging.AddLog4Net("log4net.config"); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); -builder.Services.AddTransient(); +builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); -builder.Services.AddTransient(); +builder.Services.AddTransient(); builder.Services.AddControllers(); diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop - Backup.csproj b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop - Backup.csproj deleted file mode 100644 index 6707010..0000000 --- a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop - Backup.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - WinExe - net6.0-windows - enable - true - enable - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/WorkModeling.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/WorkModeling.cs index fb2486b..624637f 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/WorkModeling.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/WorkModeling.cs @@ -26,14 +26,14 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic _rnd = new Random(1000); } - public void DoWork(IClientLogic implementerLogic, IOrderLogic orderLogic) + public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic) { _orderLogic = orderLogic; var implementers = implementerLogic.ReadList(null); if (implementers == null) { - _logger.LogWarning("DoWork. Clients is null"); + _logger.LogWarning("DoWork. Implementers is null"); return; } @@ -56,7 +56,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } // Иммитация работы исполнителя - private async Task WorkerWorkAsync(ClientViewModel implementer, List orders) + private async Task WorkerWorkAsync(ImplementerViewModel implementer, List orders) { if (_orderLogic == null || implementer == null) { @@ -77,7 +77,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = order.Id, - ClientId = implementer.Id + ImplementerId = implementer.Id }); // делаем работу @@ -108,7 +108,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //Ищем заказ, которые уже в работе (вдруг исполнителя прервали) - private async Task RunOrderInWork(ClientViewModel implementer) + private async Task RunOrderInWork(ImplementerViewModel implementer) { if (_orderLogic == null || implementer == null) { @@ -119,7 +119,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic { var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel { - ClientId = implementer.Id, + ImplementerId = implementer.Id, Status = OrderStatus.Выполняется })); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ImplementerBindingModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ImplementerBindingModel.cs deleted file mode 100644 index e26ac44..0000000 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ImplementerBindingModel.cs +++ /dev/null @@ -1,22 +0,0 @@ -using BlacksmithWorkshopDataModels.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BlacksmithWorkshopContracts.BindingModels -{ - public class ImplementerBindingModel : IImplementerModel - { - public int Id { get; set; } - - public string ImplementerFIO { get; set; } = string.Empty; - - public string Password { get; set; } = string.Empty; - - public int WorkExperience { get; set; } - - public int Qualification { get; set; } - } -} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IImplementerLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IImplementerLogic.cs deleted file mode 100644 index da12fb6..0000000 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IImplementerLogic.cs +++ /dev/null @@ -1,23 +0,0 @@ -using BlacksmithWorkshopContracts.BindingModels; -using BlacksmithWorkshopContracts.ViewModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BlacksmithWorkshopContracts.BusinessLogicsContracts -{ - public interface IImplementerLogic - { - List? ReadList(ImplementerSearchModel? model); - - ImplementerViewModel? ReadElement(ImplementerSearchModel model); - - bool Create(ImplementerBindingModel model); - - bool Update(ImplementerBindingModel model); - - bool Delete(ImplementerBindingModel model); - } -} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IWorkProcess.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IWorkProcess.cs index 0d72949..812fdaf 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IWorkProcess.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IWorkProcess.cs @@ -10,6 +10,6 @@ namespace BlacksmithWorkshopContracts.BusinessLogicsContracts public interface IWorkProcess { // Запуск работ - void DoWork(IClientLogic implementerLogic, IOrderLogic orderLogic); + void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs deleted file mode 100644 index 2554098..0000000 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs +++ /dev/null @@ -1,27 +0,0 @@ -using BlacksmithWorkshopDataModels.Models; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BlacksmithWorkshopContracts.ViewModels -{ - public class ImplementerViewModel : IImplementerModel - { - public int Id { get; set; } - - [DisplayName("ФИО исполнителя")] - public string ImplementerFIO { get; set; } = string.Empty; - - [DisplayName("Пароль")] - public string Password { get; set; } = string.Empty; - - [DisplayName("Стаж")] - public int WorkExperience { get; set; } - - [DisplayName("Квалификация")] - public int Qualification { get; set; } - } -} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IImplementerModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/IImplementerModel.cs similarity index 74% rename from BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IImplementerModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/IImplementerModel.cs index 9ac63d5..f00bc19 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IImplementerModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/IImplementerModel.cs @@ -1,10 +1,11 @@ -using System; +using BlacksmithWorkshopDataModels; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BlacksmithWorkshopDataModels.Models +namespace BlacksmithWorkshopDatabaseImplement.Models { //модель исполнителя public interface IImplementerModel : IId