слияние
This commit is contained in:
commit
e8c530921a
@ -0,0 +1,123 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace PlumbingRepairBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class ImplementerLogic : IImplementerLogic
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IImplementerStorage _implementerStorage;
|
||||||
|
|
||||||
|
public ImplementerLogic(ILogger<ComponentLogic> logger, IImplementerStorage implementerStorage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_implementerStorage = implementerStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("ReadList. ImplementerFIO:{ImplementerFIO}. Id:{Id}", model?.ImplementerFIO, model?.Id);
|
||||||
|
var list = model == null ? _implementerStorage.GetFullList() : _implementerStorage.GetFilteredList(model);
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? ReadElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement. ImplementerFIO:{ImplementerFIO}. Id:{Id}", model.ImplementerFIO, model.Id);
|
||||||
|
var element = _implementerStorage.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(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_implementerStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_implementerStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Update operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||||
|
if (_implementerStorage.Delete(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Delete operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckModel(ImplementerBindingModel model, bool withParams = true)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
if (!withParams)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет ФИО клиента", nameof(model.ImplementerFIO));
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.Password))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет пароля клиента", nameof(model.Password));
|
||||||
|
}
|
||||||
|
if (model.Qualification <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Квалификация должна быть больше 0", nameof(model.Qualification));
|
||||||
|
}
|
||||||
|
if (model.WorkExperience <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Стаж работы должен быть больше 0", nameof(model.WorkExperience));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Component. ImplementerFIO:{ImplementerFIO}.Password:{Password}.Qualification:{Qualification}.WorkExperience:{WorkExperience}.", model.ImplementerFIO, model.Password, model.Qualification, model.WorkExperience);
|
||||||
|
var element = _implementerStorage.GetElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
ImplementerFIO = model.ImplementerFIO
|
||||||
|
});
|
||||||
|
if (element != null && element.Id != model.Id)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Клиент с таким ФИО уже есть");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ using PlumbingRepairContracts.ViewModels;
|
|||||||
using PlumbingRepairContracts.StoragesContracts;
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
using PlumbingRepairDataModels.Enums;
|
using PlumbingRepairDataModels.Enums;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
|
||||||
namespace PlumbingRepairBusinessLogic.BusinessLogics
|
namespace PlumbingRepairBusinessLogic.BusinessLogics
|
||||||
@ -14,10 +15,16 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
<<<<<<< HEAD
|
||||||
private readonly IShopStorage _shopStorage;
|
private readonly IShopStorage _shopStorage;
|
||||||
private readonly IWorkStorage _workStorage;
|
private readonly IWorkStorage _workStorage;
|
||||||
private readonly IShopLogic _shopLogic;
|
private readonly IShopLogic _shopLogic;
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IWorkStorage workStorage, IShopLogic shopLogic)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IWorkStorage workStorage, IShopLogic shopLogic)
|
||||||
|
=======
|
||||||
|
private readonly object _locker =new();
|
||||||
|
|
||||||
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||||
|
>>>>>>> lab_6
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
@ -25,6 +32,23 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
_workStorage = workStorage;
|
_workStorage = workStorage;
|
||||||
_shopLogic = shopLogic;
|
_shopLogic = shopLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement. DateFrom:{DateFrom}.DateTo:{DateTo}. Id:{Id}", model.DateFrom, model.DateTo, model.Id);
|
||||||
|
var element = _orderStorage.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 CreateOrder(OrderBindingModel model)
|
public bool CreateOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
@ -66,21 +90,22 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
lock (_locker)
|
||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public bool ChangeStatus(OrderBindingModel model, OrderStatus newStatus)
|
public bool ChangeStatus(OrderBindingModel model, OrderStatus newStatus)
|
||||||
{
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||||
if (viewModel == null)
|
if (viewModel == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
_logger.LogWarning("Find order failed");
|
||||||
}
|
|
||||||
if (viewModel.Status + 1 != newStatus)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Change status operation failed");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
if (newStatus == OrderStatus.Выдан)
|
if (newStatus == OrderStatus.Выдан)
|
||||||
{
|
{
|
||||||
var work = _workStorage.GetElement(new WorkSearchModel() { Id = viewModel.WorkId});
|
var work = _workStorage.GetElement(new WorkSearchModel() { Id = viewModel.WorkId});
|
||||||
@ -110,6 +135,16 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
_logger.LogWarning("Change status operation failed");
|
_logger.LogWarning("Change status operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
if (viewModel.Status != newStatus - 1)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Status change failed");
|
||||||
|
throw new InvalidOperationException("Невозможно перевести состояние заказа");
|
||||||
|
}
|
||||||
|
model.Status = newStatus;
|
||||||
|
if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now;
|
||||||
|
_orderStorage.Update(model);
|
||||||
|
>>>>>>> lab_6
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||||
|
@ -0,0 +1,146 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PlumbingRepairDataModels.Enums;
|
||||||
|
|
||||||
|
namespace PlumbingRepairBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class WorkModeling : IWorkProcess
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly Random _rnd;
|
||||||
|
|
||||||
|
private IOrderLogic? _orderLogic;
|
||||||
|
|
||||||
|
public WorkModeling(ILogger<WorkModeling> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_rnd = new Random(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
|
||||||
|
{
|
||||||
|
_orderLogic = orderLogic;
|
||||||
|
var implementers = implementerLogic.ReadList(null);
|
||||||
|
if (implementers == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("DoWork. Implementers is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят });
|
||||||
|
if (orders == null || orders.Count == 0)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("DoWork. Orders is null or empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
||||||
|
foreach (var implementer in implementers)
|
||||||
|
{
|
||||||
|
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Иммитация работы исполнителя
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="implementer"></param>
|
||||||
|
/// <param name="orders"></param>
|
||||||
|
private async Task WorkerWorkAsync(ImplementerViewModel implementer, List<OrderViewModel> orders)
|
||||||
|
{
|
||||||
|
if (_orderLogic == null || implementer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await RunOrderInWork(implementer);
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
foreach (var order in orders)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} try get order {Order}", implementer.Id, order.Id);
|
||||||
|
// пытаемся назначить заказ на исполнителя
|
||||||
|
_orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = order.Id,
|
||||||
|
ImplementerId = implementer.Id
|
||||||
|
});
|
||||||
|
// делаем работу
|
||||||
|
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
|
||||||
|
_orderLogic.FinishOrder(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = order.Id
|
||||||
|
});
|
||||||
|
// отдыхаем
|
||||||
|
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||||
|
}
|
||||||
|
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
||||||
|
catch (InvalidOperationException ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Error try get work");
|
||||||
|
}
|
||||||
|
// заканчиваем выполнение имитации в случае иной ошибки
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error while do work");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="implementer"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task RunOrderInWork(ImplementerViewModel implementer)
|
||||||
|
{
|
||||||
|
if (_orderLogic == null || implementer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
|
||||||
|
{
|
||||||
|
ImplementerId = implementer.Id,
|
||||||
|
Status = OrderStatus.Выполняется
|
||||||
|
}));
|
||||||
|
if (runOrder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
||||||
|
// доделываем работу
|
||||||
|
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, runOrder.Id);
|
||||||
|
_orderLogic.FinishOrder(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = runOrder.Id
|
||||||
|
});
|
||||||
|
// отдыхаем
|
||||||
|
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||||
|
}
|
||||||
|
// заказа может не быть, просто игнорируем ошибку
|
||||||
|
catch (InvalidOperationException ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Error try get work");
|
||||||
|
}
|
||||||
|
// а может возникнуть иная ошибка, тогда просто заканчиваем выполнение имитации
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error while do work");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.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; }
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ namespace PlumbingRepairContracts.BindingModels
|
|||||||
public int WorkId { get; set; }
|
public int WorkId { get; set; }
|
||||||
|
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
|
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IImplementerLogic
|
||||||
|
{
|
||||||
|
List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model);
|
||||||
|
|
||||||
|
ImplementerViewModel? ReadElement(ImplementerSearchModel model);
|
||||||
|
|
||||||
|
bool Create(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
bool Update(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(ImplementerBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ namespace PlumbingRepairContracts.BusinessLogicsContracts
|
|||||||
public interface IOrderLogic
|
public interface IOrderLogic
|
||||||
{
|
{
|
||||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||||
|
OrderViewModel? ReadElement(OrderSearchModel model);
|
||||||
|
|
||||||
bool CreateOrder(OrderBindingModel model);
|
bool CreateOrder(OrderBindingModel model);
|
||||||
|
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
namespace PlumbingRepairContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IWorkProcess
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Запуск работ
|
||||||
|
/// </summary>
|
||||||
|
void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace PlumbingRepairContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class ImplementerSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
public string? ImplementerFIO { get; set; }
|
||||||
|
|
||||||
|
public string? Password { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,14 @@
|
|||||||
namespace PlumbingRepairContracts.SearchModels
|
using PlumbingRepairDataModels.Enums;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.SearchModels
|
||||||
{
|
{
|
||||||
public class OrderSearchModel
|
public class OrderSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set;}
|
public DateTime? DateTo { get; set;}
|
||||||
|
public OrderStatus? Status { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IImplementerStorage
|
||||||
|
{
|
||||||
|
List<ImplementerViewModel> GetFullList();
|
||||||
|
|
||||||
|
List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? GetElement(ImplementerSearchModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? Insert(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? Update(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? Delete(ImplementerBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace PlumbingRepairContracts.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; }
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,11 @@ namespace PlumbingRepairContracts.ViewModels
|
|||||||
[DisplayName("ФИО клиента")]
|
[DisplayName("ФИО клиента")]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Исполнитель")]
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
|
[DisplayName("ФИО исполнителя")]
|
||||||
|
public string? ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
[DisplayName("Количество")]
|
[DisplayName("Количество")]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
namespace PlumbingRepairDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IImplementerModel : IId
|
||||||
|
{
|
||||||
|
string ImplementerFIO { get; }
|
||||||
|
string Password { get; }
|
||||||
|
int WorkExperience { get; }
|
||||||
|
int Qualification { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace PlumbingRepairDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class ImplementerStorage : IImplementerStorage
|
||||||
|
{
|
||||||
|
public List<ImplementerViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
return context.Implementers
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
return context.Implementers
|
||||||
|
.Where(x => x.ImplementerFIO.Contains(model.ImplementerFIO))
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
return context.Implementers
|
||||||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ImplementerFIO) && x.ImplementerFIO == model.ImplementerFIO) ||
|
||||||
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
var newImplementer = Implementer.Create(model);
|
||||||
|
if (newImplementer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
context.Implementers.Add(newImplementer);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newImplementer.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
var component = context.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (component == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
component.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return component.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
var element = context.Implementers.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Implementers.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,19 +29,21 @@ namespace PlumbingRepairDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new PlumbingRepairDatabase();
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
if (model.Id.HasValue)
|
||||||
return AttachNames(context.Orders
|
return AttachNames(context.Orders
|
||||||
.Include(x => x.Work)
|
.Include(x => x.Work)
|
||||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
||||||
?.GetViewModel);
|
?.GetViewModel);
|
||||||
|
else if (model.ImplementerId.HasValue && model.Status.HasValue)
|
||||||
|
return AttachNames(context.Orders
|
||||||
|
.Include(x => x.Implementer)
|
||||||
|
.FirstOrDefault(x => model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId)
|
||||||
|
?.GetViewModel);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue)
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
using var context = new PlumbingRepairDatabase();
|
using var context = new PlumbingRepairDatabase();
|
||||||
|
|
||||||
|
|
||||||
@ -51,6 +53,12 @@ namespace PlumbingRepairDatabaseImplement.Implements
|
|||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.Id == model.Id)
|
||||||
.Select(x => AttachNames(x.GetViewModel)).ToList();
|
.Select(x => AttachNames(x.GetViewModel)).ToList();
|
||||||
}
|
}
|
||||||
|
if (model.Status.HasValue)
|
||||||
|
{
|
||||||
|
return context.Orders
|
||||||
|
.Where(x => x.ImplementerId == model.ImplementerId && x.Status == model.Status)
|
||||||
|
.Select(x => AttachNames(x.GetViewModel)).ToList();
|
||||||
|
}
|
||||||
if (model.ClientId.HasValue)
|
if (model.ClientId.HasValue)
|
||||||
{
|
{
|
||||||
return context.Orders
|
return context.Orders
|
||||||
@ -58,11 +66,14 @@ namespace PlumbingRepairDatabaseImplement.Implements
|
|||||||
Where(x => x.ClientId == model.ClientId)
|
Where(x => x.ClientId == model.ClientId)
|
||||||
.Select(x =>AttachNames(x.GetViewModel)).ToList();
|
.Select(x =>AttachNames(x.GetViewModel)).ToList();
|
||||||
}
|
}
|
||||||
|
if (model.DateFrom != null && model.DateTo != null)
|
||||||
|
{
|
||||||
return context.Orders.
|
return context.Orders.
|
||||||
Include(x => x.Work)
|
Include(x => x.Work)
|
||||||
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
|
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
|
||||||
.Select(x => AttachNames(x.GetViewModel)).ToList();
|
.Select(x => AttachNames(x.GetViewModel)).ToList();
|
||||||
|
}
|
||||||
|
return new();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +82,7 @@ namespace PlumbingRepairDatabaseImplement.Implements
|
|||||||
using var context = new PlumbingRepairDatabase();
|
using var context = new PlumbingRepairDatabase();
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Work)
|
.Include(x => x.Work)
|
||||||
|
.Include(x => x.Implementer)
|
||||||
.Select(x =>AttachNames(x.GetViewModel))
|
.Select(x =>AttachNames(x.GetViewModel))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -124,6 +136,14 @@ namespace PlumbingRepairDatabaseImplement.Implements
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (var implementer in context.Implementers)
|
||||||
|
{
|
||||||
|
if (implementer.Id == model.ImplementerId)
|
||||||
|
{
|
||||||
|
model.ImplementerFIO = implementer.ImplementerFIO;
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
338
PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
generated
Normal file
338
PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
generated
Normal file
@ -0,0 +1,338 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using PlumbingRepairDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PlumbingRepairDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(PlumbingRepairDatabase))]
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
|
||||||
|
[Migration("20240501122640_InitCreate")]
|
||||||
|
========
|
||||||
|
[Migration("20240418172421_InitCreate")]
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
|
||||||
|
partial class InitCreate
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.27")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<string>("ClientFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<string>("ImplementerFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Qualification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkExperience")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Implementers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<int>("WorkId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
|
b.HasIndex("WorkId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<string>("Address")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOpening")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("ShopName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("maxCountWorks")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shops");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.ShopWork", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ShopId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ShopId");
|
||||||
|
|
||||||
|
b.HasIndex("WorkId");
|
||||||
|
|
||||||
|
b.ToTable("ShopWorks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<string>("WorkName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Works");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.WorkComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("WorkId");
|
||||||
|
|
||||||
|
b.ToTable("WorkComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("WorkId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
|
b.Navigation("Work");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.ShopWork", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Shop", "Shop")
|
||||||
|
.WithMany("Works")
|
||||||
|
.HasForeignKey("ShopId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("WorkId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Shop");
|
||||||
|
|
||||||
|
b.Navigation("Work");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.WorkComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("WorkComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("WorkId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Work");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("WorkComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Works");
|
||||||
|
========
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,241 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PlumbingRepairDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
public partial class InitCreate : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Components",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Cost = table.Column<double>(type: "float", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Components", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
|
||||||
|
name: "Shops",
|
||||||
|
========
|
||||||
|
name: "Implementers",
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
|
||||||
|
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
maxCountWorks = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||||
|
========
|
||||||
|
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
WorkExperience = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Qualification = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Implementers", x => x.Id);
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Works",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
WorkName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Price = table.Column<double>(type: "float", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Works", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Orders",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
WorkId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ImplementerId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Implementers_ImplementerId",
|
||||||
|
column: x => x.ImplementerId,
|
||||||
|
principalTable: "Implementers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Works_WorkId",
|
||||||
|
column: x => x.WorkId,
|
||||||
|
principalTable: "Works",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShopWorks",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
WorkId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShopWorks", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopWorks_Shops_ShopId",
|
||||||
|
column: x => x.ShopId,
|
||||||
|
principalTable: "Shops",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopWorks_Works_WorkId",
|
||||||
|
column: x => x.WorkId,
|
||||||
|
principalTable: "Works",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "WorkComponents",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
WorkId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ComponentId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_WorkComponents", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_WorkComponents_Components_ComponentId",
|
||||||
|
column: x => x.ComponentId,
|
||||||
|
principalTable: "Components",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_WorkComponents_Works_WorkId",
|
||||||
|
column: x => x.WorkId,
|
||||||
|
principalTable: "Works",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ImplementerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_WorkId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "WorkId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopWorks_ShopId",
|
||||||
|
table: "ShopWorks",
|
||||||
|
column: "ShopId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopWorks_WorkId",
|
||||||
|
table: "ShopWorks",
|
||||||
|
column: "WorkId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_WorkComponents_ComponentId",
|
||||||
|
table: "WorkComponents",
|
||||||
|
column: "ComponentId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_WorkComponents_WorkId",
|
||||||
|
table: "WorkComponents",
|
||||||
|
column: "WorkId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShopWorks");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "WorkComponents");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
|
||||||
|
name: "Shops");
|
||||||
|
========
|
||||||
|
name: "Implementers");
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Components");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Works");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,11 @@ using PlumbingRepairDatabaseImplement;
|
|||||||
namespace PlumbingRepairDatabaseImplement.Migrations
|
namespace PlumbingRepairDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PlumbingRepairDatabase))]
|
[DbContext(typeof(PlumbingRepairDatabase))]
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
|
||||||
[Migration("20240501122640_InitCreate")]
|
[Migration("20240501122640_InitCreate")]
|
||||||
|
========
|
||||||
|
[Migration("20240418172421_InitCreate")]
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
|
||||||
partial class InitCreate
|
partial class InitCreate
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -69,6 +73,33 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
b.ToTable("Components");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<string>("ImplementerFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Qualification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkExperience")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Implementers");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -89,6 +120,9 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -102,6 +136,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ClientId");
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
b.HasIndex("WorkId");
|
b.HasIndex("WorkId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
@ -214,6 +250,10 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("WorkId")
|
.HasForeignKey("WorkId")
|
||||||
@ -222,6 +262,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.Navigation("Client");
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
b.Navigation("Work");
|
b.Navigation("Work");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -273,9 +315,15 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
b.Navigation("WorkComponents");
|
b.Navigation("WorkComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.Designer.cs
|
||||||
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Works");
|
b.Navigation("Works");
|
||||||
|
========
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.Designer.cs
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
|
||||||
|
@ -39,11 +39,16 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
|
||||||
name: "Shops",
|
name: "Shops",
|
||||||
|
========
|
||||||
|
name: "Implementers",
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
|
||||||
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
|
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
@ -52,6 +57,16 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Shops", x => x.Id);
|
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||||
|
========
|
||||||
|
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
WorkExperience = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Qualification = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Implementers", x => x.Id);
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
@ -76,6 +91,7 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
WorkId = table.Column<int>(type: "int", nullable: false),
|
WorkId = table.Column<int>(type: "int", nullable: false),
|
||||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ImplementerId = table.Column<int>(type: "int", nullable: true),
|
||||||
Count = table.Column<int>(type: "int", nullable: false),
|
Count = table.Column<int>(type: "int", nullable: false),
|
||||||
Sum = table.Column<double>(type: "float", nullable: false),
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
Status = table.Column<int>(type: "int", nullable: false),
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
@ -91,6 +107,11 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
principalTable: "Clients",
|
principalTable: "Clients",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Implementers_ImplementerId",
|
||||||
|
column: x => x.ImplementerId,
|
||||||
|
principalTable: "Implementers",
|
||||||
|
principalColumn: "Id");
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Orders_Works_WorkId",
|
name: "FK_Orders_Works_WorkId",
|
||||||
column: x => x.WorkId,
|
column: x => x.WorkId,
|
||||||
@ -158,6 +179,11 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
table: "Orders",
|
table: "Orders",
|
||||||
column: "ClientId");
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ImplementerId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Orders_WorkId",
|
name: "IX_Orders_WorkId",
|
||||||
table: "Orders",
|
table: "Orders",
|
||||||
@ -199,7 +225,11 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
name: "Clients");
|
name: "Clients");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
|
<<<<<<<< HEAD:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240501122640_InitCreate.cs
|
||||||
name: "Shops");
|
name: "Shops");
|
||||||
|
========
|
||||||
|
name: "Implementers");
|
||||||
|
>>>>>>>> lab_6:PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240418172421_InitCreate.cs
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Components");
|
name: "Components");
|
||||||
|
@ -67,6 +67,33 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
b.ToTable("Components");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<string>("ImplementerFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Qualification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkExperience")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Implementers");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -87,6 +114,9 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -100,6 +130,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ClientId");
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
b.HasIndex("WorkId");
|
b.HasIndex("WorkId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
@ -212,6 +244,10 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
|
b.HasOne("PlumbingRepairDatabaseImplement.Models.Work", "Work")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("WorkId")
|
.HasForeignKey("WorkId")
|
||||||
@ -220,6 +256,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.Navigation("Client");
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
b.Navigation("Work");
|
b.Navigation("Work");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -271,9 +309,15 @@ namespace PlumbingRepairDatabaseImplement.Migrations
|
|||||||
b.Navigation("WorkComponents");
|
b.Navigation("WorkComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Shop", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Works");
|
b.Navigation("Works");
|
||||||
|
=======
|
||||||
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
>>>>>>> lab_6
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
|
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Work", b =>
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace PlumbingRepairDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Implementer : IImplementerModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ImplementerFIO { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Password { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int WorkExperience { get; private set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int Qualification { get; private set; }
|
||||||
|
|
||||||
|
[ForeignKey("ImplementerId")]
|
||||||
|
public virtual List<Order> Orders{ get; set; } = new();
|
||||||
|
|
||||||
|
public static Implementer? Create(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Implementer()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ImplementerFIO = model.ImplementerFIO,
|
||||||
|
Password = model.Password,
|
||||||
|
WorkExperience = model.WorkExperience,
|
||||||
|
Qualification = model.Qualification,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Implementer Create(ImplementerViewModel model)
|
||||||
|
{
|
||||||
|
return new Implementer
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ImplementerFIO = model.ImplementerFIO,
|
||||||
|
Password = model.Password,
|
||||||
|
WorkExperience = model.WorkExperience,
|
||||||
|
Qualification = model.Qualification,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImplementerFIO = model.ImplementerFIO;
|
||||||
|
Password = model.Password;
|
||||||
|
WorkExperience = model.WorkExperience;
|
||||||
|
Qualification = model.Qualification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ImplementerFIO = ImplementerFIO,
|
||||||
|
Password = Password,
|
||||||
|
WorkExperience = WorkExperience,
|
||||||
|
Qualification= Qualification,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ namespace PlumbingRepairDatabaseImplement.Models
|
|||||||
public int WorkId { get; set; }
|
public int WorkId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
@ -28,6 +29,7 @@ namespace PlumbingRepairDatabaseImplement.Models
|
|||||||
|
|
||||||
public virtual Work Work { get; set; }
|
public virtual Work Work { get; set; }
|
||||||
public virtual Client Client { get; set; }
|
public virtual Client Client { get; set; }
|
||||||
|
public virtual Implementer? Implementer { get; set; }
|
||||||
|
|
||||||
public static Order? Create( OrderBindingModel? model)
|
public static Order? Create( OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
@ -38,6 +40,7 @@ namespace PlumbingRepairDatabaseImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
WorkId = model.WorkId,
|
WorkId = model.WorkId,
|
||||||
ClientId = model.ClientId,
|
ClientId = model.ClientId,
|
||||||
|
ImplementerId = model.ImplementerId,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -52,12 +55,18 @@ namespace PlumbingRepairDatabaseImplement.Models
|
|||||||
return;
|
return;
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
|
if (model.ImplementerId.HasValue)
|
||||||
|
{
|
||||||
|
ImplementerId = model.ImplementerId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
WorkId = WorkId,
|
WorkId = WorkId,
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
|
ImplementerId= ImplementerId,
|
||||||
|
ImplementerFIO = Implementer == null ? null : Implementer.ImplementerFIO,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
|
@ -26,5 +26,6 @@ namespace PlumbingRepairDatabaseImplement
|
|||||||
|
|
||||||
public virtual DbSet<ShopWork> ShopWorks { set; get; }
|
public virtual DbSet<ShopWork> ShopWorks { set; get; }
|
||||||
public virtual DbSet<Client> Clients { set; get; }
|
public virtual DbSet<Client> Clients { set; get; }
|
||||||
|
public virtual DbSet<Implementer> Implementers { set; get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,6 +16,7 @@ namespace PlumbingRepairFileImplement
|
|||||||
private readonly string ShopFileName = "Shop.xml";
|
private readonly string ShopFileName = "Shop.xml";
|
||||||
|
|
||||||
private readonly string ClientFileName = "Client.xml";
|
private readonly string ClientFileName = "Client.xml";
|
||||||
|
private readonly string ImplementerFileName = "Implementer.xml";
|
||||||
public List<Component> Components { get; private set; }
|
public List<Component> Components { get; private set; }
|
||||||
|
|
||||||
public List<Order> Orders { get; private set; }
|
public List<Order> Orders { get; private set; }
|
||||||
@ -24,6 +25,7 @@ namespace PlumbingRepairFileImplement
|
|||||||
public List<Shop> Shops { get; private set; }
|
public List<Shop> Shops { get; private set; }
|
||||||
|
|
||||||
public List<Client> Clients { get; private set; }
|
public List<Client> Clients { get; private set; }
|
||||||
|
public List<Implementer> Implementers { get; private set; }
|
||||||
public static DataFileSingleton GetInstance()
|
public static DataFileSingleton GetInstance()
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
@ -41,6 +43,7 @@ namespace PlumbingRepairFileImplement
|
|||||||
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
|
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
|
||||||
|
|
||||||
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
|
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
|
||||||
|
public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement);
|
||||||
private DataFileSingleton()
|
private DataFileSingleton()
|
||||||
{
|
{
|
||||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||||
@ -48,6 +51,8 @@ namespace PlumbingRepairFileImplement
|
|||||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||||
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
|
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
|
||||||
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
||||||
|
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairFileImplement.Models;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace PlumbingRepairFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class ImplementerStorage : IImplementerStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton source;
|
||||||
|
|
||||||
|
public ImplementerStorage()
|
||||||
|
{
|
||||||
|
source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return source.Implementers
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return source.Implementers
|
||||||
|
.Where(x => x.ImplementerFIO.Contains(model.ImplementerFIO))
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return source.Implementers
|
||||||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ImplementerFIO) && x.ImplementerFIO == model.ImplementerFIO) ||
|
||||||
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = source.Implementers.Count > 0 ? source.Implementers.Max(x => x.Id) + 1 : 1;
|
||||||
|
var newImplementer = Implementer.Create(model);
|
||||||
|
if (newImplementer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
source.Implementers.Add(newImplementer);
|
||||||
|
source.SaveImplementers();
|
||||||
|
return newImplementer.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
var client = source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (client == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
client.Update(model);
|
||||||
|
source.SaveImplementers();
|
||||||
|
return client.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
var element = source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
source.Implementers.Remove(element);
|
||||||
|
source.SaveImplementers();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,11 @@ namespace PlumbingRepairFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (model.ImplementerId.HasValue && model.Status.HasValue)
|
||||||
|
return GetViewModel(source.Orders.FirstOrDefault(x => x.ImplementerId == model.ImplementerId && x.Status == model.Status));
|
||||||
|
if (model.Id.HasValue)
|
||||||
return GetViewModel(source.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id));
|
return GetViewModel(source.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id));
|
||||||
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,8 +51,11 @@ namespace PlumbingRepairFileImplement.Implements
|
|||||||
.ToList();
|
.ToList();
|
||||||
if (model.ClientId.HasValue)
|
if (model.ClientId.HasValue)
|
||||||
return source.Orders.Where(x => x.ClientId == model.ClientId).Select(x => GetViewModel(x)).ToList();
|
return source.Orders.Where(x => x.ClientId == model.ClientId).Select(x => GetViewModel(x)).ToList();
|
||||||
|
if (model.ImplementerId.HasValue && model.Status.HasValue)
|
||||||
|
return source.Orders.Where(x => x.ImplementerId == model.ImplementerId && x.Status == model.Status).Select(x => GetViewModel(x)).ToList();
|
||||||
return source.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).
|
return source.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).
|
||||||
Select(x => GetViewModel(x)).ToList();
|
Select(x => GetViewModel(x)).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
@ -92,6 +99,7 @@ namespace PlumbingRepairFileImplement.Implements
|
|||||||
{
|
{
|
||||||
viewModel.WorkName = work.WorkName;
|
viewModel.WorkName = work.WorkName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return viewModel;
|
return viewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace PlumbingRepairFileImplement.Models
|
||||||
|
{
|
||||||
|
internal class Implementer : IImplementerModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string ImplementerFIO { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Password { get; private set; } = string.Empty;
|
||||||
|
public int Qualification { get; private set; }
|
||||||
|
public int WorkExperience { get; private set; }
|
||||||
|
|
||||||
|
public static Implementer? Create(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Implementer()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ImplementerFIO = model.ImplementerFIO,
|
||||||
|
Password = model.Password,
|
||||||
|
Qualification = model.Qualification,
|
||||||
|
WorkExperience = model.WorkExperience,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Implementer? Create(XElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Implementer()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
|
ImplementerFIO = element.Element("ImplementerFIO")!.Value,
|
||||||
|
Password = Convert.ToString(element.Element("Password")!.Value),
|
||||||
|
Qualification = Convert.ToInt32(element.Attribute("Qualification")!.Value),
|
||||||
|
WorkExperience = Convert.ToInt32(element.Attribute("WorkExperience")!.Value),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImplementerFIO = model.ImplementerFIO;
|
||||||
|
Password = model.Password;
|
||||||
|
Qualification = model.Qualification;
|
||||||
|
WorkExperience = model.WorkExperience;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ImplementerFIO = ImplementerFIO,
|
||||||
|
Password = Password,
|
||||||
|
Qualification = Qualification,
|
||||||
|
WorkExperience = WorkExperience
|
||||||
|
};
|
||||||
|
|
||||||
|
public XElement GetXElement => new("Implementer",
|
||||||
|
new XAttribute("Id", Id),
|
||||||
|
new XElement("ImplementerFIO", ImplementerFIO),
|
||||||
|
new XElement("Password", Password),
|
||||||
|
new XElement("Qualification", Qualification),
|
||||||
|
new XElement("WorkExperience", WorkExperience)
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ namespace PlumbingRepairFileImplement.Models
|
|||||||
{
|
{
|
||||||
public int WorkId { get; private set; }
|
public int WorkId { get; private set; }
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
|
public int? ImplementerId { get; private set; }
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
@ -33,6 +34,8 @@ namespace PlumbingRepairFileImplement.Models
|
|||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
WorkId = model.WorkId,
|
WorkId = model.WorkId,
|
||||||
|
ClientId= model.ClientId,
|
||||||
|
ImplementerId = model.ImplementerId,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -52,6 +55,8 @@ namespace PlumbingRepairFileImplement.Models
|
|||||||
{
|
{
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
WorkId = Convert.ToInt32(element.Element("WorkId")!.Value),
|
WorkId = Convert.ToInt32(element.Element("WorkId")!.Value),
|
||||||
|
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
|
||||||
|
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")!.Value),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
|
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
|
||||||
@ -85,6 +90,8 @@ namespace PlumbingRepairFileImplement.Models
|
|||||||
"Order",
|
"Order",
|
||||||
new XAttribute("Id", Id),
|
new XAttribute("Id", Id),
|
||||||
new XElement("WorkId", WorkId.ToString()),
|
new XElement("WorkId", WorkId.ToString()),
|
||||||
|
new XElement("ClientId", ClientId.ToString()),
|
||||||
|
new XElement("ImplementerId", ImplementerId.ToString()),
|
||||||
new XElement("Count", Count.ToString()),
|
new XElement("Count", Count.ToString()),
|
||||||
new XElement("Sum", Sum.ToString()),
|
new XElement("Sum", Sum.ToString()),
|
||||||
new XElement("Status", Status.ToString()),
|
new XElement("Status", Status.ToString()),
|
||||||
|
@ -12,6 +12,8 @@ namespace PlumbingRepairListImplement
|
|||||||
|
|
||||||
public List<Work> Works { get; set; }
|
public List<Work> Works { get; set; }
|
||||||
public List<Client> Clients { get; set; }
|
public List<Client> Clients { get; set; }
|
||||||
|
public List<Implementer> Implementers { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public List<Shop> Shops { get; set; }
|
public List<Shop> Shops { get; set; }
|
||||||
|
|
||||||
@ -22,6 +24,7 @@ namespace PlumbingRepairListImplement
|
|||||||
Works = new List<Work>();
|
Works = new List<Work>();
|
||||||
Shops = new List<Shop>();
|
Shops = new List<Shop>();
|
||||||
Clients = new List<Client>();
|
Clients = new List<Client>();
|
||||||
|
Implementers = new List<Implementer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataListSingleton GetInstance()
|
public static DataListSingleton GetInstance()
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.StoragesContracts;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairListImplement.Models;
|
||||||
|
|
||||||
|
namespace PlumbingRepairListImplement.Implements
|
||||||
|
{
|
||||||
|
public class ImplementerStorage : IImplementerStorage
|
||||||
|
{
|
||||||
|
private readonly DataListSingleton _source;
|
||||||
|
|
||||||
|
public ImplementerStorage()
|
||||||
|
{
|
||||||
|
_source = DataListSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
var result = new List<ImplementerViewModel>();
|
||||||
|
foreach (var client in _source.Implementers)
|
||||||
|
{
|
||||||
|
result.Add(client.GetViewModel);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
var result = new List<ImplementerViewModel>();
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
foreach (var client in _source.Implementers)
|
||||||
|
{
|
||||||
|
if (client.ImplementerFIO.Contains(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
result.Add(client.GetViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
foreach (var client in _source.Implementers)
|
||||||
|
{
|
||||||
|
if ((!string.IsNullOrEmpty(model.ImplementerFIO) && client.ImplementerFIO == model.ImplementerFIO) ||
|
||||||
|
(model.Id.HasValue && client.Id == model.Id))
|
||||||
|
{
|
||||||
|
return client.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = 1;
|
||||||
|
foreach (var client in _source.Implementers)
|
||||||
|
{
|
||||||
|
if (model.Id <= client.Id)
|
||||||
|
{
|
||||||
|
model.Id = client.Id + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var newImplementer = Implementer.Create(model);
|
||||||
|
if (newImplementer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_source.Implementers.Add(newImplementer);
|
||||||
|
return newImplementer.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
foreach (var Implementer in _source.Implementers)
|
||||||
|
{
|
||||||
|
if (Implementer.Id == model.Id)
|
||||||
|
{
|
||||||
|
Implementer.Update(model);
|
||||||
|
return Implementer.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _source.Implementers.Count; ++i)
|
||||||
|
{
|
||||||
|
if (_source.Implementers[i].Id == model.Id)
|
||||||
|
{
|
||||||
|
var element = _source.Implementers[i];
|
||||||
|
_source.Implementers.RemoveAt(i);
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -41,6 +41,26 @@ namespace PlumbingRepairListImplement.Implements
|
|||||||
return AttachInfo(order.GetViewModel);
|
return AttachInfo(order.GetViewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (model.Id.HasValue)
|
||||||
|
{
|
||||||
|
foreach (var Order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (Order.Id == model.Id)
|
||||||
|
{
|
||||||
|
return Order.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (model.ImplementerId.HasValue && model.Status.HasValue)
|
||||||
|
{
|
||||||
|
foreach (var Order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (Order.ImplementerId == model.ImplementerId && Order.Status == model.Status)
|
||||||
|
{
|
||||||
|
return Order.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using PlumbingRepairDataModels.Models;
|
||||||
|
|
||||||
|
namespace PlumbingRepairListImplement.Models
|
||||||
|
{
|
||||||
|
internal class Implementer : IImplementerModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
public string ImplementerFIO { get; private set; } = string.Empty;
|
||||||
|
public string Password { get; private set; } = string.Empty;
|
||||||
|
public int Qualification { get; private set; }
|
||||||
|
public int WorkExperience { get; private set; }
|
||||||
|
public static Implementer? Create(ImplementerBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Implementer()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ImplementerFIO = model.ImplementerFIO,
|
||||||
|
Password = model.Password,
|
||||||
|
Qualification = model.Qualification,
|
||||||
|
WorkExperience = model.WorkExperience,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ImplementerBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImplementerFIO = model.ImplementerFIO;
|
||||||
|
Password = model.Password;
|
||||||
|
Qualification = model.Qualification;
|
||||||
|
WorkExperience = model.WorkExperience;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ImplementerFIO = ImplementerFIO,
|
||||||
|
Password = Password,
|
||||||
|
Qualification = Qualification,
|
||||||
|
WorkExperience = WorkExperience,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ namespace PlumbingRepairListImplement.Models
|
|||||||
{
|
{
|
||||||
public int WorkId { get; private set; }
|
public int WorkId { get; private set; }
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
|
public int? ImplementerId { get; private set; }
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ namespace PlumbingRepairListImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
WorkId = model.WorkId,
|
WorkId = model.WorkId,
|
||||||
ClientId = model.ClientId,
|
ClientId = model.ClientId,
|
||||||
|
ImplementerId = model.ImplementerId,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -50,6 +52,7 @@ namespace PlumbingRepairListImplement.Models
|
|||||||
}
|
}
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateImplement= model.DateImplement;
|
DateImplement= model.DateImplement;
|
||||||
|
ImplementerId= model.ImplementerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
@ -58,6 +61,7 @@ namespace PlumbingRepairListImplement.Models
|
|||||||
WorkId = WorkId,
|
WorkId = WorkId,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
ClientId= ClientId,
|
ClientId= ClientId,
|
||||||
|
ImplementerId = ImplementerId,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
|
@ -0,0 +1,107 @@
|
|||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using PlumbingRepairContracts.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using PlumbingRepairDataModels.Enums;
|
||||||
|
|
||||||
|
namespace PlumbingRepairRestApi.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
public class ImplementerController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IOrderLogic _order;
|
||||||
|
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
|
||||||
|
public ImplementerController(IOrderLogic order, IImplementerLogic logic, ILogger<ImplementerController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_order = order;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public ImplementerViewModel? Login(string login, string password)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _logic.ReadElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
ImplementerFIO = login,
|
||||||
|
Password = password
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка авторизации сотрудника");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public List<OrderViewModel>? GetNewOrders()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _order.ReadList(new OrderSearchModel
|
||||||
|
{
|
||||||
|
Status = OrderStatus.Принят
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения новых заказов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public OrderViewModel? GetImplementerOrder(int implementerId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _order.ReadElement(new OrderSearchModel
|
||||||
|
{
|
||||||
|
ImplementerId = implementerId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения текущего заказа исполнителя");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void TakeOrderInWork(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_order.TakeOrderInWork(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка перевода заказа с №{Id} в работу", model.Id);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void FinishOrder(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_order.FinishOrder(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отметки о готовности заказа с №{Id}", model.Id);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,12 +13,20 @@ builder.Logging.AddLog4Net("log4net.config");
|
|||||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
builder.Services.AddTransient<IWorkStorage, WorkStorage>();
|
builder.Services.AddTransient<IWorkStorage, WorkStorage>();
|
||||||
|
<<<<<<< HEAD
|
||||||
builder.Services.AddTransient<IShopStorage, ShopStorage>();
|
builder.Services.AddTransient<IShopStorage, ShopStorage>();
|
||||||
|
=======
|
||||||
|
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
>>>>>>> lab_6
|
||||||
|
|
||||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
builder.Services.AddTransient<IWorkLogic, WorkLogic>();
|
builder.Services.AddTransient<IWorkLogic, WorkLogic>();
|
||||||
|
<<<<<<< HEAD
|
||||||
builder.Services.AddTransient<IShopLogic, ShopLogic>();
|
builder.Services.AddTransient<IShopLogic, ShopLogic>();
|
||||||
|
=======
|
||||||
|
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
|
>>>>>>> lab_6
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
173
PlumbingRepair/PlumbingRepairView/FormImplementer.Designer.cs
generated
Normal file
173
PlumbingRepair/PlumbingRepairView/FormImplementer.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
namespace PlumbingRepairView
|
||||||
|
{
|
||||||
|
partial class FormImplementer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
||||||
|
this.labelPassword = new System.Windows.Forms.Label();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSave = new System.Windows.Forms.Button();
|
||||||
|
this.textBoxName = new System.Windows.Forms.TextBox();
|
||||||
|
this.labelImplementerFIO = new System.Windows.Forms.Label();
|
||||||
|
this.textBoxWorkExperience = new System.Windows.Forms.TextBox();
|
||||||
|
this.labelWorkExperience = new System.Windows.Forms.Label();
|
||||||
|
this.textBoxQualification = new System.Windows.Forms.TextBox();
|
||||||
|
this.labelQualification = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// textBoxPassword
|
||||||
|
//
|
||||||
|
this.textBoxPassword.Location = new System.Drawing.Point(138, 74);
|
||||||
|
this.textBoxPassword.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
|
this.textBoxPassword.Name = "textBoxPassword";
|
||||||
|
this.textBoxPassword.Size = new System.Drawing.Size(334, 31);
|
||||||
|
this.textBoxPassword.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// labelPassword
|
||||||
|
//
|
||||||
|
this.labelPassword.AutoSize = true;
|
||||||
|
this.labelPassword.Location = new System.Drawing.Point(4, 80);
|
||||||
|
this.labelPassword.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||||
|
this.labelPassword.Name = "labelPassword";
|
||||||
|
this.labelPassword.Size = new System.Drawing.Size(78, 25);
|
||||||
|
this.labelPassword.TabIndex = 14;
|
||||||
|
this.labelPassword.Text = "Пароль:";
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(346, 221);
|
||||||
|
this.buttonCancel.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(126, 45);
|
||||||
|
this.buttonCancel.TabIndex = 17;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
this.buttonSave.Location = new System.Drawing.Point(210, 221);
|
||||||
|
this.buttonSave.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
|
this.buttonSave.Name = "buttonSave";
|
||||||
|
this.buttonSave.Size = new System.Drawing.Size(126, 45);
|
||||||
|
this.buttonSave.TabIndex = 16;
|
||||||
|
this.buttonSave.Text = "Сохранить";
|
||||||
|
this.buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
this.textBoxName.Location = new System.Drawing.Point(138, 26);
|
||||||
|
this.textBoxName.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
|
this.textBoxName.Name = "textBoxName";
|
||||||
|
this.textBoxName.Size = new System.Drawing.Size(334, 31);
|
||||||
|
this.textBoxName.TabIndex = 13;
|
||||||
|
//
|
||||||
|
// labelImplementerFIO
|
||||||
|
//
|
||||||
|
this.labelImplementerFIO.AutoSize = true;
|
||||||
|
this.labelImplementerFIO.Location = new System.Drawing.Point(4, 32);
|
||||||
|
this.labelImplementerFIO.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||||
|
this.labelImplementerFIO.Name = "labelImplementerFIO";
|
||||||
|
this.labelImplementerFIO.Size = new System.Drawing.Size(56, 25);
|
||||||
|
this.labelImplementerFIO.TabIndex = 12;
|
||||||
|
this.labelImplementerFIO.Text = "ФИО:";
|
||||||
|
//
|
||||||
|
// textBoxWorkExperience
|
||||||
|
//
|
||||||
|
this.textBoxWorkExperience.Location = new System.Drawing.Point(138, 124);
|
||||||
|
this.textBoxWorkExperience.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
|
this.textBoxWorkExperience.Name = "textBoxWorkExperience";
|
||||||
|
this.textBoxWorkExperience.Size = new System.Drawing.Size(183, 31);
|
||||||
|
this.textBoxWorkExperience.TabIndex = 19;
|
||||||
|
//
|
||||||
|
// labelWorkExperience
|
||||||
|
//
|
||||||
|
this.labelWorkExperience.AutoSize = true;
|
||||||
|
this.labelWorkExperience.Location = new System.Drawing.Point(4, 130);
|
||||||
|
this.labelWorkExperience.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||||
|
this.labelWorkExperience.Name = "labelWorkExperience";
|
||||||
|
this.labelWorkExperience.Size = new System.Drawing.Size(122, 25);
|
||||||
|
this.labelWorkExperience.TabIndex = 18;
|
||||||
|
this.labelWorkExperience.Text = "Стаж работы:";
|
||||||
|
//
|
||||||
|
// textBoxQualification
|
||||||
|
//
|
||||||
|
this.textBoxQualification.Location = new System.Drawing.Point(138, 171);
|
||||||
|
this.textBoxQualification.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
|
this.textBoxQualification.Name = "textBoxQualification";
|
||||||
|
this.textBoxQualification.Size = new System.Drawing.Size(183, 31);
|
||||||
|
this.textBoxQualification.TabIndex = 21;
|
||||||
|
//
|
||||||
|
// labelQualification
|
||||||
|
//
|
||||||
|
this.labelQualification.AutoSize = true;
|
||||||
|
this.labelQualification.Location = new System.Drawing.Point(4, 171);
|
||||||
|
this.labelQualification.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||||
|
this.labelQualification.Name = "labelQualification";
|
||||||
|
this.labelQualification.Size = new System.Drawing.Size(134, 25);
|
||||||
|
this.labelQualification.TabIndex = 20;
|
||||||
|
this.labelQualification.Text = "Квалификация:";
|
||||||
|
//
|
||||||
|
// FormImplementer
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(485, 281);
|
||||||
|
this.Controls.Add(this.textBoxQualification);
|
||||||
|
this.Controls.Add(this.labelQualification);
|
||||||
|
this.Controls.Add(this.textBoxWorkExperience);
|
||||||
|
this.Controls.Add(this.labelWorkExperience);
|
||||||
|
this.Controls.Add(this.textBoxPassword);
|
||||||
|
this.Controls.Add(this.labelPassword);
|
||||||
|
this.Controls.Add(this.buttonCancel);
|
||||||
|
this.Controls.Add(this.buttonSave);
|
||||||
|
this.Controls.Add(this.textBoxName);
|
||||||
|
this.Controls.Add(this.labelImplementerFIO);
|
||||||
|
this.Name = "FormImplementer";
|
||||||
|
this.Text = "Исполнитель";
|
||||||
|
this.Load += new System.EventHandler(this.FormImplementer_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TextBox textBoxPassword;
|
||||||
|
private Label labelPassword;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private Label labelImplementerFIO;
|
||||||
|
private TextBox textBoxWorkExperience;
|
||||||
|
private Label labelWorkExperience;
|
||||||
|
private TextBox textBoxQualification;
|
||||||
|
private Label labelQualification;
|
||||||
|
}
|
||||||
|
}
|
104
PlumbingRepair/PlumbingRepairView/FormImplementer.cs
Normal file
104
PlumbingRepair/PlumbingRepairView/FormImplementer.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
|
||||||
|
namespace PlumbingRepairView
|
||||||
|
{
|
||||||
|
public partial class FormImplementer : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
|
||||||
|
private int? _id;
|
||||||
|
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
|
public FormImplementer(ILogger<FormImplementer> logger, IImplementerLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormImplementer_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение исполнителя");
|
||||||
|
var view = _logic.ReadElement(new ImplementerSearchModel { Id = _id.Value });
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
textBoxName.Text = view.ImplementerFIO;
|
||||||
|
textBoxPassword.Text = view.Password;
|
||||||
|
textBoxQualification.Text = view.Qualification.ToString();
|
||||||
|
textBoxWorkExperience.Text = view.WorkExperience.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;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxPassword.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните ФИО исполнителя", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxQualification.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните ФИО исполнителя", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxWorkExperience.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните ФИО исполнителя", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Сохранение исполнителя");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new ImplementerBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
ImplementerFIO = textBoxName.Text,
|
||||||
|
Password= textBoxPassword.Text,
|
||||||
|
WorkExperience = Convert.ToInt32(textBoxWorkExperience.Text),
|
||||||
|
Qualification = Convert.ToInt32(textBoxQualification.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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
PlumbingRepair/PlumbingRepairView/FormImplementer.resx
Normal file
60
PlumbingRepair/PlumbingRepairView/FormImplementer.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
127
PlumbingRepair/PlumbingRepairView/FormImplementers.Designer.cs
generated
Normal file
127
PlumbingRepair/PlumbingRepairView/FormImplementers.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
namespace PlumbingRepairView
|
||||||
|
{
|
||||||
|
partial class FormImplementers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
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.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonRef
|
||||||
|
//
|
||||||
|
this.buttonRef.Location = new System.Drawing.Point(661, 254);
|
||||||
|
this.buttonRef.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
|
||||||
|
this.buttonRef.Name = "buttonRef";
|
||||||
|
this.buttonRef.Size = new System.Drawing.Size(125, 44);
|
||||||
|
this.buttonRef.TabIndex = 14;
|
||||||
|
this.buttonRef.Text = "Обновить";
|
||||||
|
this.buttonRef.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
this.buttonDel.Location = new System.Drawing.Point(661, 175);
|
||||||
|
this.buttonDel.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
|
||||||
|
this.buttonDel.Name = "buttonDel";
|
||||||
|
this.buttonDel.Size = new System.Drawing.Size(125, 44);
|
||||||
|
this.buttonDel.TabIndex = 13;
|
||||||
|
this.buttonDel.Text = "Удалить";
|
||||||
|
this.buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
this.buttonUpd.Location = new System.Drawing.Point(661, 96);
|
||||||
|
this.buttonUpd.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
|
||||||
|
this.buttonUpd.Name = "buttonUpd";
|
||||||
|
this.buttonUpd.Size = new System.Drawing.Size(125, 44);
|
||||||
|
this.buttonUpd.TabIndex = 12;
|
||||||
|
this.buttonUpd.Text = "Изменить";
|
||||||
|
this.buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(661, 23);
|
||||||
|
this.buttonAdd.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(125, 44);
|
||||||
|
this.buttonAdd.TabIndex = 11;
|
||||||
|
this.buttonAdd.Text = "Добавить";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
this.dataGridView.AllowUserToAddRows = false;
|
||||||
|
this.dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
|
this.dataGridView.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.dataGridView.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
|
||||||
|
this.dataGridView.MultiSelect = false;
|
||||||
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.ReadOnly = true;
|
||||||
|
this.dataGridView.RowHeadersVisible = false;
|
||||||
|
this.dataGridView.RowHeadersWidth = 62;
|
||||||
|
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridView.Size = new System.Drawing.Size(583, 450);
|
||||||
|
this.dataGridView.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// FormImplementers
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 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 = "FormImplementers";
|
||||||
|
this.Text = "Исполнители";
|
||||||
|
this.Load += new System.EventHandler(this.FormImplementers_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonRef;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
102
PlumbingRepair/PlumbingRepairView/FormImplementers.cs
Normal file
102
PlumbingRepair/PlumbingRepairView/FormImplementers.cs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PlumbingRepairContracts.BindingModels;
|
||||||
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
|
namespace PlumbingRepairView
|
||||||
|
{
|
||||||
|
public partial class FormImplementers : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormImplementers_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["ImplementerFIO"].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(FormImplementer));
|
||||||
|
if (service is FormImplementer 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(FormImplementer));
|
||||||
|
if (service is FormImplementer 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 ImplementerBindingModel { 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
PlumbingRepair/PlumbingRepairView/FormImplementers.resx
Normal file
60
PlumbingRepair/PlumbingRepairView/FormImplementers.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -30,25 +30,32 @@
|
|||||||
{
|
{
|
||||||
this.buttonRef = new System.Windows.Forms.Button();
|
this.buttonRef = new System.Windows.Forms.Button();
|
||||||
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
||||||
this.buttonOrderReady = new System.Windows.Forms.Button();
|
|
||||||
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
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.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.РаботыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.РаботыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
<<<<<<< HEAD
|
||||||
this.магазиныToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.магазиныToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.пToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.пToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.продажаРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.продажаРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
=======
|
||||||
|
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.исполнителиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
>>>>>>> lab_6
|
||||||
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.компонентыПоРаботамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.компонентыПоРаботамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
<<<<<<< HEAD
|
||||||
this.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.работыПоМагазинамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.работыПоМагазинамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.списокВсехЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.списокВсехЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
=======
|
||||||
|
this.выполнениеРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
>>>>>>> lab_6
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -56,7 +63,7 @@
|
|||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
this.buttonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonRef.Location = new System.Drawing.Point(1113, 373);
|
this.buttonRef.Location = new System.Drawing.Point(1284, 219);
|
||||||
this.buttonRef.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
this.buttonRef.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
this.buttonRef.Name = "buttonRef";
|
this.buttonRef.Name = "buttonRef";
|
||||||
this.buttonRef.Size = new System.Drawing.Size(249, 45);
|
this.buttonRef.Size = new System.Drawing.Size(249, 45);
|
||||||
@ -68,7 +75,7 @@
|
|||||||
// buttonIssuedOrder
|
// buttonIssuedOrder
|
||||||
//
|
//
|
||||||
this.buttonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(1113, 297);
|
this.buttonIssuedOrder.Location = new System.Drawing.Point(1284, 143);
|
||||||
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(249, 45);
|
this.buttonIssuedOrder.Size = new System.Drawing.Size(249, 45);
|
||||||
@ -77,34 +84,10 @@
|
|||||||
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
|
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
||||||
//
|
//
|
||||||
// buttonOrderReady
|
|
||||||
//
|
|
||||||
this.buttonOrderReady.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonOrderReady.Location = new System.Drawing.Point(1113, 225);
|
|
||||||
this.buttonOrderReady.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
|
||||||
this.buttonOrderReady.Name = "buttonOrderReady";
|
|
||||||
this.buttonOrderReady.Size = new System.Drawing.Size(249, 45);
|
|
||||||
this.buttonOrderReady.TabIndex = 9;
|
|
||||||
this.buttonOrderReady.Text = "Заказ готов";
|
|
||||||
this.buttonOrderReady.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
|
|
||||||
//
|
|
||||||
// buttonTakeOrderInWork
|
|
||||||
//
|
|
||||||
this.buttonTakeOrderInWork.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(1113, 158);
|
|
||||||
this.buttonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
|
||||||
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
|
||||||
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(249, 45);
|
|
||||||
this.buttonTakeOrderInWork.TabIndex = 8;
|
|
||||||
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
|
||||||
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
|
|
||||||
//
|
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
this.buttonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonCreateOrder.Location = new System.Drawing.Point(1113, 83);
|
this.buttonCreateOrder.Location = new System.Drawing.Point(1284, 83);
|
||||||
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
this.buttonCreateOrder.Size = new System.Drawing.Size(249, 45);
|
this.buttonCreateOrder.Size = new System.Drawing.Size(249, 45);
|
||||||
@ -130,7 +113,7 @@
|
|||||||
this.dataGridView.RowHeadersVisible = false;
|
this.dataGridView.RowHeadersVisible = false;
|
||||||
this.dataGridView.RowHeadersWidth = 62;
|
this.dataGridView.RowHeadersWidth = 62;
|
||||||
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(1055, 533);
|
this.dataGridView.Size = new System.Drawing.Size(1226, 533);
|
||||||
this.dataGridView.TabIndex = 6;
|
this.dataGridView.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
@ -138,10 +121,11 @@
|
|||||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
|
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.справочникиToolStripMenuItem,
|
this.справочникиToolStripMenuItem,
|
||||||
this.отчетыToolStripMenuItem});
|
this.отчетыToolStripMenuItem,
|
||||||
|
this.выполнениеРаботToolStripMenuItem});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1377, 33);
|
this.menuStrip1.Size = new System.Drawing.Size(1548, 33);
|
||||||
this.menuStrip1.TabIndex = 12;
|
this.menuStrip1.TabIndex = 12;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
@ -150,10 +134,15 @@
|
|||||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.компонентыToolStripMenuItem,
|
this.компонентыToolStripMenuItem,
|
||||||
this.РаботыToolStripMenuItem,
|
this.РаботыToolStripMenuItem,
|
||||||
|
<<<<<<< HEAD
|
||||||
this.магазиныToolStripMenuItem,
|
this.магазиныToolStripMenuItem,
|
||||||
this.пToolStripMenuItem,
|
this.пToolStripMenuItem,
|
||||||
this.продажаРаботToolStripMenuItem,
|
this.продажаРаботToolStripMenuItem,
|
||||||
this.клиентыToolStripMenuItem});
|
this.клиентыToolStripMenuItem});
|
||||||
|
=======
|
||||||
|
this.клиентыToolStripMenuItem,
|
||||||
|
this.исполнителиToolStripMenuItem});
|
||||||
|
>>>>>>> lab_6
|
||||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(139, 29);
|
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(139, 29);
|
||||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
this.справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
@ -161,13 +150,18 @@
|
|||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
|
<<<<<<< HEAD
|
||||||
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
||||||
|
=======
|
||||||
|
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
|
||||||
|
>>>>>>> lab_6
|
||||||
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// РаботыToolStripMenuItem
|
// РаботыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.РаботыToolStripMenuItem.Name = "РаботыToolStripMenuItem";
|
this.РаботыToolStripMenuItem.Name = "РаботыToolStripMenuItem";
|
||||||
|
<<<<<<< HEAD
|
||||||
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
||||||
this.РаботыToolStripMenuItem.Text = "Работы";
|
this.РаботыToolStripMenuItem.Text = "Работы";
|
||||||
this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click);
|
this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click);
|
||||||
@ -192,6 +186,25 @@
|
|||||||
this.продажаРаботToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
this.продажаРаботToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
||||||
this.продажаРаботToolStripMenuItem.Text = "Продажа работ";
|
this.продажаРаботToolStripMenuItem.Text = "Продажа работ";
|
||||||
this.продажаРаботToolStripMenuItem.Click += new System.EventHandler(this.продажаРаботToolStripMenuItem_Click);
|
this.продажаРаботToolStripMenuItem.Click += new System.EventHandler(this.продажаРаботToolStripMenuItem_Click);
|
||||||
|
=======
|
||||||
|
this.РаботыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
|
||||||
|
this.РаботыToolStripMenuItem.Text = "Работы";
|
||||||
|
this.РаботыToolStripMenuItem.Click += new System.EventHandler(this.РаботыToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// клиентыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||||
|
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
|
||||||
|
this.клиентыToolStripMenuItem.Text = "Клиенты";
|
||||||
|
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// исполнителиToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
||||||
|
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(220, 34);
|
||||||
|
this.исполнителиToolStripMenuItem.Text = "Исполнители";
|
||||||
|
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click);
|
||||||
|
>>>>>>> lab_6
|
||||||
//
|
//
|
||||||
// отчетыToolStripMenuItem
|
// отчетыToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -218,6 +231,10 @@
|
|||||||
this.компонентыПоРаботамToolStripMenuItem.Name = "компонентыПоРаботамToolStripMenuItem";
|
this.компонентыПоРаботамToolStripMenuItem.Name = "компонентыПоРаботамToolStripMenuItem";
|
||||||
this.компонентыПоРаботамToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
|
this.компонентыПоРаботамToolStripMenuItem.Size = new System.Drawing.Size(319, 34);
|
||||||
this.компонентыПоРаботамToolStripMenuItem.Text = "Компоненты по работам";
|
this.компонентыПоРаботамToolStripMenuItem.Text = "Компоненты по работам";
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
this.компонентыПоРаботамToolStripMenuItem.Click += new System.EventHandler(this.ComponentWorksToolStripMenuItem_Click);
|
||||||
|
>>>>>>> lab_6
|
||||||
//
|
//
|
||||||
// списокЗаказовToolStripMenuItem
|
// списокЗаказовToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -246,22 +263,27 @@
|
|||||||
this.списокВсехЗаказовToolStripMenuItem.Text = "Список всех заказов";
|
this.списокВсехЗаказовToolStripMenuItem.Text = "Список всех заказов";
|
||||||
this.списокВсехЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersByDateToolStripMenuItem_Click);
|
this.списокВсехЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersByDateToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// клиентыToolStripMenuItem
|
// выполнениеРаботToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
<<<<<<< HEAD
|
||||||
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||||
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(296, 34);
|
||||||
this.клиентыToolStripMenuItem.Text = "Клиенты";
|
this.клиентыToolStripMenuItem.Text = "Клиенты";
|
||||||
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
|
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
|
||||||
|
=======
|
||||||
|
this.выполнениеРаботToolStripMenuItem.Name = "выполнениеРаботToolStripMenuItem";
|
||||||
|
this.выполнениеРаботToolStripMenuItem.Size = new System.Drawing.Size(136, 29);
|
||||||
|
this.выполнениеРаботToolStripMenuItem.Text = "Запуск работ";
|
||||||
|
this.выполнениеРаботToolStripMenuItem.Click += new System.EventHandler(this.ЗапускРаботToolStripMenuItem_Click);
|
||||||
|
>>>>>>> lab_6
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1377, 602);
|
this.ClientSize = new System.Drawing.Size(1548, 602);
|
||||||
this.Controls.Add(this.buttonRef);
|
this.Controls.Add(this.buttonRef);
|
||||||
this.Controls.Add(this.buttonIssuedOrder);
|
this.Controls.Add(this.buttonIssuedOrder);
|
||||||
this.Controls.Add(this.buttonOrderReady);
|
|
||||||
this.Controls.Add(this.buttonTakeOrderInWork);
|
|
||||||
this.Controls.Add(this.buttonCreateOrder);
|
this.Controls.Add(this.buttonCreateOrder);
|
||||||
this.Controls.Add(this.dataGridView);
|
this.Controls.Add(this.dataGridView);
|
||||||
this.Controls.Add(this.menuStrip1);
|
this.Controls.Add(this.menuStrip1);
|
||||||
@ -281,8 +303,6 @@
|
|||||||
|
|
||||||
private Button buttonRef;
|
private Button buttonRef;
|
||||||
private Button buttonIssuedOrder;
|
private Button buttonIssuedOrder;
|
||||||
private Button buttonOrderReady;
|
|
||||||
private Button buttonTakeOrderInWork;
|
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private MenuStrip menuStrip1;
|
private MenuStrip menuStrip1;
|
||||||
@ -300,5 +320,7 @@
|
|||||||
private ToolStripMenuItem работыПоМагазинамToolStripMenuItem;
|
private ToolStripMenuItem работыПоМагазинамToolStripMenuItem;
|
||||||
private ToolStripMenuItem списокВсехЗаказовToolStripMenuItem;
|
private ToolStripMenuItem списокВсехЗаказовToolStripMenuItem;
|
||||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem выполнениеРаботToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,13 +11,18 @@ namespace PlumbingRepairView
|
|||||||
|
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
private readonly IWorkProcess _workProcess;
|
||||||
|
>>>>>>> lab_6
|
||||||
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
_reportLogic = reportLogic;
|
_reportLogic = reportLogic;
|
||||||
|
_workProcess = workProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -34,7 +39,12 @@ namespace PlumbingRepairView
|
|||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
dataGridView.Columns["WorkId"].Visible = false;
|
||||||
|
>>>>>>> lab_6
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
}
|
}
|
||||||
@ -63,6 +73,7 @@ namespace PlumbingRepairView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||||
@ -110,30 +121,51 @@ namespace PlumbingRepairView
|
|||||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
|
||||||
|
e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName
|
||||||
|
});
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ComponentWorksToolStripMenuItem_Click(object sender,
|
||||||
|
EventArgs e)
|
||||||
|
{
|
||||||
|
var service =
|
||||||
|
Program.ServiceProvider?.GetService(typeof(FormReportWorkComponents));
|
||||||
|
if (service is FormReportWorkComponents form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service =
|
||||||
|
Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||||
|
if (service is FormReportOrders form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
>>>>>>> lab_6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
|
||||||
|
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||||
|
if (service is FormCreateOrder form)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.ShowDialog();
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
||||||
@ -252,5 +284,22 @@ namespace PlumbingRepairView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||||
|
if (service is FormImplementers form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private void ЗапускРаботToolStripMenuItem_Click(object sender, EventArgs
|
||||||
|
e)
|
||||||
|
{
|
||||||
|
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
|
MessageBox.Show("Процесс обработки запущен", "Сообщение",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,6 +43,7 @@ namespace PlumbingRepairView
|
|||||||
|
|
||||||
services.AddTransient<IShopStorage, ShopStorage>();
|
services.AddTransient<IShopStorage, ShopStorage>();
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
|
||||||
|
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
@ -51,6 +52,8 @@ namespace PlumbingRepairView
|
|||||||
services.AddTransient<IShopLogic, ShopLogic>();
|
services.AddTransient<IShopLogic, ShopLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
|
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
|
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
@ -67,13 +70,18 @@ namespace PlumbingRepairView
|
|||||||
services.AddTransient<FormShop>();
|
services.AddTransient<FormShop>();
|
||||||
services.AddTransient<FormShops>();
|
services.AddTransient<FormShops>();
|
||||||
services.AddTransient<FormWorkComponent>();
|
services.AddTransient<FormWorkComponent>();
|
||||||
|
<<<<<<< HEAD
|
||||||
services.AddTransient<FormStoreReplenishment>();
|
services.AddTransient<FormStoreReplenishment>();
|
||||||
services.AddTransient<FormSellWorks>();
|
services.AddTransient<FormSellWorks>();
|
||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
services.AddTransient<FormReportOrdersByDate>();
|
services.AddTransient<FormReportOrdersByDate>();
|
||||||
services.AddTransient<FormReportWorkComponents>();
|
services.AddTransient<FormReportWorkComponents>();
|
||||||
services.AddTransient<FormReportShopWorks>();
|
services.AddTransient<FormReportShopWorks>();
|
||||||
|
=======
|
||||||
|
>>>>>>> lab_6
|
||||||
services.AddTransient<FormClients>();
|
services.AddTransient<FormClients>();
|
||||||
|
services.AddTransient<FormImplementer>();
|
||||||
|
services.AddTransient<FormImplementers>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user