I'm kinda tired... But it's not done yet... I have to work moooooooooooooore
This commit is contained in:
parent
3553b9b615
commit
8fd17b3e50
@ -13,10 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautyStudioBusinessLogic",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautyStudioDatabaseImplement", "BeautyStudioDatabaseImplement\BeautyStudioDatabaseImplement.csproj", "{8BEBC76F-F7B5-46CB-A42B-28E133452D52}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautyStudioRestAPI", "BeautyStudioRestAPI\BeautyStudioRestAPI.csproj", "{50B724DE-086C-4931-8718-AF16E14ED5B0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientWebApp", "ClientWebApp\ClientWebApp.csproj", "{970D4EF3-BDAA-483F-9A37-E2CBED2865A2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -43,14 +39,6 @@ Global
|
||||
{8BEBC76F-F7B5-46CB-A42B-28E133452D52}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8BEBC76F-F7B5-46CB-A42B-28E133452D52}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8BEBC76F-F7B5-46CB-A42B-28E133452D52}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{50B724DE-086C-4931-8718-AF16E14ED5B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{50B724DE-086C-4931-8718-AF16E14ED5B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{50B724DE-086C-4931-8718-AF16E14ED5B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{50B724DE-086C-4931-8718-AF16E14ED5B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{970D4EF3-BDAA-483F-9A37-E2CBED2865A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{970D4EF3-BDAA-483F-9A37-E2CBED2865A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{970D4EF3-BDAA-483F-9A37-E2CBED2865A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{970D4EF3-BDAA-483F-9A37-E2CBED2865A2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -10,6 +10,7 @@
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
|
||||
<PackageReference Include="NLog" Version="5.3.2" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.10" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
</ItemGroup>
|
||||
|
@ -1,155 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.BusinessLogicContracts;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BeautyStudioBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class ClientLogic : IClientLogic
|
||||
{
|
||||
private readonly int _passwordMaxLength = 50;
|
||||
private readonly int _passwordMinLength = 10;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IClientStorage _clientStorage;
|
||||
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage clientStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_clientStorage = clientStorage;
|
||||
}
|
||||
public bool Create(ClientBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_clientStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert 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;
|
||||
}
|
||||
|
||||
public ClientViewModel? ReadElement(ClientSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. ClientLogin: {ClientLogin}. ClientFIO: {ClientFIO} ClientEmail: {ClientEmail} Id: {Id}",
|
||||
model.ClientFIO, model.ClientLogin, model.ClientEmail, 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 List<ClientViewModel>? ReadList(ClientSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ClientLogin: {ClientLogin}. ClientFIO: {ClientFIO} ClientEmail: {ClientEmail} Id: {Id}",
|
||||
model?.ClientFIO, model?.ClientLogin, model?.ClientEmail, 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 bool Update(ClientBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_clientStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update 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.ClientLogin))
|
||||
{
|
||||
throw new ArgumentNullException("Нет логина клиента", nameof(model.ClientLogin));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.ClientEmail))
|
||||
{
|
||||
throw new ArgumentNullException("Нет почты клиента", nameof(model.ClientEmail));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.ClientPassword))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля", nameof(model.ClientPassword));
|
||||
}
|
||||
if (model.ClientPassword.Length < _passwordMinLength)
|
||||
{
|
||||
throw new ArgumentNullException("Пароль слишком короткий", nameof(model.ClientPassword));
|
||||
}
|
||||
if (model.ClientPassword.Length > _passwordMaxLength)
|
||||
{
|
||||
throw new ArgumentNullException("Пароль слишком длинный", nameof(model.ClientPassword));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Client. ClientFIO: {ClientFIO}. ClientLogin: {ClientLogin} ClientEmail: {ClientEmail} Id: {Id}",
|
||||
model.ClientFIO, model.ClientLogin, model.ClientEmail, model.Id);
|
||||
|
||||
var element = _clientStorage.GetElement(new ClientSearchModel
|
||||
{
|
||||
ClientEmail = model.ClientEmail
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Клиент с такой почтой уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -102,7 +102,7 @@ namespace BeautyStudioBusinessLogic.BusinessLogic
|
||||
throw new ArgumentNullException("Цена косметики должна быть больше 0", nameof(model.CosmeticPrice));
|
||||
}
|
||||
_logger.LogInformation("Cosmetic. CosmeticName: {CosmeticName}. CosmeticPrice: {CosmeticPrice}. Id: {Id}",
|
||||
model.CosmeticName, model.CosmeticPrice, model.Id);
|
||||
model.CosmeticName, model.CosmeticPrice, model.Id);
|
||||
var element = _cosmeticStorage.GetElement(new CosmeticSearchModel
|
||||
{
|
||||
CosmeticName = model.CosmeticName
|
||||
|
@ -12,11 +12,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class LaborCostLogic : ILaborCostLogic
|
||||
public class LaborCostsLogic : ILaborCostLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILaborCostStorage _laborCostsStorage;
|
||||
public LaborCostLogic(ILogger<LaborCostLogic> logger, ILaborCostStorage laborCostsStorage)
|
||||
public LaborCostsLogic(ILogger<LaborCostsLogic> logger, ILaborCostStorage laborCostsStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_laborCostsStorage = laborCostsStorage;
|
||||
@ -98,9 +98,12 @@ namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Количество часов должно быть больше 0", nameof(model.TimeSpent));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.Difficulty))
|
||||
{
|
||||
throw new ArgumentNullException("Не указана сложность трудозатраты", nameof(model.Difficulty));
|
||||
}
|
||||
_logger.LogInformation("LaborCost. TimeSpent: {TimeSpent}. Difficulty: {Difficulty}. Id: {Id}",
|
||||
model.TimeSpent, model.Id);
|
||||
model.TimeSpent, model.Difficulty, model.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using BeautyStudioContracts.BusinessLogicContracts;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -16,7 +17,7 @@ namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
public OrderLogic(ILogger<StaffLogic> logger, IOrderStorage orderStorage)
|
||||
public OrderLogic(ILogger<StoreKeeperLogic> logger, IOrderStorage orderStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
@ -40,8 +41,8 @@ namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. DateCreate: {DateCreate}. Id: {Id}",
|
||||
model.DateCreate, model.Id);
|
||||
_logger.LogInformation("ReadElement. DateCreate: {DateCreate}. DateComplete: {DateComplete}. Id: {Id}",
|
||||
model.DateCreate, model.DateComplete, model.Id);
|
||||
var element = _orderStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
@ -98,5 +99,55 @@ namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
nameof(model.Sum));
|
||||
}
|
||||
}
|
||||
public bool ChangeStatus(OrderBindingModel model, OrderStatus newStatus)
|
||||
{
|
||||
var vmodel = _orderStorage.GetElement(new() { Id = model.Id });
|
||||
|
||||
if (vmodel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if ((int)vmodel.Status + 1 != (int)newStatus)
|
||||
{
|
||||
throw new InvalidOperationException($"Попытка перевести заказ не в следующий статус: " +
|
||||
$"Текущий статус: {vmodel.Status} \n" +
|
||||
$"Планируемый статус: {newStatus} \n" +
|
||||
$"Доступный статус: {(OrderStatus)((int)vmodel.Status + 1)}");
|
||||
}
|
||||
|
||||
model.Status = newStatus;
|
||||
model.DateCreate = vmodel.DateCreate;
|
||||
|
||||
model.ServiceId = vmodel.ServiceId;
|
||||
model.Sum = vmodel.Sum;
|
||||
|
||||
var result = _orderStorage.Update(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Перевод заказа в состояние принятого на выполнение
|
||||
public bool TakeOrderInWork(OrderBindingModel model)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Принято);
|
||||
}
|
||||
|
||||
//Перевод заказа в состояние выполнения заказа
|
||||
public bool FinishOrder(OrderBindingModel model)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||
}
|
||||
//Перевод заказа в состояние выполненности (окончательное завершение)
|
||||
public bool DeliveryOrder(OrderBindingModel model)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Выполнено);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
_logger = logger;
|
||||
_procedureStorage = procedureStorage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model)
|
||||
{
|
||||
|
@ -99,13 +99,13 @@ namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
throw new ArgumentNullException("Нет названия услуги", nameof(model.ServiceName));
|
||||
}
|
||||
|
||||
if (model.Sum <= 0)
|
||||
if (model.ServicePrice <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Цена услуги должна быть больше 0",
|
||||
nameof(model.Sum));
|
||||
nameof(model.ServicePrice));
|
||||
}
|
||||
_logger.LogInformation("Service. ServiceName: {ServiceName}. Cost: {Cost}. Id: {Id}",
|
||||
model.ServiceName, model.Sum, model.Id);
|
||||
model.ServiceName, model.ServicePrice, model.Id);
|
||||
var element = _serviceStorage.GetElement(new ServiceSearchModel
|
||||
{
|
||||
ServiceName = model.ServiceName
|
||||
|
@ -1,159 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.BusinessLogicContracts;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BeautyStudioBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class StaffLogic : IStaffLogic
|
||||
{
|
||||
private readonly int _passwordMaxLength = 25;
|
||||
private readonly int _passwordMinLength = 6;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStaffStorage _staffMemberStorage;
|
||||
public StaffLogic(ILogger<StaffLogic> logger, IStaffStorage staffMemberStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_staffMemberStorage = staffMemberStorage;
|
||||
}
|
||||
public bool Create(StaffBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_staffMemberStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(StaffBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
|
||||
_logger.LogInformation("Delete. Id: {Id}", model.Id);
|
||||
|
||||
if (_staffMemberStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public StaffViewModel? ReadElement(StaffSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. StaffLogin: {StaffLogin}. StaffEmail: {StaffEmail} Id: {Id}",
|
||||
model.StaffLogin, model.StaffEmail, model.Id);
|
||||
|
||||
var element = _staffMemberStorage.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<StaffViewModel>? ReadList(StaffSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadElement. StaffLogin: {StaffLogin}. StaffEmail: {StaffEmail} Id: {Id}",
|
||||
model?.StaffLogin, model?.StaffEmail, model?.Id);
|
||||
|
||||
var list = model == null ? _staffMemberStorage.GetFullList() : _staffMemberStorage.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(StaffBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_staffMemberStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(StaffBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.StaffFIO))
|
||||
{
|
||||
throw new ArgumentNullException("Нет имени сотрудника", nameof(model.StaffLogin));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.StaffLogin))
|
||||
{
|
||||
throw new ArgumentNullException("Нет логина сотрудника", nameof(model.StaffLogin));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.StaffEmail))
|
||||
{
|
||||
throw new ArgumentNullException("Нет почты сотрудника", nameof(model.StaffEmail));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.StaffPassword))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля сотрудника", nameof(model.StaffPassword));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.StaffPhone))
|
||||
{
|
||||
throw new ArgumentNullException("Нет телефона сотрудника", nameof(model.StaffEmail));
|
||||
}
|
||||
|
||||
if (model.StaffPassword.Length < _passwordMinLength)
|
||||
{
|
||||
throw new ArgumentNullException("Пароль слишком короткий", nameof(model.StaffPassword));
|
||||
}
|
||||
|
||||
if (model.StaffPassword.Length > _passwordMaxLength)
|
||||
{
|
||||
throw new ArgumentNullException("Пароль слишком длинный", nameof(model.StaffPassword));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. StaffLogin: {StaffLogin}. StaffEmail: {StaffEmail} Id: {Id}",
|
||||
model.StaffLogin, model.StaffEmail, model.Id);
|
||||
|
||||
var element = _staffMemberStorage.GetElement(new StaffSearchModel
|
||||
{
|
||||
StaffEmail = model.StaffEmail
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Сотрудник с такой почтой уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BeautyStudioDataModels\BeautyStudioDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -1,19 +0,0 @@
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.BindingModels
|
||||
{
|
||||
public class ClientBindingModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
public string ClientEmail { get; set; } = string.Empty;
|
||||
public string ClientPhone { get; set; } = string.Empty;
|
||||
public string ClientLogin { get; set; } = string.Empty;
|
||||
public string ClientPassword { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using BeautyStudioDataModels.Models;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -12,7 +13,10 @@ namespace BeautyStudioContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public string CosmeticName { get; set; } = string.Empty;
|
||||
public double CosmeticPrice { get; set; }
|
||||
public int StoreKeeperId { get; set; }
|
||||
public int LaborCostId { get; set; }
|
||||
|
||||
public List<ServiceCosmeticViewModel> ServiceCosmetic { get; set; } = new();
|
||||
public List<ServiceProcedureViewModel> ServiceProcedure { get; set; } = new();
|
||||
public List<OrderServiceViewModel> OrderService { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,10 @@ namespace BeautyStudioContracts.BindingModels
|
||||
public class LaborCostBindingModel : ILaborCostModel
|
||||
{
|
||||
public int Id { get ; set; }
|
||||
|
||||
public int TimeSpent { get; set; }
|
||||
public int StaffId { get; set; }
|
||||
|
||||
public string Difficulty { get; set; } = string.Empty;
|
||||
public int StoreKeeperId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BeautyStudioDataModels.Enums;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDataModels.Enums;
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -15,8 +16,11 @@ namespace BeautyStudioContracts.BindingModels
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
public DateTime? DateComplete { get; set; }
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
public int ClientId { get; set; }
|
||||
public int ServiceId { get; set; }
|
||||
public int? StaffId { get; set; }
|
||||
public int CosmeticId { get; set; }
|
||||
|
||||
public List<OrderServiceViewModel> OrderService { get; set; } = new();
|
||||
public List<OrderCosmeticViewModel> OrderCosmetic { get; set; } = new();
|
||||
public List<OrderProcedureViewModel> OrderProcedure { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,9 @@ namespace BeautyStudioContracts.BindingModels
|
||||
public string ProcedureName { get; set; } = string.Empty;
|
||||
public double ProcedureCost { get; set; }
|
||||
public string ProcedureDescription { get; set; } = string.Empty;
|
||||
|
||||
public List<CosmeticProcedureViewModel> ProcedureCosmetics { get; set; } = new();
|
||||
public List<ServiceProcedureViewModel> ServiceProcedure { get; set; } = new();
|
||||
public List<OrderProcedureViewModel> OrderProcedure { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BeautyStudioDataModels.Models;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -11,7 +12,10 @@ namespace BeautyStudioContracts.BindingModels
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ServiceName { get; set; } = string.Empty;
|
||||
public double Sum { get; set; }
|
||||
public int StaffId { get; set; }
|
||||
public double ServicePrice { get; set; }
|
||||
public int StoreKeeperId { get; set; }
|
||||
public List<ServiceCosmeticViewModel> ServiceCosmetic { get; set; } = new();
|
||||
public List<ServiceProcedureViewModel> ServiceProcedure { get; set; } = new();
|
||||
public List<OrderServiceViewModel> OrderService { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.BindingModels
|
||||
{
|
||||
public class StaffBindingModel : IStaffModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string StaffFIO { get; set; } = string.Empty;
|
||||
public string StaffLogin { get; set; } = string.Empty;
|
||||
public string StaffPassword { get; set; } = string.Empty;
|
||||
public string StaffEmail { get; set; } = string.Empty;
|
||||
public string StaffPhone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
|
||||
namespace BeautyStudioContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IClientLogic
|
||||
{
|
||||
List<ClientViewModel>? ReadList(ClientSearchModel? model);
|
||||
ClientViewModel? ReadElement(ClientSearchModel model);
|
||||
bool Create(ClientBindingModel model);
|
||||
bool Update(ClientBindingModel model);
|
||||
bool Delete(ClientBindingModel model);
|
||||
}
|
||||
}
|
@ -12,5 +12,9 @@ namespace BeautyStudioContracts.BusinessLogicContracts
|
||||
bool Create(OrderBindingModel model);
|
||||
bool Delete(OrderBindingModel model);
|
||||
bool Update(OrderBindingModel model);
|
||||
|
||||
bool TakeOrderInWork(OrderBindingModel model);
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
|
||||
namespace BeautyStudioContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IStaffLogic
|
||||
{
|
||||
List<StaffViewModel>? ReadList(StaffSearchModel? model);
|
||||
StaffViewModel? ReadElement(StaffSearchModel model);
|
||||
bool Create(StaffBindingModel model);
|
||||
bool Update(StaffBindingModel model);
|
||||
bool Delete(StaffBindingModel model);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.SearchModels
|
||||
{
|
||||
public class ClientSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ClientFIO { get; set; }
|
||||
public string? ClientEmail { get; set; }
|
||||
public string? ClientPhone { get; set; }
|
||||
public string? ClientLogin { get; set; }
|
||||
public string? ClientPassword { get; set; }
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ namespace BeautyStudioContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? CosmeticName { get; set; }
|
||||
public int? StoreKeeperId { get; set; }
|
||||
public int? LaborCostId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace BeautyStudioContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? TimeSpent { get; set; }
|
||||
public int? StaffId { get; set; }
|
||||
public string? Difficulty { get; set; }
|
||||
public int? StoreKeeperId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ namespace BeautyStudioContracts.SearchModels
|
||||
public DateTime? DateCreate { get; set; }
|
||||
public DateTime? DateComplete { get; set; }
|
||||
public OrderStatus? Status { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public int? ServiceId { get; set; }
|
||||
public int? StaffId { get; set; }
|
||||
public int? CosmeticId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,6 @@ namespace BeautyStudioContracts.SearchModels
|
||||
public string? ProcedureName { get; set; }
|
||||
public double? ProcedureCost { get; set; }
|
||||
public string? ProcedureDescription { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace BeautyStudioContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ServiceName { get; set; }
|
||||
public double? Sum { get; set; }
|
||||
public int? StaffId { get; set; }
|
||||
public double? ServicePrice { get; set; }
|
||||
public int? StoreKeeperId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.SearchModels
|
||||
{
|
||||
public class StaffSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? StaffFIO { get; set; }
|
||||
public string? StaffLogin { get; set; }
|
||||
public string? StaffPassword { get; set; }
|
||||
public string? StaffEmail { get; set; }
|
||||
public string? StaffPhone { get; }
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.StoragesContracts
|
||||
{
|
||||
public interface IClientStorage
|
||||
{
|
||||
List<ClientViewModel> GetFullList();
|
||||
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
|
||||
ClientViewModel? GetElement(ClientSearchModel model);
|
||||
ClientViewModel? Insert(ClientBindingModel model);
|
||||
ClientViewModel? Update(ClientBindingModel model);
|
||||
ClientViewModel? Delete(ClientBindingModel model);
|
||||
}
|
||||
}
|
@ -17,5 +17,6 @@ namespace BeautyStudioContracts.StoragesContracts
|
||||
CosmeticViewModel? Insert(CosmeticBindingModel model);
|
||||
CosmeticViewModel? Update(CosmeticBindingModel model);
|
||||
CosmeticViewModel? Delete(CosmeticBindingModel model);
|
||||
List<ProcedureViewModel> GetCosmeticProcedures(CosmeticSearchModel model);
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,6 @@ namespace BeautyStudioContracts.StoragesContracts
|
||||
ProcedureViewModel? Insert(ProcedureBindingModel model);
|
||||
ProcedureViewModel? Update(ProcedureBindingModel model);
|
||||
ProcedureViewModel? Delete(ProcedureBindingModel model);
|
||||
List<CosmeticViewModel> GetProcedureCosmetics(ProcedureSearchModel model);
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,6 @@ namespace BeautyStudioContracts.StoragesContracts
|
||||
ServiceViewModel? Insert(ServiceBindingModel model);
|
||||
ServiceViewModel? Update(ServiceBindingModel model);
|
||||
ServiceViewModel? Delete(ServiceBindingModel model);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.StoragesContracts
|
||||
{
|
||||
public interface IStaffStorage
|
||||
{
|
||||
List<StaffViewModel> GetFullList();
|
||||
List<StaffViewModel> GetFilteredList(StaffSearchModel model);
|
||||
StaffViewModel? GetElement(StaffSearchModel model);
|
||||
StaffViewModel? Insert(StaffBindingModel model);
|
||||
StaffViewModel? Update(StaffBindingModel model);
|
||||
StaffViewModel? Delete(StaffBindingModel model);
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО клиента")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Электронная почта клиента")]
|
||||
public string ClientEmail { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Номер телефона клиента")]
|
||||
public string ClientPhone { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Логин клиента")]
|
||||
public string ClientLogin { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль клиента")]
|
||||
public string ClientPassword { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class CosmeticProcedureViewModel
|
||||
{
|
||||
public CosmeticViewModel Cosmetic { get; set; } = null!;
|
||||
public ProcedureViewModel Procedure { get; set; } = null!;
|
||||
public int Count { get; set; }
|
||||
|
||||
public CosmeticProcedureViewModel() { }
|
||||
|
||||
public CosmeticProcedureViewModel(CosmeticViewModel cosmetic, ProcedureViewModel procedure, int count)
|
||||
{
|
||||
Cosmetic = cosmetic;
|
||||
Procedure = procedure;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
@ -21,5 +21,8 @@ namespace BeautyStudioContracts.ViewModels
|
||||
public int StoreKeeperId { get; set; }
|
||||
|
||||
public int LaborCostId { get; set; }
|
||||
|
||||
public List<ServiceCosmeticViewModel> ServiceCosmetic { get; set; } = new();
|
||||
public List<CosmeticProcedureViewModel> CosmeticProcedure { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,11 @@ namespace BeautyStudioContracts.ViewModels
|
||||
public class LaborCostViewModel : ILaborCostModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Потрачено времени (часов)")]
|
||||
public int TimeSpent { get; set; }
|
||||
public int StaffId { get; set; }
|
||||
|
||||
[DisplayName("Сложность")]
|
||||
public string Difficulty { get; set; } = string.Empty;
|
||||
public int StoreKeeperId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class OrderCosmeticViewModel
|
||||
{
|
||||
public CosmeticViewModel Cosmetic { get; set; } = null!;
|
||||
|
||||
public OrderCosmeticViewModel() { }
|
||||
|
||||
public OrderCosmeticViewModel(CosmeticViewModel cosmetic)
|
||||
{
|
||||
Cosmetic = cosmetic;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class OrderProcedureViewModel
|
||||
{
|
||||
public ProcedureViewModel Procedure { get; set; } = null!;
|
||||
public int Count { get; set; }
|
||||
|
||||
public OrderProcedureViewModel() { }
|
||||
|
||||
public OrderProcedureViewModel(ProcedureViewModel procedure, int count)
|
||||
{
|
||||
Procedure = procedure;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class OrderServiceViewModel
|
||||
{
|
||||
public ServiceViewModel Service { get; set; } = null!;
|
||||
public int Count { get; set; }
|
||||
|
||||
public OrderServiceViewModel() { }
|
||||
|
||||
public OrderServiceViewModel(ServiceViewModel service, int count)
|
||||
{
|
||||
Service = service;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
@ -12,13 +12,7 @@ namespace BeautyStudioContracts.ViewModels
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО клиента")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
public int ClientId { get; set; }
|
||||
[DisplayName("ФИО специалиста")]
|
||||
public string? StaffFIO { get; set; } = null;
|
||||
public int? StaffId { get; set; }
|
||||
public int CosmeticId { get; set; }
|
||||
|
||||
public int ServiceId { get; set; }
|
||||
|
||||
@ -36,5 +30,9 @@ namespace BeautyStudioContracts.ViewModels
|
||||
|
||||
[DisplayName("Дата выполнения")]
|
||||
public DateTime? DateComplete { get; set; }
|
||||
|
||||
public List<OrderServiceViewModel> OrderService { get; set; } = new();
|
||||
public List<OrderCosmeticViewModel> OrderCosmetic { get; set; } = new();
|
||||
public List<OrderProcedureViewModel> OrderProcedure { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace BeautyStudioContracts.ViewModels
|
||||
public class ProcedureViewModel : IProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Наименование процедуры")]
|
||||
public string ProcedureName { get; set; } = string.Empty;
|
||||
[DisplayName("Стоимость процедуры")]
|
||||
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class ServiceCosmeticViewModel
|
||||
{
|
||||
public CosmeticViewModel Cosmetic { get; set; } = null!;
|
||||
public ServiceViewModel Service { get; set; } = null!;
|
||||
public int Count { get; set; }
|
||||
|
||||
public ServiceCosmeticViewModel() { }
|
||||
|
||||
public ServiceCosmeticViewModel(CosmeticViewModel cosmetic, ServiceViewModel service, int count)
|
||||
{
|
||||
Cosmetic = cosmetic;
|
||||
Service = service;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class ServiceProcedureViewModel
|
||||
{
|
||||
public ProcedureViewModel Procedure { get; set; } = null!;
|
||||
public int Count { get; set; }
|
||||
|
||||
public ServiceProcedureViewModel() { }
|
||||
|
||||
public ServiceProcedureViewModel(ProcedureViewModel procedure, int count)
|
||||
{
|
||||
Procedure = procedure;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class ServiceProceduresViewModel
|
||||
{
|
||||
public ServiceViewModel Service { get; set; } = new();
|
||||
public Dictionary<int, ProcedureCount> Procedures { get; set; } = new();
|
||||
}
|
||||
}
|
@ -16,10 +16,12 @@ namespace BeautyStudioContracts.ViewModels
|
||||
public string ServiceName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Стоимость услуги")]
|
||||
public double Sum { get; set; }
|
||||
public double ServicePrice { get; set; }
|
||||
|
||||
public int StaffId { get; set; }
|
||||
public int StoreKeeperId { get; set; }
|
||||
|
||||
public Dictionary<int, (IProcedureModel, int)> Procedures { get; set; } = new();
|
||||
public List<ServiceCosmeticViewModel> ServiceCosmetic { get; set; } = new();
|
||||
public List<ServiceProcedureViewModel> ServiceProcedure { get; set; } = new();
|
||||
public List<OrderServiceViewModel> OrderService { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioContracts.ViewModels
|
||||
{
|
||||
public class StaffViewModel : IStaffModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО сотрудника")]
|
||||
public string StaffFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Логин сотрудника")]
|
||||
public string StaffLogin { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль сотрудника")]
|
||||
public string StaffPassword { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Почта сотрудника")]
|
||||
public string StaffEmail { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Телефон сотрудника")]
|
||||
public string StaffPhone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -6,4 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -10,7 +10,7 @@ namespace BeautyStudioDataModels.Enums
|
||||
{
|
||||
Неизвестен = -1,
|
||||
Принято = 0,
|
||||
Отклонено = 1,
|
||||
Выполняется = 1,
|
||||
Выполнено = 2
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioDataModels.Models
|
||||
{
|
||||
public interface IClientModel : IId
|
||||
{
|
||||
string ClientFIO { get; }
|
||||
string ClientEmail { get; }
|
||||
string ClientPhone { get; }
|
||||
string ClientLogin { get; set; }
|
||||
string ClientPassword { get; }
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ namespace BeautyStudioDataModels.Models
|
||||
{
|
||||
string CosmeticName { get; }
|
||||
double CosmeticPrice { get; }
|
||||
int StoreKeeperId { get; }
|
||||
int LaborCostId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ namespace BeautyStudioDataModels.Models
|
||||
public interface ILaborCostModel : IId
|
||||
{
|
||||
int TimeSpent { get; }
|
||||
int StaffId { get; }
|
||||
string Difficulty { get; }
|
||||
int StoreKeeperId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,8 @@ namespace BeautyStudioDataModels.Models
|
||||
DateTime DateCreate { get; }
|
||||
DateTime? DateComplete { get; }
|
||||
OrderStatus Status { get; }
|
||||
int ClientId { get; }
|
||||
int ServiceId { get; }
|
||||
int? StaffId { get; }
|
||||
int CosmeticId { get; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace BeautyStudioDataModels.Models
|
||||
public interface IServiceModel : IId
|
||||
{
|
||||
string ServiceName { get; }
|
||||
double Sum { get; }
|
||||
int StaffId { get; }
|
||||
double ServicePrice { get; }
|
||||
int StoreKeeperId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioDataModels.Models
|
||||
{
|
||||
public interface IStaffModel : IId
|
||||
{
|
||||
string StaffFIO { get; }
|
||||
string StaffLogin { get; }
|
||||
string StaffPassword { get; }
|
||||
string StaffEmail { get; }
|
||||
string StaffPhone { get; }
|
||||
}
|
||||
}
|
@ -16,15 +16,16 @@ namespace BeautyStudioDatabaseImplement
|
||||
}
|
||||
|
||||
public virtual DbSet<Order> Orders { set; get; }
|
||||
public virtual DbSet<OrderService> OrderService { set; get; }
|
||||
public virtual DbSet<LaborCost> LaborCost { set; get; }
|
||||
public virtual DbSet<Cosmetic> Cosmetics { set; get; }
|
||||
public virtual DbSet<Service> Services { set; get; }
|
||||
public virtual DbSet<ServiceProcedure> ServiceProcedures { set; get; }
|
||||
public virtual DbSet<Procedure> Procedures { set; get; }
|
||||
public virtual DbSet <ProcedureCosmetics> ProcedureCosmetics { set; get; }
|
||||
public virtual DbSet<Staff> Staffs { set; get; }
|
||||
public virtual DbSet<ServiceCosmetic> ServiceCosmetics { set; get; }
|
||||
public virtual DbSet<ServiceProcedure> ServiceProcedures { set; get; }
|
||||
public virtual DbSet<OrderCosmetic> OrderCosmetics { set; get; }
|
||||
public virtual DbSet<OrderService> OrderServices { set; get; }
|
||||
public virtual DbSet<OrderProcedure> OrderProcedures { set; get; }
|
||||
public virtual DbSet<CosmeticProcedure> CosmeticProcedures { set; get; }
|
||||
public virtual DbSet<StoreKeeper> StoreKeepers { set; get; }
|
||||
public virtual DbSet<Client> Clients { set; get; }
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog" Version="5.3.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -1,97 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Implements
|
||||
{
|
||||
public class ClientStorage : IClientStorage
|
||||
{
|
||||
public ClientViewModel? Delete(ClientBindingModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
|
||||
var element = context.Clients.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
if (element != null)
|
||||
{
|
||||
context.Clients.Remove(element);
|
||||
context.SaveChanges();
|
||||
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
if (model.Id.HasValue)
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => x.Id == model.Id)?
|
||||
.GetViewModel;
|
||||
|
||||
if (!string.IsNullOrEmpty(model.ClientLogin) &&
|
||||
!string.IsNullOrEmpty(model.ClientPassword))
|
||||
return context.Clients
|
||||
.FirstOrDefault(x =>
|
||||
x.ClientLogin.Equals(model.ClientLogin) &&
|
||||
x.ClientPassword.Equals(model.ClientPassword))?
|
||||
.GetViewModel;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<ClientViewModel> GetFullList()
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
return context.Clients
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public ClientViewModel? Insert(ClientBindingModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
|
||||
var newClient = Client.Create(model);
|
||||
|
||||
if (newClient == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Clients.Add(newClient);
|
||||
context.SaveChanges();
|
||||
|
||||
return newClient.GetViewModel;
|
||||
}
|
||||
|
||||
public ClientViewModel? Update(ClientBindingModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
|
||||
var client = context.Clients.FirstOrDefault(x => x.Id == model.Id);
|
||||
|
||||
if (client == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
client.Update(model);
|
||||
context.SaveChanges();
|
||||
|
||||
return client.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -16,8 +16,6 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
return context.Cosmetics
|
||||
//.Include(x => x.Procedures)
|
||||
//.ThenInclude(x => x.Procedure)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -38,7 +36,7 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
return new();
|
||||
}
|
||||
|
||||
@ -101,7 +99,7 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return new();
|
||||
}
|
||||
using var context = new BeautyStudioDatabase();
|
||||
var procedures = context.ProcedureCosmetics
|
||||
var procedures = context.CosmeticProcedures
|
||||
.Where(x => x.CosmeticId == model.Id)
|
||||
.Select(x => x.Procedure.GetViewModel)
|
||||
.ToList();
|
||||
|
@ -3,6 +3,11 @@ using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDatabaseImplement.Models;
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDatabaseImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -35,10 +40,10 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new BeautyStudioDatabase();
|
||||
return context.LaborCost
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
|
||||
public List<LaborCostViewModel> GetFilteredList(LaborCostSearchModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
@ -49,10 +54,10 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (model.StaffId.HasValue)
|
||||
if (model.StoreKeeperId.HasValue)
|
||||
{
|
||||
return context.LaborCost
|
||||
.Where(x => x.StaffId == model.StaffId)
|
||||
.Where(x => x.StoreKeeperId == model.StoreKeeperId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -83,14 +88,14 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
public LaborCostViewModel? Update(LaborCostBindingModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
var laborCosts = context.LaborCost.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (laborCosts == null)
|
||||
var laborCost = context.LaborCost.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (laborCost == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
laborCosts.Update(model);
|
||||
laborCost.Update(model);
|
||||
context.SaveChanges();
|
||||
return laborCosts.GetViewModel;
|
||||
return laborCost.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
using var context = new BeautyStudioDatabase();
|
||||
var element = context.Orders
|
||||
.Include(x => x.Services)
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Cosmetics)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
@ -40,10 +42,14 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return context.Orders
|
||||
.Include(x => x.Services)
|
||||
.ThenInclude(x => x.Service)
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Cosmetics)
|
||||
.ThenInclude(x => x.Cosmetic)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -51,22 +57,16 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return new();
|
||||
}
|
||||
using var context = new BeautyStudioDatabase();
|
||||
if (model.ClientId.HasValue && model.DateCreate.HasValue)
|
||||
if (model.DateCreate.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Services)
|
||||
.ThenInclude(x => x.Service)
|
||||
.Where(x => x.ClientId == model.ClientId &&
|
||||
x.DateCreate == model.DateCreate).ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (model.ClientId.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Services)
|
||||
.ThenInclude(x => x.Service)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Cosmetics)
|
||||
.ThenInclude(x => x.Cosmetic)
|
||||
.Where(x => x.DateCreate == model.DateCreate).ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -79,6 +79,10 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return context.Orders
|
||||
.Include(x => x.Services)
|
||||
.ThenInclude(x => x.Service)
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Cosmetics)
|
||||
.ThenInclude(x => x.Cosmetic)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -110,6 +114,9 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
}
|
||||
order.Update(model);
|
||||
context.SaveChanges();
|
||||
order.UpdateServices(context, model);
|
||||
order.UpdateProcedures(context, model);
|
||||
order.UpdateCosmetics(context, model);
|
||||
transaction.Commit();
|
||||
return order.GetViewModel;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
|
||||
public List<ProcedureViewModel> GetFilteredList(ProcedureSearchModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
@ -93,6 +93,7 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
}
|
||||
procedure.Update(model);
|
||||
context.SaveChanges();
|
||||
procedure.UpdateCosmetics(context, model);
|
||||
transaction.Commit();
|
||||
return procedure.GetViewModel;
|
||||
}
|
||||
@ -110,7 +111,7 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return new();
|
||||
}
|
||||
using var context = new BeautyStudioDatabase();
|
||||
var cosmetics = context.ProcedureCosmetics
|
||||
var cosmetics = context.CosmeticProcedures
|
||||
.Where(x => x.ProcedureId == model.Id)
|
||||
.Select(x => x.Cosmetic.GetViewModel)
|
||||
.ToList();
|
||||
|
@ -19,6 +19,7 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
using var context = new BeautyStudioDatabase();
|
||||
var element = context.Services
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Cosmetics)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
@ -39,6 +40,8 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return context.Services
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Cosmetics)
|
||||
.ThenInclude(x => x.Cosmetic)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ServiceName) && x.ServiceName == model.ServiceName) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
@ -56,17 +59,21 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return context.Services
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Cosmetics)
|
||||
.ThenInclude(x => x.Cosmetic)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (model.StaffId.HasValue)
|
||||
if (model.StoreKeeperId.HasValue)
|
||||
{
|
||||
return context.Services
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Where(x => x.StaffId == model.StaffId)
|
||||
.Include(x => x.Cosmetics)
|
||||
.ThenInclude(x => x.Cosmetic)
|
||||
.Where(x => x.StoreKeeperId == model.StoreKeeperId)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -80,6 +87,8 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
return context.Services
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Cosmetics)
|
||||
.ThenInclude(x => x.Cosmetic)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -110,6 +119,8 @@ namespace BeautyStudioDatabaseImplement.Implements
|
||||
}
|
||||
service.Update(model);
|
||||
context.SaveChanges();
|
||||
service.UpdateCosmetics(context, model);
|
||||
service.UpdateProcedures(context, model);
|
||||
transaction.Commit();
|
||||
return service.GetViewModel;
|
||||
}
|
||||
|
@ -1,97 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Implements
|
||||
{
|
||||
public class StaffStorage : IStaffStorage
|
||||
{
|
||||
public StaffViewModel? Delete(StaffBindingModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
|
||||
var element = context.Staffs.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
if (element != null)
|
||||
{
|
||||
context.Staffs.Remove(element);
|
||||
context.SaveChanges();
|
||||
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public StaffViewModel? GetElement(StaffSearchModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
if (model.Id.HasValue)
|
||||
return context.Staffs
|
||||
.FirstOrDefault(x => x.Id == model.Id)?
|
||||
.GetViewModel;
|
||||
|
||||
if (!string.IsNullOrEmpty(model.StaffPassword) &&
|
||||
!string.IsNullOrEmpty(model.StaffLogin))
|
||||
return context.Staffs
|
||||
.FirstOrDefault(x =>
|
||||
x.StaffPassword.Equals(model.StaffPassword) &&
|
||||
x.StaffLogin.Equals(model.StaffLogin))?
|
||||
.GetViewModel;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<StaffViewModel> GetFilteredList(StaffSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<StaffViewModel> GetFullList()
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
return context.Staffs
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public StaffViewModel? Insert(StaffBindingModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
|
||||
var newStaffs = Staff.Create(model);
|
||||
|
||||
if (newStaffs == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
context.Staffs.Add(newStaffs);
|
||||
context.SaveChanges();
|
||||
|
||||
return newStaffs.GetViewModel;
|
||||
}
|
||||
|
||||
public StaffViewModel? Update(StaffBindingModel model)
|
||||
{
|
||||
using var context = new BeautyStudioDatabase();
|
||||
|
||||
var Staffs = context.Staffs.FirstOrDefault(x => x.Id == model.Id);
|
||||
|
||||
if (Staffs == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Staffs.Update(model);
|
||||
context.SaveChanges();
|
||||
|
||||
return Staffs.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
public class Client : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ClientLogin { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string ClientEmail { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string ClientPhone { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string ClientPassword { get; set; } = string.Empty;
|
||||
|
||||
//связь один-ко-многим клиента с заказами
|
||||
[ForeignKey("ClientId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
public static Client? Create(ClientBindingModel model)
|
||||
{
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Client()
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientLogin = model.ClientLogin,
|
||||
ClientFIO = model.ClientFIO,
|
||||
ClientEmail = model.ClientEmail,
|
||||
ClientPassword = model.ClientPassword,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ClientBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ClientLogin = model.ClientLogin;
|
||||
ClientFIO = model.ClientFIO;
|
||||
ClientEmail = model.ClientEmail;
|
||||
ClientPassword = model.ClientPassword;
|
||||
}
|
||||
|
||||
public ClientViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ClientLogin = ClientLogin,
|
||||
ClientFIO = ClientFIO,
|
||||
ClientEmail = ClientEmail,
|
||||
ClientPassword = ClientPassword
|
||||
};
|
||||
|
||||
}
|
||||
}
|
@ -28,9 +28,15 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
public int LaborCostId { get; set; }
|
||||
public virtual LaborCost LaborCost { get; set; } = new();
|
||||
|
||||
// связь многие-ко-многим заказов и косметики
|
||||
[ForeignKey("CosmeticId")]
|
||||
public virtual List<OrderCosmetic> Orders { get; set; } = new();
|
||||
// связь многие-ко-многим косметики с процедурами
|
||||
[ForeignKey("CosmeticId")]
|
||||
public virtual List<ProcedureCosmetics> Procedures { get; set; } = new();
|
||||
public virtual List<CosmeticProcedure> Procedures { get; set; } = new();
|
||||
// связь многие-ко-многим косметики с процедурами
|
||||
[ForeignKey("CosmeticId")]
|
||||
public virtual List<ServiceCosmetic> Services { get; set; } = new();
|
||||
|
||||
public static Cosmetic Create(CosmeticBindingModel model)
|
||||
{
|
||||
@ -44,7 +50,6 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
Id = model.Id,
|
||||
CosmeticName = model.CosmeticName,
|
||||
CosmeticPrice = model.CosmeticPrice,
|
||||
StoreKeeperId = model.StoreKeeperId,
|
||||
LaborCostId = model.LaborCostId
|
||||
};
|
||||
}
|
||||
@ -57,7 +62,6 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
}
|
||||
CosmeticName = model.CosmeticName;
|
||||
CosmeticPrice = model.CosmeticPrice;
|
||||
StoreKeeperId = model.StoreKeeperId;
|
||||
LaborCostId = model.LaborCostId;
|
||||
}
|
||||
|
||||
@ -66,7 +70,6 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
Id = Id,
|
||||
CosmeticName = CosmeticName,
|
||||
CosmeticPrice = CosmeticPrice,
|
||||
StoreKeeperId = StoreKeeperId,
|
||||
LaborCostId = LaborCostId
|
||||
};
|
||||
}
|
||||
|
@ -7,21 +7,21 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
public class ProcedureCosmetics
|
||||
public class CosmeticProcedure
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ProcedureId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CosmeticId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ProcedureId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ProcedureCosmeticCount { get; set; }
|
||||
|
||||
public virtual Procedure Procedure { get; set; } = new();
|
||||
|
||||
public virtual Cosmetic Cosmetic { get; set; } = new();
|
||||
|
||||
public virtual Procedure Procedure { get; set; } = new();
|
||||
}
|
||||
}
|
@ -17,9 +17,9 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
[Required]
|
||||
public string Difficulty { get; set; } = string.Empty;
|
||||
|
||||
public int StaffId { get; set; }
|
||||
public int StoreKeeperId { get; set; }
|
||||
|
||||
public virtual Staff Staff { get; set; }
|
||||
public virtual StoreKeeper StoreKeeper { get; set; }
|
||||
|
||||
// связь один-ко-многим трудозатрат с косметикой
|
||||
[ForeignKey("LaborCostId")]
|
||||
@ -34,7 +34,7 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
return new LaborCost()
|
||||
{
|
||||
Id = model.Id,
|
||||
StaffId = model.StaffId,
|
||||
StoreKeeperId = model.StoreKeeperId,
|
||||
TimeSpent = model.TimeSpent
|
||||
};
|
||||
}
|
||||
@ -46,13 +46,14 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
return;
|
||||
}
|
||||
TimeSpent = model.TimeSpent;
|
||||
|
||||
Difficulty = model.Difficulty;
|
||||
}
|
||||
|
||||
public LaborCostViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
TimeSpent = TimeSpent
|
||||
TimeSpent = TimeSpent,
|
||||
Difficulty = Difficulty
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -28,26 +28,84 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
public double Sum { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int? StaffId { get; set; }
|
||||
|
||||
public int? StoreKeeperId { get; set; }
|
||||
[Required]
|
||||
public int ServiceId { get; set; }
|
||||
[Required]
|
||||
public int CosmeticId { get; set; }
|
||||
|
||||
// связь заказов и услуги многие-ко-многим
|
||||
private List<OrderServiceViewModel>? _orderServices = null;
|
||||
|
||||
private List<OrderCosmeticViewModel>? _orderCosmetics = null;
|
||||
|
||||
private List<OrderProcedureViewModel>? _orderProcedures = null;
|
||||
|
||||
[NotMapped]
|
||||
public List<OrderServiceViewModel> OrderServices
|
||||
{
|
||||
get
|
||||
{
|
||||
_orderServices ??= Services
|
||||
.Select(pc => new OrderServiceViewModel(pc.Service.GetViewModel, pc.OrderServiceCount))
|
||||
.ToList();
|
||||
return _orderServices;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public List<OrderProcedureViewModel> OrderProcedures
|
||||
{
|
||||
get
|
||||
{
|
||||
_orderProcedures ??= Procedures
|
||||
.Select(pc => new OrderProcedureViewModel(pc.Procedure.GetViewModel, pc.OrderProcedureCount))
|
||||
.ToList();
|
||||
return _orderProcedures;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public List<OrderCosmeticViewModel> OrderCosmetics
|
||||
{
|
||||
get
|
||||
{
|
||||
_orderCosmetics ??= Cosmetics
|
||||
.Select(pc => new OrderCosmeticViewModel(pc.Cosmetic.GetViewModel))
|
||||
.ToList();
|
||||
return _orderCosmetics;
|
||||
}
|
||||
}
|
||||
// связь услуги и заказов многие - ко - многим
|
||||
[ForeignKey("OrderId")]
|
||||
public virtual List<OrderService> Services { get; set; } = new();
|
||||
|
||||
[ForeignKey("OrderId")]
|
||||
public virtual List<OrderCosmetic> Cosmetics { get; set; } = new();
|
||||
|
||||
[ForeignKey("OrderId")]
|
||||
public virtual List<OrderProcedure> Procedures { get; set; } = new();
|
||||
|
||||
public static Order Create(BeautyStudioDatabase context, OrderBindingModel model)
|
||||
{
|
||||
return new Order()
|
||||
{
|
||||
Id = model.Id,
|
||||
DateCreate = model.DateCreate,
|
||||
DateComplete = model.DateComplete,
|
||||
ClientId = model.ClientId,
|
||||
Sum = model.Sum,
|
||||
Services = model.OrderService.Select(x => new OrderService()
|
||||
{
|
||||
Service = context.Services.First(y => y.Id == x.Service.Id),
|
||||
OrderServiceCount = x.Count
|
||||
}).ToList(),
|
||||
Procedures = model.OrderProcedure.Select(x => new OrderProcedure()
|
||||
{
|
||||
Procedure = context.Procedures.First(y => y.Id == x.Procedure.Id),
|
||||
OrderProcedureCount = x.Count
|
||||
}).ToList(),
|
||||
Cosmetics = model.OrderCosmetic.Select(x => new OrderCosmetic()
|
||||
{
|
||||
Cosmetic = context.Cosmetics.First(y => y.Id == x.Cosmetic.Id),
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
@ -55,15 +113,80 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
Status = model.Status;
|
||||
DateCreate = model.DateCreate;
|
||||
StaffId = model.StaffId;
|
||||
DateComplete = model.DateComplete;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
DateCreate = DateCreate,
|
||||
ClientId = ClientId
|
||||
DateComplete = DateComplete,
|
||||
Sum = Sum,
|
||||
OrderService = OrderServices,
|
||||
OrderProcedure = OrderProcedures,
|
||||
OrderCosmetic = OrderCosmetics
|
||||
};
|
||||
|
||||
public void UpdateServices(BeautyStudioDatabase context, OrderBindingModel model)
|
||||
{
|
||||
var orderServices = context.OrderServices
|
||||
.Where(x => x.OrderId == model.Id)
|
||||
.ToList();
|
||||
context.OrderServices
|
||||
.RemoveRange(orderServices);
|
||||
var order = context.Orders.First(x => x.Id == Id);
|
||||
foreach (var record in model.OrderService)
|
||||
{
|
||||
context.OrderServices.Add(new OrderService
|
||||
{
|
||||
Order = order,
|
||||
Service = context.Services.First(x => x.Id == record.Service.Id),
|
||||
OrderServiceCount = record.Count
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_orderServices = null;
|
||||
}
|
||||
|
||||
public void UpdateProcedures(BeautyStudioDatabase context, OrderBindingModel model)
|
||||
{
|
||||
var orderProcedures = context.OrderProcedures
|
||||
.Where(x => x.OrderId == model.Id)
|
||||
.ToList();
|
||||
context.OrderProcedures
|
||||
.RemoveRange(orderProcedures);
|
||||
var order = context.Orders.First(x => x.Id == Id);
|
||||
foreach (var record in model.OrderProcedure)
|
||||
{
|
||||
context.OrderProcedures.Add(new OrderProcedure
|
||||
{
|
||||
Order = order,
|
||||
Procedure = context.Procedures.First(x => x.Id == record.Procedure.Id),
|
||||
OrderProcedureCount = record.Count
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_orderProcedures = null;
|
||||
}
|
||||
|
||||
public void UpdateCosmetics(BeautyStudioDatabase context, OrderBindingModel model)
|
||||
{
|
||||
var orderCosmetic = context.OrderCosmetics
|
||||
.Where(x => x.OrderId == model.Id)
|
||||
.ToList();
|
||||
context.OrderCosmetics
|
||||
.RemoveRange(orderCosmetic);
|
||||
var order = context.Orders.First(x => x.Id == Id);
|
||||
foreach (var record in model.OrderCosmetic)
|
||||
{
|
||||
context.OrderCosmetics.Add(new OrderCosmetic
|
||||
{
|
||||
Order = order,
|
||||
Cosmetic = context.Cosmetics.First(x => x.Id == record.Cosmetic.Id),
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_orderCosmetics = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
public class OrderCosmetic
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int OrderId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CosmeticId { get; set; }
|
||||
|
||||
public virtual Order Order { get; set; } = new();
|
||||
|
||||
public virtual Cosmetic Cosmetic { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
public class OrderProcedure
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int OrderId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ProcedureId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int OrderProcedureCount { get; set; }
|
||||
|
||||
public virtual Order Order { get; set; } = new();
|
||||
|
||||
public virtual Procedure Procedure { get; set; } = new();
|
||||
}
|
||||
}
|
@ -17,8 +17,11 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
[Required]
|
||||
public int ServiceId { get; set; }
|
||||
|
||||
public virtual Order Order { get; set; } = new();
|
||||
public virtual Service Service { get; set; } = new();
|
||||
[Required]
|
||||
public int OrderServiceCount { get; set; }
|
||||
|
||||
public virtual Order Order { get; set; } = new();
|
||||
|
||||
public virtual Service Service { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -22,14 +22,13 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
public double ProcedureCost { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ProcedureDescription { get; set; }
|
||||
public string ProcedureDescription { get; set; } = string.Empty;
|
||||
|
||||
public int ClientId { get; set; }
|
||||
public virtual Client Client { get; set; } = null!;
|
||||
public int StoreKeeperId { get; set; }
|
||||
|
||||
// связь процедур и косметики многие - ко - многим
|
||||
[ForeignKey("ProcedureId")]
|
||||
public virtual List<ProcedureCosmetics> Cosmetics { get; set; } = new();
|
||||
public virtual List<ServiceCosmetic> Cosmetics { get; set; } = new();
|
||||
|
||||
private List<ProcedureCosmeticsViewModel>? _cosmeticProcedures = null;
|
||||
|
||||
@ -49,6 +48,10 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
[ForeignKey("ProcedureId")]
|
||||
public virtual List<ServiceProcedure> Services { get; set; } = new();
|
||||
|
||||
// связь процедур и заказов многие - ко - многим
|
||||
[ForeignKey("ProcedureId")]
|
||||
public virtual List<OrderProcedure> Orders { get; set; } = new();
|
||||
|
||||
public static Procedure Create(BeautyStudioDatabase context, ProcedureBindingModel model)
|
||||
{
|
||||
return new Procedure()
|
||||
@ -57,6 +60,11 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
ProcedureName = model.ProcedureName,
|
||||
ProcedureCost = model.ProcedureCost,
|
||||
ProcedureDescription = model.ProcedureDescription,
|
||||
Cosmetics = model.ProcedureCosmetics.Select(x => new CosmeticProcedure()
|
||||
{
|
||||
Cosmetic = context.Cosmetics.First(y => y.Id == x.Cosmetic.Id),
|
||||
ProcedureCosmeticCount = x.Count
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
@ -75,5 +83,25 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
ProcedureDescription = ProcedureDescription,
|
||||
};
|
||||
|
||||
public void UpdateCosmetics(BeautyStudioDatabase context, ProcedureBindingModel model)
|
||||
{
|
||||
var procedureCosmetics = context.CosmeticProcedures
|
||||
.Where(x => x.ProcedureId == model.Id)
|
||||
.ToList();
|
||||
context.CosmeticProcedures
|
||||
.RemoveRange(procedureCosmetics);
|
||||
var procedure = context.Procedures.First(x => x.Id == Id);
|
||||
foreach (var record in model.ProcedureCosmetics)
|
||||
{
|
||||
context.CosmeticProcedures.Add(new CosmeticProcedure
|
||||
{
|
||||
Procedure = procedure,
|
||||
Cosmetic = context.Cosmetics.First(x => x.Id == record.Cosmetic.Id),
|
||||
ProcedureCosmeticCount = record.Count
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_cosmeticProcedures = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,40 +22,113 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
public string ServiceName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public double Sum { get; set; }
|
||||
public double ServicePrice { get; set; }
|
||||
|
||||
public int StaffId { get; set; }
|
||||
public virtual Staff Staff { get; set; }
|
||||
public int StoreKeeperId { get; set; }
|
||||
public virtual StoreKeeper StoreKeeper { get; set; }
|
||||
|
||||
// связь многие-ко-многим услуг с заказами
|
||||
// связь услуги и заказов многие - ко - многим
|
||||
[ForeignKey("ServiceId")]
|
||||
public virtual List<OrderService> Orders { get; set; } = new();
|
||||
|
||||
// связь многие-ко-многим услуг с процедурами
|
||||
// связь услуги и косметки многие - ко - многим
|
||||
[ForeignKey("ServiceId")]
|
||||
public virtual List<ServiceCosmetic> Cosmetics { get; set; } = new();
|
||||
|
||||
// связь услуги и косметки многие - ко - многим
|
||||
[ForeignKey("ServiceId")]
|
||||
public virtual List<ServiceProcedure> Procedures { get; set; } = new();
|
||||
|
||||
private List<ServiceProcedureViewModel>? _serviceProcedures = null;
|
||||
|
||||
[NotMapped]
|
||||
public List<ServiceProcedureViewModel> ServiceProcedures
|
||||
{
|
||||
get
|
||||
{
|
||||
_serviceProcedures ??= Procedures
|
||||
.Select(pc => new ServiceProcedureViewModel(pc.Procedure.GetViewModel, pc.ServiceProcedureCount))
|
||||
.ToList();
|
||||
return _serviceProcedures;
|
||||
}
|
||||
}
|
||||
|
||||
private List<ServiceCosmeticViewModel>? _serviceCosmetics = null;
|
||||
[NotMapped]
|
||||
public List<ServiceCosmeticViewModel> ServiceCosmetics
|
||||
{
|
||||
get
|
||||
{
|
||||
_serviceCosmetics ??= Cosmetics
|
||||
.Select(pc => new ServiceCosmeticViewModel(pc.Cosmetic.GetViewModel, pc.Service.GetViewModel, pc.ServiceCosmeticCount))
|
||||
.ToList();
|
||||
return _serviceCosmetics;
|
||||
}
|
||||
}
|
||||
|
||||
public static Service Create(BeautyStudioDatabase context, ServiceBindingModel model)
|
||||
{
|
||||
return new Service()
|
||||
{
|
||||
Id = model.Id,
|
||||
ServiceName = model.ServiceName,
|
||||
StaffId = model.StaffId
|
||||
ServicePrice = model.ServicePrice
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ServiceBindingModel model)
|
||||
{
|
||||
ServiceName = model.ServiceName;
|
||||
StaffId = model.StaffId;
|
||||
ServicePrice = model.ServicePrice;
|
||||
}
|
||||
|
||||
public ServiceViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ServiceName = ServiceName,
|
||||
StaffId = StaffId
|
||||
ServicePrice = ServicePrice
|
||||
};
|
||||
|
||||
public void UpdateCosmetics(BeautyStudioDatabase context, ServiceBindingModel model)
|
||||
{
|
||||
var serviceCosmetics = context.ServiceCosmetics
|
||||
.Where(x => x.ServiceId == model.Id)
|
||||
.ToList();
|
||||
context.ServiceCosmetics
|
||||
.RemoveRange(serviceCosmetics);
|
||||
var service = context.Services.First(x => x.Id == Id);
|
||||
foreach (var record in model.ServiceCosmetic)
|
||||
{
|
||||
context.ServiceCosmetics.Add(new ServiceCosmetic
|
||||
{
|
||||
Service = service,
|
||||
Cosmetic = context.Cosmetics.First(x => x.Id == record.Cosmetic.Id),
|
||||
ServiceCosmeticCount = record.Count
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_serviceCosmetics = null;
|
||||
}
|
||||
|
||||
public void UpdateProcedures(BeautyStudioDatabase context, ServiceBindingModel model)
|
||||
{
|
||||
var serviceProcedures = context.ServiceProcedures
|
||||
.Where(x => x.ServiceId == model.Id)
|
||||
.ToList();
|
||||
context.ServiceProcedures
|
||||
.RemoveRange(serviceProcedures);
|
||||
var service = context.Services.First(x => x.Id == Id);
|
||||
foreach (var record in model.ServiceProcedure)
|
||||
{
|
||||
context.ServiceProcedures.Add(new ServiceProcedure
|
||||
{
|
||||
Service = service,
|
||||
Procedure = context.Procedures.First(x => x.Id == record.Procedure.Id),
|
||||
ServiceProcedureCount = record.Count
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_serviceProcedures = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
public class ServiceCosmetic
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CosmeticId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ServiceId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ServiceCosmeticCount { get; set; }
|
||||
|
||||
public virtual Cosmetic Cosmetic { get; set; } = new();
|
||||
|
||||
public virtual Service Service { get; set; } = new();
|
||||
}
|
||||
}
|
@ -16,7 +16,10 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
public int ServiceId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ProcedureId { get; set; }
|
||||
public int ProcedureId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ServiceProcedureCount { get; set; }
|
||||
|
||||
public virtual Service Service { get; set; } = new();
|
||||
|
||||
|
@ -1,81 +0,0 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.ViewModels;
|
||||
using BeautyStudioDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
public class Staff : IStaffModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string StaffFIO { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string StaffEmail { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string StaffLogin { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string StaffPassword { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string StaffPhone { get; set; } = string.Empty;
|
||||
|
||||
//связь один-ко-многим с трудозатратами
|
||||
[ForeignKey("StaffId")]
|
||||
public virtual List<LaborCost> LaborCost { get; set; } = new();
|
||||
|
||||
// связь один-ко-многим с услугами
|
||||
[ForeignKey("StaffId")]
|
||||
public virtual List<Service> Services { get; set; } = new();
|
||||
|
||||
// связь один-ко-многим с заказами
|
||||
[ForeignKey("StaffId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
public static Staff? Create(StaffBindingModel model)
|
||||
{
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Staff()
|
||||
{
|
||||
Id = model.Id,
|
||||
StaffFIO = model.StaffFIO,
|
||||
StaffLogin = model.StaffLogin,
|
||||
StaffEmail = model.StaffEmail,
|
||||
StaffPassword = model.StaffPassword,
|
||||
StaffPhone = model.StaffPhone,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(StaffBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StaffFIO = model.StaffFIO;
|
||||
StaffLogin = model.StaffLogin;
|
||||
StaffEmail = model.StaffEmail;
|
||||
StaffPassword = model.StaffPassword;
|
||||
StaffPhone = model.StaffPhone;
|
||||
}
|
||||
|
||||
public StaffViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
StaffFIO = StaffFIO,
|
||||
StaffLogin = StaffLogin,
|
||||
StaffEmail = StaffEmail,
|
||||
StaffPassword = StaffPassword,
|
||||
StaffPhone = StaffPhone,
|
||||
};
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog" Version="5.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -20,4 +21,19 @@
|
||||
<ProjectReference Include="..\BeautyStudioDatabaseImplement\BeautyStudioDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,10 +0,0 @@
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
112
BeautyStudio/BeautyStudioView/FormCosmetics.Designer.cs
generated
Normal file
112
BeautyStudio/BeautyStudioView/FormCosmetics.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
partial class FormCosmetics
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewCosmetics = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonRefresh = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewCosmetics).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewCosmetics
|
||||
//
|
||||
dataGridViewCosmetics.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewCosmetics.Location = new Point(12, 12);
|
||||
dataGridViewCosmetics.Name = "dataGridViewCosmetics";
|
||||
dataGridViewCosmetics.Size = new Size(590, 426);
|
||||
dataGridViewCosmetics.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(622, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(166, 30);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += this.buttonAdd_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(622, 56);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(166, 30);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.Text = "Изменить";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += this.buttonUpdate_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(622, 103);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(166, 30);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.Text = "Удалить";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += this.buttonDelete_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(622, 152);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(166, 30);
|
||||
buttonRefresh.TabIndex = 4;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += this.buttonRefresh_Click;
|
||||
//
|
||||
// FormCosmetics
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(buttonRefresh);
|
||||
Controls.Add(buttonDelete);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(dataGridViewCosmetics);
|
||||
Name = "FormCosmetics";
|
||||
Text = "Список косметики";
|
||||
Load += FormCosmetics_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewCosmetics).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewCosmetics;
|
||||
private Button buttonAdd;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonRefresh;
|
||||
}
|
||||
}
|
115
BeautyStudio/BeautyStudioView/FormCosmetics.cs
Normal file
115
BeautyStudio/BeautyStudioView/FormCosmetics.cs
Normal file
@ -0,0 +1,115 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.BusinessLogicContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.CosmeticModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
public partial class FormCosmetics : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly ICosmeticLogic _logic;
|
||||
|
||||
public FormCosmetics(ILogger<FormCosmetics> logger, ICosmeticLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormCosmetics_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridViewCosmetics.DataSource = list;
|
||||
dataGridViewCosmetics.Columns["Id"].Visible = false;
|
||||
dataGridViewCosmetics.Columns["CosmeticsName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка косметики");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки косметики");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateCosmetic));
|
||||
if (service is FormCreateCosmetic form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridViewCosmetics.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateCosmetic));
|
||||
if (service is FormCreateCosmetic form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridViewCosmetics.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridViewCosmetics.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridViewCosmetics.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление косметики");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new CosmeticBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления косметики");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
BeautyStudio/BeautyStudioView/FormCosmetics.resx
Normal file
120
BeautyStudio/BeautyStudioView/FormCosmetics.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
117
BeautyStudio/BeautyStudioView/FormCreateCosmetic.Designer.cs
generated
Normal file
117
BeautyStudio/BeautyStudioView/FormCreateCosmetic.Designer.cs
generated
Normal file
@ -0,0 +1,117 @@
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
partial class FormCreateCosmetic
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelCosmeticName = new Label();
|
||||
textBoxCosmeticName = new TextBox();
|
||||
textBoxСosmeticPrice = new TextBox();
|
||||
labelCosmeticPrice = new Label();
|
||||
buttonSave = new Button();
|
||||
buttonСancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelCosmeticName
|
||||
//
|
||||
labelCosmeticName.AutoSize = true;
|
||||
labelCosmeticName.Location = new Point(12, 9);
|
||||
labelCosmeticName.Name = "labelCosmeticName";
|
||||
labelCosmeticName.Size = new Size(62, 15);
|
||||
labelCosmeticName.TabIndex = 0;
|
||||
labelCosmeticName.Text = "Название:";
|
||||
//
|
||||
// textBoxCosmeticName
|
||||
//
|
||||
textBoxCosmeticName.Location = new Point(80, 6);
|
||||
textBoxCosmeticName.Name = "textBoxCosmeticName";
|
||||
textBoxCosmeticName.Size = new Size(335, 23);
|
||||
textBoxCosmeticName.TabIndex = 1;
|
||||
//
|
||||
// textBoxСosmeticPrice
|
||||
//
|
||||
textBoxСosmeticPrice.Location = new Point(80, 40);
|
||||
textBoxСosmeticPrice.Name = "textBoxСosmeticPrice";
|
||||
textBoxСosmeticPrice.Size = new Size(163, 23);
|
||||
textBoxСosmeticPrice.TabIndex = 3;
|
||||
//
|
||||
// labelCosmeticPrice
|
||||
//
|
||||
labelCosmeticPrice.AutoSize = true;
|
||||
labelCosmeticPrice.Location = new Point(36, 43);
|
||||
labelCosmeticPrice.Name = "labelCosmeticPrice";
|
||||
labelCosmeticPrice.Size = new Size(38, 15);
|
||||
labelCosmeticPrice.TabIndex = 2;
|
||||
labelCosmeticPrice.Text = "Цена:";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(247, 71);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonСancel
|
||||
//
|
||||
buttonСancel.Location = new Point(337, 71);
|
||||
buttonСancel.Name = "buttonСancel";
|
||||
buttonСancel.Size = new Size(75, 23);
|
||||
buttonСancel.TabIndex = 5;
|
||||
buttonСancel.Text = "Отмена";
|
||||
buttonСancel.UseVisualStyleBackColor = true;
|
||||
buttonСancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormCreateCosmetic
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(427, 103);
|
||||
Controls.Add(buttonСancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxСosmeticPrice);
|
||||
Controls.Add(labelCosmeticPrice);
|
||||
Controls.Add(textBoxCosmeticName);
|
||||
Controls.Add(labelCosmeticName);
|
||||
Name = "FormCreateCosmetic";
|
||||
Text = "Создание косметики";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelCosmeticName;
|
||||
private TextBox textBoxCosmeticName;
|
||||
private TextBox textBoxСosmeticPrice;
|
||||
private Label labelCosmeticPrice;
|
||||
private Button buttonSave;
|
||||
private Button buttonСancel;
|
||||
}
|
||||
}
|
95
BeautyStudio/BeautyStudioView/FormCreateCosmetic.cs
Normal file
95
BeautyStudio/BeautyStudioView/FormCreateCosmetic.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.BusinessLogicContracts;
|
||||
using BeautyStudioContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 BeautyStudioView
|
||||
{
|
||||
public partial class FormCreateCosmetic : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICosmeticLogic _logic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
|
||||
public FormCreateCosmetic(ILogger<FormCreateCosmetic> logger, ICosmeticLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormCreateCosmetic_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Получение косметики");
|
||||
var view = _logic.ReadElement(new CosmeticSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxCosmeticName.Text = view.CosmeticName;
|
||||
textBoxСosmeticPrice.Text = view.CosmeticPrice.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения косметики");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCosmeticName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение косметики");
|
||||
try
|
||||
{
|
||||
var model = new CosmeticBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
CosmeticName = textBoxCosmeticName.Text,
|
||||
CosmeticPrice = Convert.ToDouble(textBoxСosmeticPrice.Text)
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения косметики");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
BeautyStudio/BeautyStudioView/FormCreateCosmetic.resx
Normal file
120
BeautyStudio/BeautyStudioView/FormCreateCosmetic.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
39
BeautyStudio/BeautyStudioView/FormCreateOrder.Designer.cs
generated
Normal file
39
BeautyStudio/BeautyStudioView/FormCreateOrder.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
partial class FormCreateOrder
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "FormCreateOrder";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
20
BeautyStudio/BeautyStudioView/FormCreateOrder.cs
Normal file
20
BeautyStudio/BeautyStudioView/FormCreateOrder.cs
Normal file
@ -0,0 +1,20 @@
|
||||
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 BeautyStudioView
|
||||
{
|
||||
public partial class FormCreateOrder : Form
|
||||
{
|
||||
public FormCreateOrder()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
partial class Form1
|
||||
partial class FormLabor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// 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)
|
||||
@ -23,8 +23,8 @@
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
@ -36,4 +36,4 @@
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
20
BeautyStudio/BeautyStudioView/FormLabor.cs
Normal file
20
BeautyStudio/BeautyStudioView/FormLabor.cs
Normal file
@ -0,0 +1,20 @@
|
||||
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 BeautyStudioView
|
||||
{
|
||||
public partial class FormLabor : Form
|
||||
{
|
||||
public FormLabor()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
120
BeautyStudio/BeautyStudioView/FormLabor.resx
Normal file
120
BeautyStudio/BeautyStudioView/FormLabor.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
112
BeautyStudio/BeautyStudioView/FormMain.Designer.cs
generated
Normal file
112
BeautyStudio/BeautyStudioView/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||
toolStrip1 = new ToolStrip();
|
||||
ordersToolStrip = new ToolStripDropDownButton();
|
||||
toolStripDropDownButton1 = new ToolStripDropDownButton();
|
||||
списокУслугToolStripMenuItem = new ToolStripMenuItem();
|
||||
списокПроцедурПоКосметикеToolStripMenuItem = new ToolStripMenuItem();
|
||||
списокУслугПоЗаказамИТрудозатратамToolStripMenuItem = new ToolStripMenuItem();
|
||||
toolStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
toolStrip1.Items.AddRange(new ToolStripItem[] { ordersToolStrip, toolStripDropDownButton1 });
|
||||
toolStrip1.Location = new Point(0, 0);
|
||||
toolStrip1.Name = "toolStrip1";
|
||||
toolStrip1.Size = new Size(1047, 25);
|
||||
toolStrip1.TabIndex = 0;
|
||||
toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// ordersToolStrip
|
||||
//
|
||||
ordersToolStrip.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
ordersToolStrip.Image = (Image)resources.GetObject("ordersToolStrip.Image");
|
||||
ordersToolStrip.ImageAlign = ContentAlignment.MiddleRight;
|
||||
ordersToolStrip.ImageTransparentColor = Color.Magenta;
|
||||
ordersToolStrip.Name = "ordersToolStrip";
|
||||
ordersToolStrip.Size = new Size(59, 22);
|
||||
ordersToolStrip.Text = "Заказы";
|
||||
//
|
||||
// toolStripDropDownButton1
|
||||
//
|
||||
toolStripDropDownButton1.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
toolStripDropDownButton1.DropDownItems.AddRange(new ToolStripItem[] { списокУслугToolStripMenuItem, списокПроцедурПоКосметикеToolStripMenuItem, списокУслугПоЗаказамИТрудозатратамToolStripMenuItem });
|
||||
toolStripDropDownButton1.Image = (Image)resources.GetObject("toolStripDropDownButton1.Image");
|
||||
toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
|
||||
toolStripDropDownButton1.Name = "toolStripDropDownButton1";
|
||||
toolStripDropDownButton1.Size = new Size(61, 22);
|
||||
toolStripDropDownButton1.Text = "Отчёты";
|
||||
toolStripDropDownButton1.ToolTipText = "Отчёты";
|
||||
//
|
||||
// списокУслугToolStripMenuItem
|
||||
//
|
||||
списокУслугToolStripMenuItem.Name = "списокУслугToolStripMenuItem";
|
||||
списокУслугToolStripMenuItem.Size = new Size(249, 22);
|
||||
списокУслугToolStripMenuItem.Text = "Список услуг";
|
||||
//
|
||||
// списокПроцедурПоКосметикеToolStripMenuItem
|
||||
//
|
||||
списокПроцедурПоКосметикеToolStripMenuItem.Name = "списокПроцедурПоКосметикеToolStripMenuItem";
|
||||
списокПроцедурПоКосметикеToolStripMenuItem.Size = new Size(249, 22);
|
||||
списокПроцедурПоКосметикеToolStripMenuItem.Text = "Список процедур по косметике";
|
||||
//
|
||||
// списокУслугПоЗаказамИТрудозатратамToolStripMenuItem
|
||||
//
|
||||
списокУслугПоЗаказамИТрудозатратамToolStripMenuItem.Name = "списокУслугПоЗаказамИТрудозатратамToolStripMenuItem";
|
||||
списокУслугПоЗаказамИТрудозатратамToolStripMenuItem.Size = new Size(304, 22);
|
||||
списокУслугПоЗаказамИТрудозатратамToolStripMenuItem.Text = "Список услуг по заказам и трудозатратам";
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1047, 450);
|
||||
Controls.Add(toolStrip1);
|
||||
Name = "FormMain";
|
||||
Text = "Учет услуг";
|
||||
toolStrip1.ResumeLayout(false);
|
||||
toolStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ToolStrip toolStrip1;
|
||||
private ToolStripDropDownButton ordersToolStrip;
|
||||
private ToolStripDropDownButton toolStripDropDownButton1;
|
||||
private ToolStripMenuItem списокУслугToolStripMenuItem;
|
||||
private ToolStripMenuItem списокПроцедурПоКосметикеToolStripMenuItem;
|
||||
private ToolStripMenuItem списокУслугПоЗаказамИТрудозатратамToolStripMenuItem;
|
||||
}
|
||||
}
|
25
BeautyStudio/BeautyStudioView/FormMain.cs
Normal file
25
BeautyStudio/BeautyStudioView/FormMain.cs
Normal file
@ -0,0 +1,25 @@
|
||||
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 BeautyStudioView
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void toolStripTextBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
142
BeautyStudio/BeautyStudioView/FormMain.resx
Normal file
142
BeautyStudio/BeautyStudioView/FormMain.resx
Normal file
@ -0,0 +1,142 @@
|
||||
<?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>
|
||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="ordersToolStrip.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
125
BeautyStudio/BeautyStudioView/FormOrders.Designer.cs
generated
Normal file
125
BeautyStudio/BeautyStudioView/FormOrders.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
partial class FormOrders
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewOrders = new DataGridView();
|
||||
buttonСreate = new Button();
|
||||
buttonWork = new Button();
|
||||
buttonReady = new Button();
|
||||
buttonIssued = new Button();
|
||||
buttonRefresh = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewOrders).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewOrders
|
||||
//
|
||||
dataGridViewOrders.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewOrders.Location = new Point(12, 12);
|
||||
dataGridViewOrders.Name = "dataGridViewOrders";
|
||||
dataGridViewOrders.Size = new Size(647, 426);
|
||||
dataGridViewOrders.TabIndex = 0;
|
||||
//
|
||||
// buttonСreate
|
||||
//
|
||||
buttonСreate.Location = new Point(665, 113);
|
||||
buttonСreate.Name = "buttonСreate";
|
||||
buttonСreate.Size = new Size(126, 23);
|
||||
buttonСreate.TabIndex = 1;
|
||||
buttonСreate.Text = "Создать заказ";
|
||||
buttonСreate.UseVisualStyleBackColor = true;
|
||||
buttonСreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// buttonWork
|
||||
//
|
||||
buttonWork.Location = new Point(665, 156);
|
||||
buttonWork.Name = "buttonWork";
|
||||
buttonWork.Size = new Size(126, 39);
|
||||
buttonWork.TabIndex = 2;
|
||||
buttonWork.Text = "Отдать на выполнение";
|
||||
buttonWork.UseVisualStyleBackColor = true;
|
||||
buttonWork.Click += buttonWork_Click;
|
||||
//
|
||||
// buttonReady
|
||||
//
|
||||
buttonReady.Location = new Point(665, 219);
|
||||
buttonReady.Name = "buttonReady";
|
||||
buttonReady.Size = new Size(126, 23);
|
||||
buttonReady.TabIndex = 3;
|
||||
buttonReady.Text = "Заказ готов";
|
||||
buttonReady.UseVisualStyleBackColor = true;
|
||||
buttonReady.Click += buttonReady_Click;
|
||||
//
|
||||
// buttonIssued
|
||||
//
|
||||
buttonIssued.Location = new Point(665, 259);
|
||||
buttonIssued.Name = "buttonIssued";
|
||||
buttonIssued.Size = new Size(126, 23);
|
||||
buttonIssued.TabIndex = 4;
|
||||
buttonIssued.Text = "Заказ выдан";
|
||||
buttonIssued.UseVisualStyleBackColor = true;
|
||||
buttonIssued.Click += buttonIssued_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(665, 301);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(123, 23);
|
||||
buttonRefresh.TabIndex = 5;
|
||||
buttonRefresh.Text = "Обновить список";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// FormOrders
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(buttonRefresh);
|
||||
Controls.Add(buttonIssued);
|
||||
Controls.Add(buttonReady);
|
||||
Controls.Add(buttonWork);
|
||||
Controls.Add(buttonСreate);
|
||||
Controls.Add(dataGridViewOrders);
|
||||
Name = "FormOrders";
|
||||
Text = "Заказы";
|
||||
Load += FormOrders_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewOrders).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewOrders;
|
||||
private Button buttonСreate;
|
||||
private Button buttonWork;
|
||||
private Button buttonReady;
|
||||
private Button buttonIssued;
|
||||
private Button buttonRefresh;
|
||||
}
|
||||
}
|
133
BeautyStudio/BeautyStudioView/FormOrders.cs
Normal file
133
BeautyStudio/BeautyStudioView/FormOrders.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using BeautyStudioContracts.BindingModels;
|
||||
using BeautyStudioContracts.BusinessLogicContracts;
|
||||
using BeautyStudioView;
|
||||
using BeautyStudioBusinessLogic.BusinessLogic;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 BeautyStudioView
|
||||
{
|
||||
public partial class FormOrders : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
public FormOrders(ILogger<FormOrders> logger, IOrderLogic orderLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
}
|
||||
private void FormOrders_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
// прописать логику
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridViewOrders.DataSource = list;
|
||||
dataGridViewOrders.Columns["ServiceId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка услуг");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки услуг");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||
if (service is FormCreateOrder form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
private void buttonWork_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridViewOrders.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridViewOrders.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void buttonReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridViewOrders.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridViewOrders.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void buttonIssued_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridViewOrders.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridViewOrders.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
BeautyStudio/BeautyStudioView/FormOrders.resx
Normal file
120
BeautyStudio/BeautyStudioView/FormOrders.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
@ -1,7 +1,17 @@
|
||||
using BeautyStudioBusinessLogic.BusinessLogic;
|
||||
using BeautyStudioBusinessLogic.BusinessLogics;
|
||||
using BeautyStudioContracts.BusinessLogicContracts;
|
||||
using BeautyStudioContracts.StoragesContracts;
|
||||
using BeautyStudioDatabaseImplement.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NLog.Extensions.Logging;
|
||||
|
||||
namespace BeautyStudioView
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
@ -11,7 +21,49 @@ namespace BeautyStudioView
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IComputerStorage, ComputerStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IComputerLogic, ComputerLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||
|
||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormCosmetics>();
|
||||
services.AddTransient<FormCreateCosmetic>();
|
||||
services.AddTransient<FormComponents>();
|
||||
services.AddTransient<FormCreateOrder>();
|
||||
services.AddTransient<FormComputer>();
|
||||
services.AddTransient<FormComputers>();
|
||||
services.AddTransient<FormComputerComponent>();
|
||||
services.AddTransient<FormReportComputerComponents>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormImplementer>();
|
||||
services.AddTransient<FormImplementers>();
|
||||
}
|
||||
}
|
||||
}
|
63
BeautyStudio/BeautyStudioView/Properties/Resources.Designer.cs
generated
Normal file
63
BeautyStudio/BeautyStudioView/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BeautyStudioView.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BeautyStudioView.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
BeautyStudio/BeautyStudioView/Properties/Resources.resx
Normal file
120
BeautyStudio/BeautyStudioView/Properties/Resources.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
Loading…
Reference in New Issue
Block a user