Фикс ошибок + добавление BusinessLogic

This commit is contained in:
Pyatkin I.A 2024-04-28 21:46:06 +04:00
parent f6295ae87d
commit 332e242336
23 changed files with 816 additions and 18 deletions

View File

@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureFactoryDataModels"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureFactoryContracts", "FurnitureFactoryContracts\FurnitureFactoryContracts.csproj", "{E0818635-0C99-435E-99E5-8241473D0E48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureFactoryBusinessLogic", "FurnitureFactoryBusinessLogic\FurnitureFactoryBusinessLogic.csproj", "{F823EC86-06B1-4D50-BD39-85CF213F7A00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -27,6 +29,10 @@ Global
{E0818635-0C99-435E-99E5-8241473D0E48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0818635-0C99-435E-99E5-8241473D0E48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0818635-0C99-435E-99E5-8241473D0E48}.Release|Any CPU.Build.0 = Release|Any CPU
{F823EC86-06B1-4D50-BD39-85CF213F7A00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F823EC86-06B1-4D50-BD39-85CF213F7A00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F823EC86-06B1-4D50-BD39-85CF213F7A00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F823EC86-06B1-4D50-BD39-85CF213F7A00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,123 @@
using Microsoft.Extensions.Logging;
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.BusinessLogicsContracts;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.StorageContracts;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FurnitureFactoryBusinessLogic.BusinessLogics
{
public class ClientLogic : IClientLogic
{
private readonly ILogger _logger;
private readonly IClientStorage _clientStorage;
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage clientStorage)
{
_logger = logger;
_clientStorage = clientStorage;
}
public List<ClientViewModel>? ReadList(ClientSearchModel? model)
{
_logger.LogInformation("ReadList. ClientFIO:{ClientFIO}. Id:{Id}", model?.ClientFIO, model?.Id);
var list = model == null ? _clientStorage.GetFullList() : _clientStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public ClientViewModel? ReadElement(ClientSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. ClientFIO:{ClientFIO}. Id:{Id}", model.ClientFIO, model.Id);
var element = _clientStorage.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(ClientBindingModel model)
{
CheckModel(model);
if (_clientStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(ClientBindingModel model)
{
CheckModel(model);
if (_clientStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(ClientBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_clientStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(ClientBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.ClientFIO))
{
throw new ArgumentNullException("Нет имени клиента", nameof(model.ClientFIO));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет логина клиента", nameof(model.ClientFIO));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля учетной записи клиента", nameof(model.ClientFIO));
}
_logger.LogInformation("Client. ClientFIO:{ClientFIO}. Email:{Email}. Password:{Password}. Id:{Id}", model.ClientFIO, model.Email, model.Password, model.Id);
var element = _clientStorage.GetElement(new ClientSearchModel
{
Email = model.Email
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Клиент с таким логином уже есть");
}
}
}
}

View File

@ -0,0 +1,129 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.BusinessLogicsContracts;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.StorageContracts;
using FurnitureFactoryContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FurnitureFactoryBusinessLogic.BusinessLogics
{
public class EmployeeLogic : IEmployeeLogic
{
private readonly ILogger _logger;
private readonly IEmployeeStorage _employeeStorage;
public EmployeeLogic(ILogger<EmployeeLogic> logger, IEmployeeStorage employeeStorage)
{
_logger = logger;
_employeeStorage = employeeStorage;
}
public bool Create(EmployeeBindingModel model)
{
CheckModel(model);
if (_employeeStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(EmployeeBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_employeeStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public EmployeeViewModel? ReadElement(EmployeeSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. FIO:{FIO}.Id:{ Id}",
model.EmployeeFIO, model.Id);
var element = _employeeStorage.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<EmployeeViewModel>? ReadList(EmployeeSearchModel? model)
{
_logger.LogInformation("ReadList. FIO:{FIO}.Id:{ Id} ", model?.EmployeeFIO, model?.Id);
var list = (model == null) ? _employeeStorage.GetFullList() :
_employeeStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Update(EmployeeBindingModel model)
{
CheckModel(model);
if (_employeeStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(EmployeeBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.WorkExperience < 0)
{
throw new ArgumentException("Опыт работы не должен быть отрицательным", nameof(model.WorkExperience));
}
if (model.Qualification < 0)
{
throw new ArgumentException("Квалификация не должна быть отрицательной", nameof(model.Qualification));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля сотрудника", nameof(model.EmployeeFIO));
}
if (string.IsNullOrEmpty(model.EmployeeFIO))
{
throw new ArgumentNullException("Нет фио сотрудника", nameof(model.EmployeeFIO));
}
_logger.LogInformation("Employee. Id: {Id}, FIO: {FIO}", model.Id, model.EmployeeFIO);
var element = _employeeStorage.GetElement(new EmployeeSearchModel
{
EmployeeFIO = model.EmployeeFIO,
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Сотрудник с таким фио уже есть");
}
}
}
}

View File

@ -0,0 +1,112 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.BusinessLogicsContracts;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.StorageContracts;
using FurnitureFactoryContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FurnitureFactoryBusinessLogic.BusinessLogics
{
public class FurnitureLogic : IFurnitureLogic
{
private readonly ILogger _logger;
private readonly IFurnitureStorage _furnitureStorage;
public FurnitureLogic(ILogger<FurnitureLogic> logger, IFurnitureStorage furnitureStorage)
{
_logger = logger;
_furnitureStorage = furnitureStorage;
}
public List<FurnitureViewModel>? ReadList(FurnitureSearchModel? model)
{
_logger.LogInformation("ReadList. FurnitureName:{FurnitureName}.Id:{ Id}", model?.FurnitureName, model?.Id);
var list = model == null ? _furnitureStorage.GetFullList() : _furnitureStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public FurnitureViewModel? ReadElement(FurnitureSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. FurnitureName:{FurnitureName}.Id:{ Id}", model.FurnitureName, model.Id);
var element = _furnitureStorage.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(FurnitureBindingModel model)
{
CheckModel(model);
if (_furnitureStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(FurnitureBindingModel model)
{
CheckModel(model);
if (_furnitureStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(FurnitureBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_furnitureStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(FurnitureBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.FurnitureName))
{
throw new ArgumentNullException("Нет названия мебели", nameof(model.FurnitureName));
}
if (model.FurniturePrice <= 0)
{
throw new ArgumentNullException("Цена мебели должна быть больше 0", nameof(model.FurniturePrice));
}
_logger.LogInformation("Furniture. FurnitureName:{FurnitureName}.FurniturePrice:{FurniturePrice}.Id: { Id}", model.FurnitureName, model.FurniturePrice, model.Id);
var element = _furnitureStorage.GetElement(new FurnitureSearchModel
{
FurnitureName = model.FurnitureName
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Мебель с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,112 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.BusinessLogicsContracts;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.StorageContracts;
using FurnitureFactoryContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FurnitureFactoryBusinessLogic.BusinessLogics
{
public class MaterialLogic : IMaterialLogic
{
private readonly ILogger _logger;
private readonly IMaterialStorage _materialStorage;
public MaterialLogic(ILogger<MaterialLogic> logger, IMaterialStorage materialStorage)
{
_logger = logger;
_materialStorage = materialStorage;
}
public List<MaterialViewModel>? ReadList(MaterialSearchModel? model)
{
_logger.LogInformation("ReadList. MaterialName:{MaterialName}.Id:{ Id}", model?.MaterialName, model?.Id);
var list = model == null ? _materialStorage.GetFullList() : _materialStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public MaterialViewModel? ReadElement(MaterialSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. MaterialName:{MaterialName}.Id:{ Id}", model.MaterialName, model.Id);
var element = _materialStorage.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(MaterialBindingModel model)
{
CheckModel(model);
if (_materialStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(MaterialBindingModel model)
{
CheckModel(model);
if (_materialStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(MaterialBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_materialStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(MaterialBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.MaterialName))
{
throw new ArgumentNullException("Нет названия материала", nameof(model.MaterialName));
}
if (model.MaterialCost <= 0)
{
throw new ArgumentNullException("Цена материала должна быть больше 0", nameof(model.MaterialCost));
}
_logger.LogInformation("Material. MaterialName:{MaterialName}.MaterialCost:{ MaterialCost}.Id: { Id}", model.MaterialName, model.MaterialCost, model.Id);
var element = _materialStorage.GetElement(new MaterialSearchModel
{
MaterialName = model.MaterialName
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Материал с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,141 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.BusinessLogicsContracts;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.StorageContracts;
using FurnitureFactoryContracts.ViewModels;
using FurnitureFactoryDataModels.Enums;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FurnitureFactoryBusinessLogic.BusinessLogics
{
public class OrderLogic : IOrderLogic
{
private readonly ILogger _logger;
private readonly IOrderStorage _orderStorage;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
{
_logger = logger;
_orderStorage = orderStorage;
}
public OrderViewModel? ReadElement(OrderSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. DateFrom:{DateFrom}. DateTo:{DateTo}. Id:{Id}", model.DateFrom, model.DateTo, model.Id);
var element = _orderStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
{
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
return list;
}
public bool CreateOrder(OrderBindingModel model)
{
CheckModel(model);
if (model.OStatus != OrderStatus.Неизвестен && model.PStatus != PaymentStatus.Неизвестно)
{
_logger.LogWarning("Invalid order status");
return false;
}
model.OStatus = OrderStatus.Принят; model.PStatus = PaymentStatus.Неоплачен;
if (_orderStorage.Insert(model) == null)
{
model.OStatus = OrderStatus.Неизвестен;
model.PStatus = PaymentStatus.Неизвестно;
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
private bool StatusUpdate(OrderBindingModel model, OrderStatus newStatusO, PaymentStatus newStatusP)
{
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
if (viewModel == null)
{
throw new ArgumentNullException(nameof(model));
}
if (viewModel.OStatus + 1 != newStatusO && viewModel.PStatus + 1 != newStatusP)
{
_logger.LogWarning("Change status operation failed");
throw new InvalidOperationException();
}
model.OStatus = newStatusO;
model.PStatus = newStatusP;
if (model.OStatus == OrderStatus.Готов && model.PStatus == PaymentStatus.Частично)
{
model.DateImplement = DateTime.Now;
}
else
{
model.DateImplement = viewModel.DateImplement;
}
if (viewModel.EmployeeId.HasValue)
{
model.EmployeeId = viewModel.EmployeeId.Value;
}
CheckModel(model, false);
if (_orderStorage.Update(model) == null)
{
_logger.LogWarning("Change status operation failed");
return false;
}
return true;
}
public bool TakeOrderInWork(OrderBindingModel model)
{
return StatusUpdate(model, OrderStatus.Выполняется, PaymentStatus.Частично);
}
public bool FinishOrder(OrderBindingModel model)
{
model.DateImplement = DateTime.Now;
return StatusUpdate(model, OrderStatus.Готов, PaymentStatus.Оплачен);
}
public bool DeliveryOrder(OrderBindingModel model)
{
return StatusUpdate(model, OrderStatus.Выдан, PaymentStatus.Оплачен);
}
private void CheckModel(OrderBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.OrderPrice <= 0)
{
throw new ArgumentNullException("Стоимость заказа должна быть больше 0", nameof(model.OrderPrice));
}
_logger.LogInformation("Order. Id: {Id}. OrderPrice: {OrderPrice}. FurnitureId: {FurnitureId}", model.Id, model.OrderPrice, model.FurnitureId);
var element = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
if (element != null && element.Id == model.Id)
{
throw new InvalidOperationException("Заказ с таким номером уже есть");
}
}
}
}

View File

@ -0,0 +1,138 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.BusinessLogicsContracts;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using FurnitureFactoryDataModels.Enums;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FurnitureFactoryBusinessLogic.BusinessLogics
{
public class WorkModelingEmployee : IWorkEmployeeImitationProcess
{
private readonly ILogger _logger;
private readonly Random _rnd;
private IOrderLogic? _orderLogic;
public WorkModelingEmployee(ILogger<WorkModelingEmployee> logger)
{
_logger = logger;
_rnd = new Random(1000);
}
public void DoWork(IEmployeeLogic employeeLogic, IOrderLogic orderLogic)
{
_orderLogic = orderLogic;
var employees = employeeLogic.ReadList(null);
if (employees == null)
{
_logger.LogWarning("DoWork. Employees is null");
return;
}
var orders = _orderLogic.ReadList(new OrderSearchModel { OStatuses = new() { OrderStatus.Принят, 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 employee in employees)
{
Task.Run(() => WorkerWorkAsync(employee, orders));
}
}
private async Task WorkerWorkAsync(EmployeeViewModel employee, List<OrderViewModel> orders)
{
if (_orderLogic == null || employee == null)
{
return;
}
await RunOrderInWork(employee, orders);
await Task.Run(() =>
{
foreach (var order in orders)
{
try
{
_logger.LogDebug("DoWork. Worker {Id} try get order {Order}", employee.Id, order.Id);
_orderLogic.TakeOrderInWork(new OrderBindingModel
{
Id = order.Id,
EmployeeId = employee.Id
});
Thread.Sleep(employee.WorkExperience * _rnd.Next(100, 1000) * order.FurnitureCount);
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", employee.Id, order.Id);
_orderLogic.FinishOrder(new OrderBindingModel
{
Id = order.Id
});
Thread.Sleep(employee.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;
}
}
});
}
private async Task RunOrderInWork(EmployeeViewModel employee, List<OrderViewModel> allOrders)
{
if (_orderLogic == null || employee == null || allOrders == null || allOrders.Count == 0)
{
return;
}
try
{
var runOrder = await Task.Run(() => allOrders.FirstOrDefault(x => x.EmployeeId == employee.Id && x.OStatus == OrderStatus.Выполняется));
if (runOrder == null)
{
return;
}
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", employee.Id, runOrder.Id);
Thread.Sleep(employee.WorkExperience * _rnd.Next(100, 300) * runOrder.FurnitureCount);
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", employee.Id, runOrder.Id);
_orderLogic.FinishOrder(new OrderBindingModel
{
Id = runOrder.Id
});
Thread.Sleep(employee.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;
}
}
}
}

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FurnitureFactoryContracts\FurnitureFactoryContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -13,6 +13,8 @@ namespace FurnitureFactoryContracts.BindingModels
public string EmployeeFIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public int WorkExperience { get; set; }
public int Qualification { get; set; }
}
}

View File

@ -10,7 +10,7 @@ namespace FurnitureFactoryContracts.BindingModels
public class MaterialBindingModel : IMaterialModel
{
public int Id { get; set; }
public string MaretialName { get; set; } = string.Empty;
public string MaterialName { get; set; } = string.Empty;
public double MaterialCost { get; set; }
}
}

View File

@ -17,7 +17,7 @@ namespace FurnitureFactoryContracts.BindingModels
public int FurnitureCount { get; set; }
public double OrderPrice { get; set; }
public OrderStatus OStatus { get; set; } = OrderStatus.Неизвестен;
public PaymentStatus PStatus { get; set; } = PaymentStatus.Неоплачен;
public PaymentStatus PStatus { get; set; } = PaymentStatus.Неизвестно;
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
public Dictionary<int, (IFurnitureModel, int)> OrderFurnitures { get; set; } = new();

View File

@ -1,5 +1,6 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,5 +1,6 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,5 +1,6 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,5 +1,6 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,5 +1,6 @@
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,5 @@
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
@ -16,10 +17,10 @@ namespace FurnitureFactoryContracts.StorageContracts
EmployeeViewModel? GetElement(EmployeeSearchModel model);
EmployeeViewModel? Insert(EmployeeSearchModel model);
EmployeeViewModel? Insert(EmployeeBindingModel model);
EmployeeViewModel? Update(EmployeeSearchModel model);
EmployeeViewModel? Update(EmployeeBindingModel model);
EmployeeViewModel? Delete(EmployeeSearchModel model);
EmployeeViewModel? Delete(EmployeeBindingModel model);
}
}

View File

@ -1,4 +1,5 @@
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
@ -13,8 +14,8 @@ namespace FurnitureFactoryContracts.StorageContracts
List<FurnitureViewModel> GetFullList();
List<FurnitureViewModel> GetFilteredList(FurnitureSearchModel model);
FurnitureViewModel? GetElement(FurnitureSearchModel model);
FurnitureViewModel? Insert(FurnitureSearchModel model);
FurnitureViewModel? Update(FurnitureSearchModel model);
FurnitureViewModel? Delete(FurnitureSearchModel model);
FurnitureViewModel? Insert(FurnitureBindingModel model);
FurnitureViewModel? Update(FurnitureBindingModel model);
FurnitureViewModel? Delete(FurnitureBindingModel model);
}
}

View File

@ -1,4 +1,5 @@
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.BindingModels;
using FurnitureFactoryContracts.SearchModels;
using FurnitureFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
@ -13,8 +14,8 @@ namespace FurnitureFactoryContracts.StorageContracts
List<MaterialViewModel> GetFullList();
List<MaterialViewModel> GetFilteredList(MaterialSearchModel model);
MaterialViewModel? GetElement(MaterialSearchModel model);
MaterialViewModel? Insert(MaterialSearchModel model);
MaterialViewModel? Update(MaterialSearchModel model);
MaterialViewModel? Delete(MaterialSearchModel model);
MaterialViewModel? Insert(MaterialBindingModel model);
MaterialViewModel? Update(MaterialBindingModel model);
MaterialViewModel? Delete(MaterialBindingModel model);
}
}

View File

@ -19,5 +19,10 @@ namespace FurnitureFactoryContracts.ViewModels
public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
[DisplayName("Стаж работы")]
public int WorkExperience { get; set; }
[DisplayName("Квалификация")]
public int Qualification { get; set; }
}
}

View File

@ -29,7 +29,7 @@ namespace FurnitureFactoryContracts.ViewModels
[DisplayName("Статус заказа")]
public OrderStatus OStatus { get; set; } = OrderStatus.Неизвестен;
[DisplayName("Статус оплаты")]
public PaymentStatus PStatus { get; set; } = PaymentStatus.Неоплачен;
public PaymentStatus PStatus { get; set; } = PaymentStatus.Неизвестно;
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")]

View File

@ -8,8 +8,9 @@ namespace FurnitureFactoryDataModels.Enums
{
public enum PaymentStatus
{
Неоплачен = -1,
Частично = 0,
Оплачен = 1
Неизвестно = -1,
Неоплачен = 0,
Частично = 1,
Оплачен = 2
}
}

View File

@ -11,5 +11,7 @@ namespace FurnitureFactoryDataModels.Models
string EmployeeFIO { get; }
string Email { get; }
string Password { get; }
int WorkExperience { get; }
int Qualification { get; }
}
}