Compare commits
No commits in common. "3b7e92ce54256a53a7ab32d1621e531a9388ef2e" and "6f0ac0735490bbe7bd37c23bc7ebca046bd9f6cd" have entirely different histories.
3b7e92ce54
...
6f0ac07354
@ -1,128 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.StoragesContracts;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PizzeriaBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ImplementerLogic : IImplementerLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerStorage _implementerStorage;
|
|
||||||
|
|
||||||
public ImplementerLogic(ILogger<IImplementerLogic> logger, IImplementerStorage implementerStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_implementerStorage = implementerStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ImplementerFIO:{ImplementerFIO}.Password:{Password}.Id:{ Id}", model?.ImplementerFIO, model?.Password?.Length, 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}.Password:{Password}.Id:{ Id}", model?.ImplementerFIO, model?.Password?.Length, 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.WorkExperience < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Стаж должен быть больше 0", nameof(model.WorkExperience));
|
|
||||||
}
|
|
||||||
if (model.Qualification < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Квалификация должна быть положительной", nameof(model.Qualification));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Implementer. ImplementerFIO:{ImplementerFIO}.Password:{Password}.WorkExperience:{WorkExperience}.Qualification:{Qualification}.Id: { Id}",
|
|
||||||
model.ImplementerFIO, model.Password, model.WorkExperience, model.Qualification, model.Id);
|
|
||||||
var element = _implementerStorage.GetElement(new ImplementerSearchModel
|
|
||||||
{
|
|
||||||
ImplementerFIO = model.ImplementerFIO
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Исполнитель с таким ФИО уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,15 @@
|
|||||||
using PizzeriaDataModels.Enums;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PizzeriaContracts.BindingModels;
|
using PizzeriaContracts.BindingModels;
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
using PizzeriaContracts.BusinessLogicsContracts;
|
||||||
using PizzeriaContracts.SearchModels;
|
using PizzeriaContracts.SearchModels;
|
||||||
using PizzeriaContracts.StoragesContracts;
|
using PizzeriaContracts.StoragesContracts;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using PizzeriaDataModels.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PizzeriaBusinessLogic.BusinessLogics
|
namespace PizzeriaBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
@ -12,35 +17,14 @@ namespace PizzeriaBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
static readonly object _locker = new object();
|
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? ReadElement(OrderSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ClientId:{ClientId}.Status:{Status}.ImplementerId:{ImplementerId}.DateFrom:{DateFrom}.DateTo:{DateTo}OrderId:{Id}",
|
|
||||||
model.ClientId, model.Status, model.ImplementerId, 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 List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. ClientId:{ClientId}.Status:{Status}.ImplementerId:{ImplementerId}.DateFrom:{DateFrom}.DateTo:{DateTo}OrderId:{Id}",
|
_logger.LogInformation("ReadList. OrderId:{Id}", model?.Id);
|
||||||
model?.ClientId, model?.Status, model?.ImplementerId, model?.DateFrom, model?.DateTo, model?.Id);
|
|
||||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
@ -50,7 +34,6 @@ namespace PizzeriaBusinessLogic.BusinessLogics
|
|||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
public bool CreateOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
@ -66,12 +49,9 @@ namespace PizzeriaBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
{
|
|
||||||
lock (_locker)
|
|
||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
public bool FinishOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -118,26 +98,19 @@ namespace PizzeriaBusinessLogic.BusinessLogics
|
|||||||
});
|
});
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(nameof(element));
|
throw new ArgumentNullException(nameof(element));
|
||||||
}
|
}
|
||||||
model.DateCreate = element.DateCreate;
|
model.DateCreate = element.DateCreate;
|
||||||
model.PizzaId = element.PizzaId;
|
model.PizzaId = element.PizzaId;
|
||||||
model.DateImplement = element.DateImplement;
|
model.DateImplement = element.DateImplement;
|
||||||
model.ClientId = element.ClientId;
|
|
||||||
if (!model.ImplementerId.HasValue)
|
|
||||||
{
|
|
||||||
model.ImplementerId = element.ImplementerId;
|
|
||||||
}
|
|
||||||
model.Status = element.Status;
|
model.Status = element.Status;
|
||||||
model.Count = element.Count;
|
model.Count = element.Count;
|
||||||
model.Sum = element.Sum;
|
model.Sum = element.Sum;
|
||||||
if (requiredStatus - model.Status == 1)
|
if (requiredStatus - model.Status == 1)
|
||||||
{
|
{
|
||||||
model.Status = requiredStatus;
|
model.Status = requiredStatus;
|
||||||
if (model.Status == OrderStatus.Готов)
|
if (model.Status == OrderStatus.Выдан)
|
||||||
{
|
|
||||||
model.DateImplement = DateTime.Now;
|
model.DateImplement = DateTime.Now;
|
||||||
}
|
|
||||||
if (_orderStorage.Update(model) == null)
|
if (_orderStorage.Update(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Update operation failed");
|
_logger.LogWarning("Update operation failed");
|
||||||
@ -146,7 +119,7 @@ namespace PizzeriaBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_logger.LogWarning("Changing status operation faled: Current-{Status}:required-{requiredStatus}.", model.Status, requiredStatus);
|
_logger.LogWarning("Changing status operation faled: Current-{Status}:required-{requiredStatus}.", model.Status, requiredStatus);
|
||||||
throw new InvalidOperationException($"Невозможно приствоить статус {requiredStatus} заказу с текущим статусом {model.Status}");
|
throw new ArgumentException($"Невозможно присвоить статус {requiredStatus} заказу с текущим статусом {model.Status}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,134 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
using PizzeriaDataModels.Enums;
|
|
||||||
|
|
||||||
namespace PizzeriaBusinessLogic.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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
|
||||||
catch (InvalidOperationException ex)
|
|
||||||
{
|
|
||||||
_logger.LogWarning(ex, "Error try get work");
|
|
||||||
}
|
|
||||||
// заканчиваем выполнение имитации в случае иной ошибки
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error while do work");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
// отдыхаем
|
|
||||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using PizzeriaDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PizzeriaContracts.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; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ namespace PizzeriaContracts.BindingModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int PizzaId { get; set; }
|
public int PizzaId { 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; }
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace PizzeriaContracts.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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,6 +16,5 @@ namespace PizzeriaContracts.BusinessLogicsContracts
|
|||||||
bool TakeOrderInWork(OrderBindingModel model);
|
bool TakeOrderInWork(OrderBindingModel model);
|
||||||
bool FinishOrder(OrderBindingModel model);
|
bool FinishOrder(OrderBindingModel model);
|
||||||
bool DeliveryOrder(OrderBindingModel model);
|
bool DeliveryOrder(OrderBindingModel model);
|
||||||
OrderViewModel? ReadElement(OrderSearchModel model);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
namespace PizzeriaContracts.BusinessLogicsContracts
|
|
||||||
{
|
|
||||||
public interface IWorkProcess
|
|
||||||
{
|
|
||||||
void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace PizzeriaContracts.SearchModels
|
|
||||||
{
|
|
||||||
public class ImplementerSearchModel
|
|
||||||
{
|
|
||||||
public int? Id { get; set; }
|
|
||||||
public string? ImplementerFIO { get; set; }
|
|
||||||
public string? Password { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,8 @@
|
|||||||
using PizzeriaDataModels.Enums;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PizzeriaContracts.SearchModels
|
namespace PizzeriaContracts.SearchModels
|
||||||
{
|
{
|
||||||
@ -6,8 +10,6 @@ namespace PizzeriaContracts.SearchModels
|
|||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
public OrderStatus? Status { 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; }
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace PizzeriaContracts.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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
using PizzeriaDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PizzeriaContracts.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; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,10 +19,6 @@ namespace PizzeriaContracts.ViewModels
|
|||||||
[DisplayName("ФИО клиента")]
|
[DisplayName("ФИО клиента")]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int? ImplementerId { get; set; }
|
|
||||||
[DisplayName("Исполнитель")]
|
|
||||||
public string? ImplementerFIO { get; set; } = null;
|
|
||||||
|
|
||||||
public int PizzaId { get; set; }
|
public int PizzaId { get; set; }
|
||||||
|
|
||||||
[DisplayName("Пицца")]
|
[DisplayName("Пицца")]
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
namespace PizzeriaDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IImplementerModel : IId
|
|
||||||
{
|
|
||||||
string ImplementerFIO { get; }
|
|
||||||
|
|
||||||
string Password { get; }
|
|
||||||
|
|
||||||
int WorkExperience { get; }
|
|
||||||
|
|
||||||
int Qualification { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,6 @@ namespace PizzeriaDataModels.Models
|
|||||||
{
|
{
|
||||||
int PizzaId { get; }
|
int PizzaId { get; }
|
||||||
int ClientId { get; }
|
int ClientId { get; }
|
||||||
int? ImplementerId { get; }
|
|
||||||
int Count { get; }
|
int Count { get; }
|
||||||
double Sum { get; }
|
double Sum { get; }
|
||||||
OrderStatus Status { get; }
|
OrderStatus Status { get; }
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.StoragesContracts;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
using PizzeriaDatabaseImplement.Models;
|
|
||||||
|
|
||||||
namespace PizzeriaDatabaseImplement.Implements
|
|
||||||
{
|
|
||||||
public class ImplementerStorage : IImplementerStorage
|
|
||||||
{
|
|
||||||
public List<ImplementerViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
using var context = new PizzeriaDatabase();
|
|
||||||
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 PizzeriaDatabase();
|
|
||||||
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 PizzeriaDatabase();
|
|
||||||
return context.Implementers.FirstOrDefault(x =>
|
|
||||||
(!string.IsNullOrEmpty(model.ImplementerFIO) && x.ImplementerFIO == model.ImplementerFIO && (!string.IsNullOrEmpty(model.Password) ? x.Password == model.Password : true)) ||
|
|
||||||
(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 PizzeriaDatabase();
|
|
||||||
context.Implementers.Add(newImplementer);
|
|
||||||
context.SaveChanges();
|
|
||||||
return newImplementer.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
using var context = new PizzeriaDatabase();
|
|
||||||
var implementer = context.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (implementer == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
implementer.Update(model);
|
|
||||||
context.SaveChanges();
|
|
||||||
return implementer.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
using var context = new PizzeriaDatabase();
|
|
||||||
var implementer = context.Implementers.FirstOrDefault(rec => rec.Id == model.Id);
|
|
||||||
if (implementer != null)
|
|
||||||
{
|
|
||||||
context.Implementers.Remove(implementer);
|
|
||||||
context.SaveChanges();
|
|
||||||
return implementer.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,34 +12,31 @@ namespace PizzeriaDatabaseImplement.Implements
|
|||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new PizzeriaDatabase();
|
using var context = new PizzeriaDatabase();
|
||||||
return context.Orders.Include(x => x.Pizza).Include(x => x.Client).Include(y => y.Implementer).Select(x => x.GetViewModel).ToList();
|
return context.Orders.Include(x => x.Pizza).Include(x => x.Client).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
using var context = new PizzeriaDatabase();
|
using var context = new PizzeriaDatabase();
|
||||||
if ((!model.DateFrom.HasValue || !model.DateTo.HasValue) && !model.ClientId.HasValue && !model.Status.HasValue)
|
if (model.DateFrom.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return context.Orders.Include(x => x.Pizza).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
return context.Orders.Include(x => x.Pizza).Include(x => x.Client).Include(x => x.Implementer).Where(x =>
|
if (model.ClientId.HasValue)
|
||||||
(model.DateFrom.HasValue && model.DateTo.HasValue && x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) ||
|
{
|
||||||
(model.ClientId.HasValue && x.ClientId == model.ClientId) ||
|
return context.Orders.Include(x => x.Pizza).Where(x => x.ClientId == model.ClientId).Select(x => x.GetViewModel).ToList();
|
||||||
(model.Status.HasValue && x.Status == model.Status))
|
}
|
||||||
.Select(x => x.GetViewModel).ToList();
|
return context.Orders.Include(x => x.Pizza).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && (!model.ImplementerId.HasValue || !model.Status.HasValue))
|
if (!model.Id.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new PizzeriaDatabase();
|
using var context = new PizzeriaDatabase();
|
||||||
return context.Orders.Include(x => x.Pizza).Include(x => x.Client).Include(x => x.Implementer).FirstOrDefault(x =>
|
return context.Orders.Include(x => x.Pizza).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||||
(model.Id.HasValue && x.Id == model.Id) ||
|
|
||||||
(model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId && x.Status == model.Status))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
@ -65,7 +62,7 @@ namespace PizzeriaDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
order.Update(context, model);
|
order.Update(model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return order.GetViewModel;
|
return order.GetViewModel;
|
||||||
}
|
}
|
||||||
|
@ -1,257 +0,0 @@
|
|||||||
// <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 PizzeriaDatabaseImplement;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace PizzeriaDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(PizzeriaDatabase))]
|
|
||||||
[Migration("20240328173346_implementors")]
|
|
||||||
partial class implementors
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "7.0.3")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
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("PizzeriaDatabaseImplement.Models.Component", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ComponentName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Cost")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Components");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
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("PizzeriaDatabaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
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>("PizzaId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ClientId");
|
|
||||||
|
|
||||||
b.HasIndex("ImplementerId");
|
|
||||||
|
|
||||||
b.HasIndex("PizzaId");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("PizzaName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pizzas");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("ComponentId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PizzaId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ComponentId");
|
|
||||||
|
|
||||||
b.HasIndex("PizzaId");
|
|
||||||
|
|
||||||
b.ToTable("PizzaComponents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Client", "Client")
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("ClientId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Implementer", "Implementer")
|
|
||||||
.WithMany("Order")
|
|
||||||
.HasForeignKey("ImplementerId");
|
|
||||||
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("PizzaId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Client");
|
|
||||||
|
|
||||||
b.Navigation("Implementer");
|
|
||||||
|
|
||||||
b.Navigation("Pizza");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Component", "Component")
|
|
||||||
.WithMany("PizzaComponents")
|
|
||||||
.HasForeignKey("ComponentId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
|
||||||
.WithMany("Components")
|
|
||||||
.HasForeignKey("PizzaId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Component");
|
|
||||||
|
|
||||||
b.Navigation("Pizza");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("PizzaComponents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Order");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Components");
|
|
||||||
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace PizzeriaDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class implementors : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "ImplementerId",
|
|
||||||
table: "Orders",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Implementers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Orders_ImplementerId",
|
|
||||||
table: "Orders",
|
|
||||||
column: "ImplementerId");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Orders_Implementers_ImplementerId",
|
|
||||||
table: "Orders",
|
|
||||||
column: "ImplementerId",
|
|
||||||
principalTable: "Implementers",
|
|
||||||
principalColumn: "Id");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Orders_Implementers_ImplementerId",
|
|
||||||
table: "Orders");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Implementers");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Orders_ImplementerId",
|
|
||||||
table: "Orders");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ImplementerId",
|
|
||||||
table: "Orders");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -67,33 +67,6 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
b.ToTable("Components");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
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("PizzeriaDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -114,9 +87,6 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<int?>("ImplementerId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PizzaId")
|
b.Property<int>("PizzaId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -130,8 +100,6 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ClientId");
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
b.HasIndex("ImplementerId");
|
|
||||||
|
|
||||||
b.HasIndex("PizzaId");
|
b.HasIndex("PizzaId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
@ -191,10 +159,6 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Implementer", "Implementer")
|
|
||||||
.WithMany("Order")
|
|
||||||
.HasForeignKey("ImplementerId");
|
|
||||||
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("PizzaId")
|
.HasForeignKey("PizzaId")
|
||||||
@ -203,8 +167,6 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.Navigation("Client");
|
b.Navigation("Client");
|
||||||
|
|
||||||
b.Navigation("Implementer");
|
|
||||||
|
|
||||||
b.Navigation("Pizza");
|
b.Navigation("Pizza");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -237,11 +199,6 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
b.Navigation("PizzaComponents");
|
b.Navigation("PizzaComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Order");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
using PizzeriaDataModels.Models;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace PizzeriaDatabaseImplement.Models
|
|
||||||
{
|
|
||||||
public class Implementer : IImplementerModel
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string Password { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public int WorkExperience { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public int Qualification { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey("ImplementerId")]
|
|
||||||
public virtual List<Order> Order { 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 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
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,10 +20,6 @@ namespace PizzeriaDatabaseImplement.Models
|
|||||||
|
|
||||||
public virtual Pizza Pizza { get; set; } = new();
|
public virtual Pizza Pizza { get; set; } = new();
|
||||||
|
|
||||||
public int? ImplementerId { get; private set; }
|
|
||||||
|
|
||||||
public virtual Implementer? Implementer { get; set; } = new();
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
@ -47,8 +43,6 @@ namespace PizzeriaDatabaseImplement.Models
|
|||||||
Client = context.Clients.First(x => x.Id == model.ClientId),
|
Client = context.Clients.First(x => x.Id == model.ClientId),
|
||||||
PizzaId = model.PizzaId,
|
PizzaId = model.PizzaId,
|
||||||
Pizza = context.Pizzas.First(x => x.Id == model.PizzaId),
|
Pizza = context.Pizzas.First(x => x.Id == model.PizzaId),
|
||||||
ImplementerId = model.ImplementerId,
|
|
||||||
Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null,
|
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -57,7 +51,7 @@ namespace PizzeriaDatabaseImplement.Models
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(PizzeriaDatabase context, OrderBindingModel? model)
|
public void Update(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -65,8 +59,6 @@ namespace PizzeriaDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
ImplementerId = model.ImplementerId;
|
|
||||||
Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
@ -76,8 +68,6 @@ namespace PizzeriaDatabaseImplement.Models
|
|||||||
ClientFIO = Client.ClientFIO,
|
ClientFIO = Client.ClientFIO,
|
||||||
PizzaId = PizzaId,
|
PizzaId = PizzaId,
|
||||||
PizzaName = Pizza.PizzaName,
|
PizzaName = Pizza.PizzaName,
|
||||||
ImplementerId = ImplementerId,
|
|
||||||
ImplementerFIO = Implementer != null ? Implementer.ImplementerFIO : null,
|
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using PizzeriaDatabaseImplement.Models;
|
||||||
using PizzeriaDatabaseImplement.Models;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace PizzeriaDatabaseImplement
|
namespace PizzeriaDatabaseImplement
|
||||||
{
|
{
|
||||||
@ -18,6 +19,5 @@ namespace PizzeriaDatabaseImplement
|
|||||||
public virtual DbSet<PizzaComponent> PizzaComponents { set; get; }
|
public virtual DbSet<PizzaComponent> PizzaComponents { set; get; }
|
||||||
public virtual DbSet<Order> Orders { set; get; }
|
public virtual DbSet<Order> Orders { set; get; }
|
||||||
public virtual DbSet<Client> Clients { set; get; }
|
public virtual DbSet<Client> Clients { set; get; }
|
||||||
public virtual DbSet<Implementer> Implementers { set; get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.StoragesContracts;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace PizzeriaFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class ImplementerStorage : IImplementerStorage
|
|
||||||
{
|
|
||||||
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -88,7 +88,5 @@ namespace PizzeriaFileImplement.Models
|
|||||||
new XElement("Status", Status.ToString()),
|
new XElement("Status", Status.ToString()),
|
||||||
new XElement("DateCreate", DateCreate.ToString()),
|
new XElement("DateCreate", DateCreate.ToString()),
|
||||||
new XElement("DateImplement", DateImplement.ToString()));
|
new XElement("DateImplement", DateImplement.ToString()));
|
||||||
|
|
||||||
public int? ImplementerId => throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,40 +0,0 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.StoragesContracts;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace PizzeriaListImplement.Implements
|
|
||||||
{
|
|
||||||
public class ImplementerStorage : IImplementerStorage
|
|
||||||
{
|
|
||||||
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -61,7 +61,5 @@ namespace PizzeriaListImplement.Models
|
|||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
DateImplement = DateImplement,
|
DateImplement = DateImplement,
|
||||||
};
|
};
|
||||||
|
|
||||||
public int? ImplementerId => throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
using PizzeriaContracts.ViewModels;
|
|
||||||
using PizzeriaDataModels.Enums;
|
|
||||||
|
|
||||||
namespace PizzeriaRestApi.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,12 +11,10 @@ builder.Logging.AddLog4Net("log4net.config");
|
|||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
|
||||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
builder.Services.AddTransient<IPizzaStorage, PizzaStorage>();
|
builder.Services.AddTransient<IPizzaStorage, PizzaStorage>();
|
||||||
|
|
||||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
|
||||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
builder.Services.AddTransient<IPizzaLogic, PizzaLogic>();
|
builder.Services.AddTransient<IPizzaLogic, PizzaLogic>();
|
||||||
|
|
||||||
|
167
Pizzeria/PizzeriaView/FormImplementer.Designer.cs
generated
167
Pizzeria/PizzeriaView/FormImplementer.Designer.cs
generated
@ -1,167 +0,0 @@
|
|||||||
namespace PizzeriaView
|
|
||||||
{
|
|
||||||
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.textBoxFIO = new System.Windows.Forms.TextBox();
|
|
||||||
this.labelFIO = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
|
||||||
this.labelPassword = new System.Windows.Forms.Label();
|
|
||||||
this.labelWorkExperience = new System.Windows.Forms.Label();
|
|
||||||
this.numericUpDownWorkExperience = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.numericUpDownQualification = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.labelQualification = new System.Windows.Forms.Label();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWorkExperience)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQualification)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// textBoxFIO
|
|
||||||
//
|
|
||||||
this.textBoxFIO.Location = new System.Drawing.Point(157, 12);
|
|
||||||
this.textBoxFIO.Name = "textBoxFIO";
|
|
||||||
this.textBoxFIO.Size = new System.Drawing.Size(382, 27);
|
|
||||||
this.textBoxFIO.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// labelFIO
|
|
||||||
//
|
|
||||||
this.labelFIO.AutoSize = true;
|
|
||||||
this.labelFIO.Location = new System.Drawing.Point(12, 15);
|
|
||||||
this.labelFIO.Name = "labelFIO";
|
|
||||||
this.labelFIO.Size = new System.Drawing.Size(139, 20);
|
|
||||||
this.labelFIO.TabIndex = 2;
|
|
||||||
this.labelFIO.Text = "ФИО исполнителя:";
|
|
||||||
//
|
|
||||||
// textBoxPassword
|
|
||||||
//
|
|
||||||
this.textBoxPassword.Location = new System.Drawing.Point(157, 50);
|
|
||||||
this.textBoxPassword.Name = "textBoxPassword";
|
|
||||||
this.textBoxPassword.Size = new System.Drawing.Size(205, 27);
|
|
||||||
this.textBoxPassword.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// labelPassword
|
|
||||||
//
|
|
||||||
this.labelPassword.AutoSize = true;
|
|
||||||
this.labelPassword.Location = new System.Drawing.Point(12, 53);
|
|
||||||
this.labelPassword.Name = "labelPassword";
|
|
||||||
this.labelPassword.Size = new System.Drawing.Size(65, 20);
|
|
||||||
this.labelPassword.TabIndex = 4;
|
|
||||||
this.labelPassword.Text = "Пароль:";
|
|
||||||
//
|
|
||||||
// labelWorkExperience
|
|
||||||
//
|
|
||||||
this.labelWorkExperience.AutoSize = true;
|
|
||||||
this.labelWorkExperience.Location = new System.Drawing.Point(12, 99);
|
|
||||||
this.labelWorkExperience.Name = "labelWorkExperience";
|
|
||||||
this.labelWorkExperience.Size = new System.Drawing.Size(105, 20);
|
|
||||||
this.labelWorkExperience.TabIndex = 6;
|
|
||||||
this.labelWorkExperience.Text = "Опыт работы:";
|
|
||||||
//
|
|
||||||
// numericUpDownWorkExperience
|
|
||||||
//
|
|
||||||
this.numericUpDownWorkExperience.Location = new System.Drawing.Point(157, 97);
|
|
||||||
this.numericUpDownWorkExperience.Name = "numericUpDownWorkExperience";
|
|
||||||
this.numericUpDownWorkExperience.Size = new System.Drawing.Size(124, 27);
|
|
||||||
this.numericUpDownWorkExperience.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// numericUpDownQualification
|
|
||||||
//
|
|
||||||
this.numericUpDownQualification.Location = new System.Drawing.Point(157, 142);
|
|
||||||
this.numericUpDownQualification.Name = "numericUpDownQualification";
|
|
||||||
this.numericUpDownQualification.Size = new System.Drawing.Size(124, 27);
|
|
||||||
this.numericUpDownQualification.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// labelQualification
|
|
||||||
//
|
|
||||||
this.labelQualification.AutoSize = true;
|
|
||||||
this.labelQualification.Location = new System.Drawing.Point(12, 144);
|
|
||||||
this.labelQualification.Name = "labelQualification";
|
|
||||||
this.labelQualification.Size = new System.Drawing.Size(114, 20);
|
|
||||||
this.labelQualification.TabIndex = 9;
|
|
||||||
this.labelQualification.Text = "Квалификация:";
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(422, 203);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(136, 40);
|
|
||||||
this.buttonCancel.TabIndex = 12;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(265, 203);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(130, 40);
|
|
||||||
this.buttonSave.TabIndex = 11;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
|
|
||||||
//
|
|
||||||
// FormImplementer
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(570, 255);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.numericUpDownQualification);
|
|
||||||
this.Controls.Add(this.labelQualification);
|
|
||||||
this.Controls.Add(this.numericUpDownWorkExperience);
|
|
||||||
this.Controls.Add(this.labelWorkExperience);
|
|
||||||
this.Controls.Add(this.textBoxPassword);
|
|
||||||
this.Controls.Add(this.labelPassword);
|
|
||||||
this.Controls.Add(this.textBoxFIO);
|
|
||||||
this.Controls.Add(this.labelFIO);
|
|
||||||
this.Name = "FormImplementer";
|
|
||||||
this.Text = "Исполнитель";
|
|
||||||
this.Load += new System.EventHandler(this.FormImplementer_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWorkExperience)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQualification)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private TextBox textBoxFIO;
|
|
||||||
private Label labelFIO;
|
|
||||||
private TextBox textBoxPassword;
|
|
||||||
private Label labelPassword;
|
|
||||||
private Label labelWorkExperience;
|
|
||||||
private NumericUpDown numericUpDownWorkExperience;
|
|
||||||
private NumericUpDown numericUpDownQualification;
|
|
||||||
private Label labelQualification;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Button buttonSave;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
|
||||||
using PizzeriaContracts.SearchModels;
|
|
||||||
|
|
||||||
namespace PizzeriaView
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
textBoxFIO.Text = view.ImplementerFIO;
|
|
||||||
textBoxPassword.Text = view.Password;
|
|
||||||
numericUpDownWorkExperience.Value = view.WorkExperience;
|
|
||||||
numericUpDownQualification.Value = view.Qualification;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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(textBoxFIO.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните ФИО", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(textBoxPassword.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение исполнителя");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new ImplementerBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
ImplementerFIO = textBoxFIO.Text,
|
|
||||||
Password = textBoxPassword.Text,
|
|
||||||
WorkExperience = (int)numericUpDownWorkExperience.Value,
|
|
||||||
Qualification = (int)numericUpDownQualification.Value
|
|
||||||
};
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<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>
|
|
130
Pizzeria/PizzeriaView/FormImplementers.Designer.cs
generated
130
Pizzeria/PizzeriaView/FormImplementers.Designer.cs
generated
@ -1,130 +0,0 @@
|
|||||||
namespace PizzeriaView
|
|
||||||
{
|
|
||||||
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.ToolsPanel = new System.Windows.Forms.Panel();
|
|
||||||
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();
|
|
||||||
this.ToolsPanel.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// ToolsPanel
|
|
||||||
//
|
|
||||||
this.ToolsPanel.Controls.Add(this.buttonRef);
|
|
||||||
this.ToolsPanel.Controls.Add(this.buttonDel);
|
|
||||||
this.ToolsPanel.Controls.Add(this.buttonUpd);
|
|
||||||
this.ToolsPanel.Controls.Add(this.buttonAdd);
|
|
||||||
this.ToolsPanel.Location = new System.Drawing.Point(608, 12);
|
|
||||||
this.ToolsPanel.Name = "ToolsPanel";
|
|
||||||
this.ToolsPanel.Size = new System.Drawing.Size(180, 426);
|
|
||||||
this.ToolsPanel.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// buttonRef
|
|
||||||
//
|
|
||||||
this.buttonRef.Location = new System.Drawing.Point(31, 206);
|
|
||||||
this.buttonRef.Name = "buttonRef";
|
|
||||||
this.buttonRef.Size = new System.Drawing.Size(126, 36);
|
|
||||||
this.buttonRef.TabIndex = 3;
|
|
||||||
this.buttonRef.Text = "Обновить";
|
|
||||||
this.buttonRef.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRef.Click += new System.EventHandler(this.buttonRef_Click);
|
|
||||||
//
|
|
||||||
// buttonDel
|
|
||||||
//
|
|
||||||
this.buttonDel.Location = new System.Drawing.Point(31, 142);
|
|
||||||
this.buttonDel.Name = "buttonDel";
|
|
||||||
this.buttonDel.Size = new System.Drawing.Size(126, 36);
|
|
||||||
this.buttonDel.TabIndex = 2;
|
|
||||||
this.buttonDel.Text = "Удалить";
|
|
||||||
this.buttonDel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDel.Click += new System.EventHandler(this.buttonDel_Click);
|
|
||||||
//
|
|
||||||
// buttonUpd
|
|
||||||
//
|
|
||||||
this.buttonUpd.Location = new System.Drawing.Point(31, 76);
|
|
||||||
this.buttonUpd.Name = "buttonUpd";
|
|
||||||
this.buttonUpd.Size = new System.Drawing.Size(126, 36);
|
|
||||||
this.buttonUpd.TabIndex = 1;
|
|
||||||
this.buttonUpd.Text = "Изменить";
|
|
||||||
this.buttonUpd.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUpd.Click += new System.EventHandler(this.buttonUpd_Click);
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(31, 16);
|
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(126, 36);
|
|
||||||
this.buttonAdd.TabIndex = 0;
|
|
||||||
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.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.ReadOnly = true;
|
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(590, 426);
|
|
||||||
this.dataGridView.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// FormImplementers
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Controls.Add(this.ToolsPanel);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormImplementers";
|
|
||||||
this.Text = "Исполнители";
|
|
||||||
this.Load += new System.EventHandler(this.FormImplementers_Load);
|
|
||||||
this.ToolsPanel.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel ToolsPanel;
|
|
||||||
private Button buttonRef;
|
|
||||||
private Button buttonDel;
|
|
||||||
private Button buttonUpd;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Pizzeria;
|
|
||||||
using PizzeriaContracts.BindingModels;
|
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace PizzeriaView
|
|
||||||
{
|
|
||||||
public partial class FormImplementers : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerLogic _logic;
|
|
||||||
|
|
||||||
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic implementerLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = implementerLogic;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 FormImplementers_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<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>
|
|
60
Pizzeria/PizzeriaView/FormMain.Designer.cs
generated
60
Pizzeria/PizzeriaView/FormMain.Designer.cs
generated
@ -32,19 +32,17 @@
|
|||||||
this.bookToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.bookToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ingridientsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ingridientsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.pizzasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.pizzasToolStripMenuItem = 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.componentsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
this.componentsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.componentPizzaToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
this.componentPizzaToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.запускРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||||
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
|
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
|
||||||
this.buttonOrderReady = new System.Windows.Forms.Button();
|
this.buttonOrderReady = new System.Windows.Forms.Button();
|
||||||
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
||||||
this.buttonRef = new System.Windows.Forms.Button();
|
this.buttonRef = new System.Windows.Forms.Button();
|
||||||
|
this.клиентToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -54,12 +52,11 @@
|
|||||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.bookToolStripMenuItem,
|
this.bookToolStripMenuItem,
|
||||||
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.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
|
this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1356, 24);
|
this.menuStrip1.Size = new System.Drawing.Size(1149, 24);
|
||||||
this.menuStrip1.TabIndex = 0;
|
this.menuStrip1.TabIndex = 0;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
@ -68,8 +65,7 @@
|
|||||||
this.bookToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.bookToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.ingridientsToolStripMenuItem,
|
this.ingridientsToolStripMenuItem,
|
||||||
this.pizzasToolStripMenuItem,
|
this.pizzasToolStripMenuItem,
|
||||||
this.клиентToolStripMenuItem,
|
this.клиентToolStripMenuItem});
|
||||||
this.исполнителиToolStripMenuItem});
|
|
||||||
this.bookToolStripMenuItem.Name = "bookToolStripMenuItem";
|
this.bookToolStripMenuItem.Name = "bookToolStripMenuItem";
|
||||||
this.bookToolStripMenuItem.Size = new System.Drawing.Size(87, 20);
|
this.bookToolStripMenuItem.Size = new System.Drawing.Size(87, 20);
|
||||||
this.bookToolStripMenuItem.Text = "Справочник";
|
this.bookToolStripMenuItem.Text = "Справочник";
|
||||||
@ -77,31 +73,17 @@
|
|||||||
// ingridientsToolStripMenuItem
|
// ingridientsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.ingridientsToolStripMenuItem.Name = "ingridientsToolStripMenuItem";
|
this.ingridientsToolStripMenuItem.Name = "ingridientsToolStripMenuItem";
|
||||||
this.ingridientsToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
this.ingridientsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.ingridientsToolStripMenuItem.Text = "Ингредиенты";
|
this.ingridientsToolStripMenuItem.Text = "Ингредиенты";
|
||||||
this.ingridientsToolStripMenuItem.Click += new System.EventHandler(this.IngridentsToolStripMenuItem_Click);
|
this.ingridientsToolStripMenuItem.Click += new System.EventHandler(this.IngridentsToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// pizzasToolStripMenuItem
|
// pizzasToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.pizzasToolStripMenuItem.Name = "pizzasToolStripMenuItem";
|
this.pizzasToolStripMenuItem.Name = "pizzasToolStripMenuItem";
|
||||||
this.pizzasToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
this.pizzasToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.pizzasToolStripMenuItem.Text = "Пиццы";
|
this.pizzasToolStripMenuItem.Text = "Пиццы";
|
||||||
this.pizzasToolStripMenuItem.Click += new System.EventHandler(this.PizzasToolStripMenuItem_Click);
|
this.pizzasToolStripMenuItem.Click += new System.EventHandler(this.PizzasToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// клиентToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.клиентToolStripMenuItem.Name = "клиентToolStripMenuItem";
|
|
||||||
this.клиентToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
|
||||||
this.клиентToolStripMenuItem.Text = "Клиент";
|
|
||||||
this.клиентToolStripMenuItem.Click += new System.EventHandler(this.ClientToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// исполнителиToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
|
||||||
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
|
||||||
this.исполнителиToolStripMenuItem.Text = "Исполнители";
|
|
||||||
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.employersToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// отчётыToolStripMenuItem
|
// отчётыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@ -133,13 +115,6 @@
|
|||||||
this.ordersToolStripMenuItem.Text = "Заказы";
|
this.ordersToolStripMenuItem.Text = "Заказы";
|
||||||
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// запускРаботToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem";
|
|
||||||
this.запускРаботToolStripMenuItem.Size = new System.Drawing.Size(92, 20);
|
|
||||||
this.запускРаботToolStripMenuItem.Text = "Запуск работ";
|
|
||||||
this.запускРаботToolStripMenuItem.Click += new System.EventHandler(this.startWorkToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
this.dataGridView.AllowUserToAddRows = false;
|
this.dataGridView.AllowUserToAddRows = false;
|
||||||
@ -151,12 +126,12 @@
|
|||||||
this.dataGridView.ReadOnly = true;
|
this.dataGridView.ReadOnly = true;
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(1098, 286);
|
this.dataGridView.Size = new System.Drawing.Size(855, 286);
|
||||||
this.dataGridView.TabIndex = 1;
|
this.dataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
this.buttonCreateOrder.Location = new System.Drawing.Point(1128, 59);
|
this.buttonCreateOrder.Location = new System.Drawing.Point(898, 53);
|
||||||
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
this.buttonCreateOrder.Size = new System.Drawing.Size(216, 22);
|
this.buttonCreateOrder.Size = new System.Drawing.Size(216, 22);
|
||||||
@ -167,7 +142,7 @@
|
|||||||
//
|
//
|
||||||
// buttonTakeOrderInWork
|
// buttonTakeOrderInWork
|
||||||
//
|
//
|
||||||
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(1128, 98);
|
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(898, 92);
|
||||||
this.buttonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(216, 22);
|
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(216, 22);
|
||||||
@ -178,7 +153,7 @@
|
|||||||
//
|
//
|
||||||
// buttonOrderReady
|
// buttonOrderReady
|
||||||
//
|
//
|
||||||
this.buttonOrderReady.Location = new System.Drawing.Point(1128, 135);
|
this.buttonOrderReady.Location = new System.Drawing.Point(898, 129);
|
||||||
this.buttonOrderReady.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonOrderReady.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonOrderReady.Name = "buttonOrderReady";
|
this.buttonOrderReady.Name = "buttonOrderReady";
|
||||||
this.buttonOrderReady.Size = new System.Drawing.Size(216, 22);
|
this.buttonOrderReady.Size = new System.Drawing.Size(216, 22);
|
||||||
@ -189,7 +164,7 @@
|
|||||||
//
|
//
|
||||||
// buttonIssuedOrder
|
// buttonIssuedOrder
|
||||||
//
|
//
|
||||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(1128, 175);
|
this.buttonIssuedOrder.Location = new System.Drawing.Point(898, 169);
|
||||||
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(216, 22);
|
this.buttonIssuedOrder.Size = new System.Drawing.Size(216, 22);
|
||||||
@ -200,7 +175,7 @@
|
|||||||
//
|
//
|
||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
this.buttonRef.Location = new System.Drawing.Point(1128, 216);
|
this.buttonRef.Location = new System.Drawing.Point(898, 210);
|
||||||
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.buttonRef.Name = "buttonRef";
|
this.buttonRef.Name = "buttonRef";
|
||||||
this.buttonRef.Size = new System.Drawing.Size(216, 22);
|
this.buttonRef.Size = new System.Drawing.Size(216, 22);
|
||||||
@ -209,11 +184,18 @@
|
|||||||
this.buttonRef.UseVisualStyleBackColor = true;
|
this.buttonRef.UseVisualStyleBackColor = true;
|
||||||
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||||
//
|
//
|
||||||
|
// клиентToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.клиентToolStripMenuItem.Name = "клиентToolStripMenuItem";
|
||||||
|
this.клиентToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.клиентToolStripMenuItem.Text = "Клиент";
|
||||||
|
this.клиентToolStripMenuItem.Click += new System.EventHandler(this.ClientToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1356, 319);
|
this.ClientSize = new System.Drawing.Size(1149, 319);
|
||||||
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.buttonOrderReady);
|
||||||
@ -251,7 +233,5 @@
|
|||||||
private ToolStripMenuItem componentPizzaToolStripMenuItem1;
|
private ToolStripMenuItem componentPizzaToolStripMenuItem1;
|
||||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
private ToolStripMenuItem ordersToolStripMenuItem;
|
||||||
private ToolStripMenuItem клиентToolStripMenuItem;
|
private ToolStripMenuItem клиентToolStripMenuItem;
|
||||||
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Pizzeria;
|
using Pizzeria;
|
||||||
using PizzeriaBusinessLogic.BusinessLogics;
|
|
||||||
using PizzeriaContracts.BindingModels;
|
using PizzeriaContracts.BindingModels;
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
using PizzeriaContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
@ -11,15 +10,13 @@ namespace PizzeriaView
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
private readonly IWorkProcess _workProcess;
|
|
||||||
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
||||||
{
|
{
|
||||||
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)
|
||||||
@ -37,7 +34,6 @@ namespace PizzeriaView
|
|||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["PizzaId"].Visible = false;
|
dataGridView.Columns["PizzaId"].Visible = false;
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
dataGridView.Columns["ImplementerId"].Visible = false;
|
|
||||||
dataGridView.Columns["PizzaName"].AutoSizeMode =
|
dataGridView.Columns["PizzaName"].AutoSizeMode =
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
@ -198,20 +194,5 @@ namespace PizzeriaView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void employersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
|
||||||
if (service is FormImplementers form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startWorkToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
|
||||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,19 +40,15 @@ namespace Pizzeria
|
|||||||
});
|
});
|
||||||
|
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
|
||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<IPizzaStorage, PizzaStorage>();
|
services.AddTransient<IPizzaStorage, PizzaStorage>();
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
|
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
|
||||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IPizzaLogic, PizzaLogic>();
|
services.AddTransient<IPizzaLogic, PizzaLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
services.AddTransient<IWorkProcess, WorkModeling>();
|
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
@ -69,8 +65,6 @@ namespace Pizzeria
|
|||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
services.AddTransient<FormClients>();
|
services.AddTransient<FormClients>();
|
||||||
services.AddTransient<EntityFrameworkDesignServicesBuilder>();
|
services.AddTransient<EntityFrameworkDesignServicesBuilder>();
|
||||||
services.AddTransient<FormImplementers>();
|
|
||||||
services.AddTransient<FormImplementer>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user