This commit is contained in:
georgiy semikolenov 2023-04-08 15:04:58 +04:00
parent 0d88001aaa
commit 29578db964
92 changed files with 3263 additions and 0 deletions

View File

@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationView", "ServiceStationView\ServiceStationView.csproj", "{57B42CA9-DC03-4705-BCDA-4B367028857E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationDataModels", "ServiceStationDataModels\ServiceStationDataModels.csproj", "{A3F34BD4-4F04-4E21-8C8B-115E681957E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationContracts", "ServiceStationContracts\ServiceStationContracts.csproj", "{F5B0E7C1-7436-43A3-A497-21FA04882360}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationBusinessLogic", "ServiceStationBusinessLogic\ServiceStationBusinessLogic.csproj", "{90FBC077-24C7-4EF8-8AC9-172AB6A7DC8C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationDatabaseImplement", "ServiceStationDatabaseImplement\ServiceStationDatabaseImplement.csproj", "{E6195FD3-5524-4AD7-A387-4925559485CE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{57B42CA9-DC03-4705-BCDA-4B367028857E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{57B42CA9-DC03-4705-BCDA-4B367028857E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57B42CA9-DC03-4705-BCDA-4B367028857E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57B42CA9-DC03-4705-BCDA-4B367028857E}.Release|Any CPU.Build.0 = Release|Any CPU
{A3F34BD4-4F04-4E21-8C8B-115E681957E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3F34BD4-4F04-4E21-8C8B-115E681957E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3F34BD4-4F04-4E21-8C8B-115E681957E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3F34BD4-4F04-4E21-8C8B-115E681957E8}.Release|Any CPU.Build.0 = Release|Any CPU
{F5B0E7C1-7436-43A3-A497-21FA04882360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5B0E7C1-7436-43A3-A497-21FA04882360}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5B0E7C1-7436-43A3-A497-21FA04882360}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5B0E7C1-7436-43A3-A497-21FA04882360}.Release|Any CPU.Build.0 = Release|Any CPU
{90FBC077-24C7-4EF8-8AC9-172AB6A7DC8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90FBC077-24C7-4EF8-8AC9-172AB6A7DC8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90FBC077-24C7-4EF8-8AC9-172AB6A7DC8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90FBC077-24C7-4EF8-8AC9-172AB6A7DC8C}.Release|Any CPU.Build.0 = Release|Any CPU
{E6195FD3-5524-4AD7-A387-4925559485CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6195FD3-5524-4AD7-A387-4925559485CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6195FD3-5524-4AD7-A387-4925559485CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6195FD3-5524-4AD7-A387-4925559485CE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4E0AA942-CAF9-486C-9B34-FAC331F8F845}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,112 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class CarLogic : ICarLogic
{
private readonly ILogger _logger;
private readonly ICarStorage _carStorage;
public CarLogic(ILogger logger, ICarStorage carStorage)
{
_logger = logger;
_carStorage = carStorage;
}
public List<CarViewModel>? ReadList(CarSearchModel? model)
{
_logger.LogInformation("ReadList.CarId:{ CarId}", model?.Id);
var list = model == null ? _carStorage.GetFullList() : _carStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public CarViewModel? ReadElement(CarSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. CarId:{ CarId}", model?.Id);
var element = _carStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(CarBindingModel model)
{
CheckModel(model);
if (_carStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(CarBindingModel model)
{
CheckModel(model);
if (_carStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(CarBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_carStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(CarBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Brand))
{
throw new ArgumentNullException("Нет бренда автомобиля", nameof(model.Brand));
}
if (string.IsNullOrEmpty(model.Model))
{
throw new ArgumentNullException("Нет модели автомобиля", nameof(model.Model));
}
if (string.IsNullOrEmpty(model.VIN))
{
throw new ArgumentNullException("Нет VIN автомобиля", nameof(model.Model));
}
var element = _carStorage.GetElement(new CarSearchModel
{
VIN = model.VIN
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Автомобиль с таким VIN уже есть");
}
_logger.LogInformation("Car. Id:{ Id}.CarBrand:{CarBrand}.CarModel:{CarModel}.CarVIN:{CarVIN}", model?.Id, model?.Brand, model?.Brand, model?.VIN);
}
}
}

View File

@ -0,0 +1,111 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class EmployerLogic : IEmployerLogic
{
private readonly ILogger _logger;
private readonly IEmployerStorage _employerStorage;
public EmployerLogic(ILogger logger, IEmployerStorage employerStorage)
{
_logger = logger;
_employerStorage = employerStorage;
}
public List<EmployerViewModel>? ReadList(EmployerSearchModel? model)
{
_logger.LogInformation("ReadList. EmployerId:{ EmployerId}", model?.Id);
var list = model == null ? _employerStorage.GetFullList() : _employerStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public EmployerViewModel? ReadElement(EmployerSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. EmployerId:{ EmployerId}", model?.Id);
var element = _employerStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(EmployerBindingModel model)
{
CheckModel(model);
if (_employerStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(EmployerBindingModel model)
{
CheckModel(model);
if (_employerStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(EmployerBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_employerStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(EmployerBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Login))
{
throw new ArgumentNullException("Нет логина работника", nameof(model.Login));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет почты работника", nameof(model.Email));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля работника", nameof(model.Password));
}
var element = _employerStorage.GetElement(new EmployerSearchModel
{
Login = model.Login
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("работник с таким логином уже есть");
}
_logger.LogInformation("Employer. EmployerId:{ Id}.EmployerLogin:{EmployerLogin}.EmployerEmail:{EmployerEmail}", model?.Id, model?.Login, model?.Email);
}
}
}

View File

@ -0,0 +1,99 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class MaintenanceLogic : IMaintenanceLogic
{
private readonly ILogger _logger;
private readonly IMaintenanceStorage _maintenanceStorage;
public MaintenanceLogic(ILogger logger, IMaintenanceStorage maintenanceStorage)
{
_logger = logger;
_maintenanceStorage = maintenanceStorage;
}
public List<MaintenanceViewModel>? ReadList(MaintenanceSearchModel? model)
{
_logger.LogInformation("ReadList. MaintenanceId:{ MaintenanceId}", model?.Id);
var list = model == null ? _maintenanceStorage.GetFullList() : _maintenanceStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public MaintenanceViewModel? ReadElement(MaintenanceSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. MaintenanceId:{ MaintenanceId}", model?.Id);
var element = _maintenanceStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(MaintenanceBindingModel model)
{
CheckModel(model);
if (_maintenanceStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(MaintenanceBindingModel model)
{
CheckModel(model);
if (_maintenanceStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(MaintenanceBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_maintenanceStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(MaintenanceBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.EmployerId<0)
{
throw new ArgumentNullException("Некорректный идентификатор работника", nameof(model.EmployerId));
}
if (model.Cost<=0)
{
throw new ArgumentNullException("Стоимость должна быть больше нуля", nameof(model.Cost));
}
_logger.LogInformation("Maintenance. MaintenanceId:{MaintenanceId}.EmployerId: { EmployerId}.Cost:{Cost}", model.Id, model.EmployerId, model.Cost);
}
}
}

View File

@ -0,0 +1,59 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using System.Security.Cryptography.X509Certificates;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class ReportLogic : IReportLogic
{
private readonly IMaintenanceStorage _maintenanceStorage;
private readonly ISpareStorage _spareStorage;
private readonly ICarStorage _carStorage;
public ReportLogic(IMaintenanceStorage maintenanceStorage, ISpareStorage spareStorage, ICarStorage carStorage)
{
_carStorage = carStorage;
_maintenanceStorage = maintenanceStorage;
_spareStorage = spareStorage;
}
public List<ReportViewModel> GetCarsAndSpares(ReportBindingModel model)
{
var maintenances = _maintenanceStorage.GetFilteredList(new MaintenanceSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo });
var result = new List<ReportViewModel>();
foreach (var maintenance in maintenances) {
var cars = _maintenanceStorage.GetMaintenaceCars(new MaintenanceSearchModel { Id = maintenance.Id }).ToList();
List<String> cars_spares = new List<String>();
foreach (var car in cars)
{
var spare = _maintenanceStorage.GetCarsSpares(new MaintenanceSearchModel { Id = maintenance.Id }, new CarSearchModel { Id = car.Id }).Select(x => x.Name).ToList();
cars_spares.AddRange(spare);
}
result.Add(new ReportViewModel
{
Cost = maintenance.Cost,
Spares = cars_spares,
Cars = cars.Select(x => x.VIN).ToList()
});
}
return result;
}
public void SaveToPdfFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
public void SaveToExcelFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
public void SaveToWordFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,91 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class ServiceLogic : IServiceLogic
{
private readonly ILogger _logger;
private readonly IServiceStorage _serviceStorage;
public ServiceLogic(ILogger logger, IServiceStorage serviceStorage)
{
_logger = logger;
_serviceStorage = serviceStorage;
}
public List<ServiceViewModel>? ReadList(ServiceSearchModel? model)
{
_logger.LogInformation("ReadList. ServiceId:{ ServiceId}", model?.Id);
var list = model == null ? _serviceStorage.GetFullList() : _serviceStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public ServiceViewModel? ReadElement(ServiceSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. ServiceId:{ ServiceId}", model.Id);
var element = _serviceStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(ServiceBindingModel model)
{
CheckModel(model);
if (_serviceStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(ServiceBindingModel model)
{
CheckModel(model);
if (_serviceStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(ServiceBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_serviceStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(ServiceBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
_logger.LogInformation("Service. ServiceId: { ServiceId}.", model.Id);
}
}
}

View File

@ -0,0 +1,109 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class SpareLogic : ISpareLogic
{
private readonly ILogger _logger;
private readonly ISpareStorage _spareStorage;
public SpareLogic(ILogger logger, ISpareStorage spareStorage)
{
_logger = logger;
_spareStorage = spareStorage;
}
public List<SpareViewModel>? ReadList(SpareSearchModel? model)
{
_logger.LogInformation("ReadList.SpareId:{Id}", model?.Id);
var list = model == null ? _spareStorage.GetFullList() : _spareStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public SpareViewModel? ReadElement(SpareSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. SpareId:{Id}", model?.Id);
var element = _spareStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(SpareBindingModel model)
{
CheckModel(model);
if (_spareStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(SpareBindingModel model)
{
CheckModel(model);
if (_spareStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(SpareBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_spareStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(SpareBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет название детали", nameof(model.Name));
}
if (model.Price <= 0)
{
throw new ArgumentNullException("Неправильная цена детали", nameof(model.Price));
}
var element = _spareStorage.GetElement(new SpareSearchModel
{
Name = model.Name
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Деталь с таким названием уже есть");
}
_logger.LogInformation("Spare. Id:{ Id}.Name:{Name}.Price:{Price}", model?.Id, model?.Name, model?.Price);
}
}
}

View File

@ -0,0 +1,113 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class StorekeeperLogic : IStorekeeperLogic
{
private readonly ILogger _logger;
private readonly IStorekeeperStorage _storekeeperStorage;
public StorekeeperLogic(ILogger logger, IStorekeeperStorage storekeeperStorage)
{
_logger = logger;
_storekeeperStorage = storekeeperStorage;
}
public List<StorekeeperViewModel>? ReadList(StorekeeperSearchModel? model)
{
_logger.LogInformation("ReadList.StorekeeperId:{Id}", model?.Id);
var list = model == null ? _storekeeperStorage.GetFullList() : _storekeeperStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public StorekeeperViewModel? ReadElement(StorekeeperSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. StorekeeperId:{Id}", model?.Id);
var element = _storekeeperStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(StorekeeperBindingModel model)
{
CheckModel(model);
if (_storekeeperStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(StorekeeperBindingModel model)
{
CheckModel(model);
if (_storekeeperStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(StorekeeperBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_storekeeperStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(StorekeeperBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Login))
{
throw new ArgumentNullException("Нет логина кладовщика", nameof(model.Login));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля кладовщика", nameof(model.Password));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет почты кладовщика", nameof(model.Email));
}
var element = _storekeeperStorage.GetElement(new StorekeeperSearchModel
{
Login = model.Login,
Email = model.Email
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Кладовщик с такими параметрами уже есть");
}
_logger.LogInformation("Storekeeper. Id:{ Id}.Login:{Login}.Email:{Email}.Password:{Password}", model?.Id, model?.Login, model?.Email, model?.Password);
}
}
}

View File

@ -0,0 +1,96 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class WorkDurationLogic : IWorkDurationLogic
{
private readonly ILogger _logger;
private readonly IWorkDurationStorage _workDurationStorage;
public WorkDurationLogic(ILogger logger, IWorkDurationStorage workDurationStorage)
{
_logger = logger;
_workDurationStorage = workDurationStorage;
}
public List<WorkDurationViewModel>? ReadList(WorkDurationSearchModel? model)
{
_logger.LogInformation("ReadList.WorkDurationId:{Id}", model?.Id);
var list = model == null ? _workDurationStorage.GetFullList() : _workDurationStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public WorkDurationViewModel? ReadElement(WorkDurationSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. WorkDurationId:{Id}", model?.Id);
var element = _workDurationStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(WorkDurationBindingModel model)
{
CheckModel(model);
if (_workDurationStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(WorkDurationBindingModel model)
{
CheckModel(model);
if (_workDurationStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(WorkDurationBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_workDurationStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(WorkDurationBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.Duration < 0)
{
throw new ArgumentNullException("Нет длительности", nameof(model.Duration));
}
_logger.LogInformation("WorkDuration. Id:{ Id}.Duration:{Duration}", model?.Id, model?.Duration);
}
}
}

View File

@ -0,0 +1,108 @@
using Microsoft.Extensions.Logging;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicsContracts;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
namespace ServiceStationBusinessLogic.BusinessLogics
{
public class WorkLogic : IWorkLogic
{
private readonly ILogger _logger;
private readonly IWorkStorage _workStorage;
public WorkLogic(ILogger logger, IWorkStorage workStorage)
{
_logger = logger;
_workStorage = workStorage;
}
public List<WorkViewModel>? ReadList(WorkSearchModel? model)
{
_logger.LogInformation("ReadList.WorkId:{Id}", model?.Id);
var list = model == null ? _workStorage.GetFullList() : _workStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public WorkViewModel? ReadElement(WorkSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. WorkId:{ Id}", model?.Id);
var element = _workStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(WorkBindingModel model)
{
CheckModel(model);
if (_workStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(WorkBindingModel model)
{
CheckModel(model);
if (_workStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(WorkBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_workStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(WorkBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Title))
{
throw new ArgumentNullException("Нет названия работы", nameof(model.Title));
}
if (model.Price < 0)
{
throw new ArgumentNullException("Нет цены работы", nameof(model.Price));
}
var element = _workStorage.GetElement(new WorkSearchModel
{
Title = model.Title,
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Работа с таким именем уже есть");
}
_logger.LogInformation("Work. Id:{ Id}.Title:{Title}.Price:{Price}", model?.Id, model?.Title, model?.Price);
}
}
}

View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Implements\**" />
<Compile Remove="OfficePackage\**" />
<EmbeddedResource Remove="Implements\**" />
<EmbeddedResource Remove="OfficePackage\**" />
<None Remove="Implements\**" />
<None Remove="OfficePackage\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceStationContracts\ServiceStationContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,14 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class CarBindingModel : ICarModel
{
public int Id { get; set; }
public string Brand { get; set; } = string.Empty;
public string Model { get; set; } = string.Empty;
public string VIN { get; set; } = string.Empty;
public Dictionary<int, (ISpareModel, int)> CarSpares { get; set; } = new();
}
}

View File

@ -0,0 +1,12 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class EmployerBindingModel : IEmployerModel
{
public int Id { get; set; }
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,13 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class MaintenanceBindingModel : IMaintenanceModel
{
public int Id { get; set; }
public int EmployerId { get; set; }
public double Cost { get; set; }
public DateTime DateCreate { get; set; }
public Dictionary<int, (ICarModel, int)> MaintenanceCars { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationContracts.BindingModels
{
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,10 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class ServiceBindingModel : IServiceModel
{
public int Id { get; set; }
public string ServiceDescription { get; set; }=string.Empty;
}
}

View File

@ -0,0 +1,13 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class SpareBindingModel : ISpareModel
{
public int Id { get; set; }
public string Name { get; set; } = String.Empty;
public double Price { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class StorekeeperBindingModel : IStorekeeperModel
{
public int Id { get; set; }
public string Login { get; set; } = String.Empty;
public string Password { get; set; } = String.Empty;
public string Email { get; set; } = String.Empty;
}
}

View File

@ -0,0 +1,23 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class WorkBindingModel : IWorkModel
{
public int Id { get; set; }
public string Title { get; set; } = String.Empty;
public double Price { get; set; }
public int StorekeeperId { get; set; }
public int DurationId { get; set; }
public Dictionary<int, (ISpareModel, int)> WorkSpares { get; set; } = new();
public Dictionary<int, (IMaintenanceModel, int)> WorkMaintences { get; set; } = new();
}
}

View File

@ -0,0 +1,11 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels
{
public class WorkDurationBindingModel : IWorkDurationModel
{
public int Id { get; set; }
public int Duration { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface ICarLogic
{
List<CarViewModel>? ReadList(CarSearchModel? model);
CarViewModel? ReadElement(CarSearchModel? model);
bool Create(CarBindingModel model);
bool Update(CarBindingModel model);
bool Delete(CarBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface IEmployerLogic
{
List<EmployerViewModel>? ReadList(EmployerSearchModel? model);
EmployerViewModel? ReadElement(EmployerSearchModel? model);
bool Create(EmployerBindingModel model);
bool Update(EmployerBindingModel model);
bool Delete(EmployerBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface IMaintenanceLogic
{
List<MaintenanceViewModel>? ReadList(MaintenanceSearchModel? model);
MaintenanceViewModel? ReadElement(MaintenanceSearchModel? model);
bool Create(MaintenanceBindingModel model);
bool Update(MaintenanceBindingModel model);
bool Delete(MaintenanceBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface IReportLogic
{
List<ReportViewModel> GetCarsAndSpares(ReportBindingModel model);
void SaveToWordFile(ReportBindingModel model);
void SaveToExcelFile(ReportBindingModel model);
void SaveToPdfFile(ReportBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface IServiceLogic
{
List<ServiceViewModel>? ReadList(ServiceSearchModel? model);
ServiceViewModel? ReadElement(ServiceSearchModel? model);
bool Create(ServiceBindingModel model);
bool Update(ServiceBindingModel model);
bool Delete(ServiceBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface ISpareLogic
{
List<SpareViewModel>? ReadList(SpareSearchModel? model);
SpareViewModel? ReadElement(SpareSearchModel? model);
bool Create(SpareBindingModel model);
bool Update(SpareBindingModel model);
bool Delete(SpareBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface IStorekeeperLogic
{
List<StorekeeperViewModel>? ReadList(StorekeeperSearchModel? model);
StorekeeperViewModel? ReadElement(StorekeeperSearchModel? model);
bool Create(StorekeeperBindingModel model);
bool Update(StorekeeperBindingModel model);
bool Delete(StorekeeperBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface IWorkDurationLogic
{
List<WorkDurationViewModel>? ReadList(WorkDurationSearchModel? model);
WorkDurationViewModel? ReadElement(WorkDurationSearchModel? model);
bool Create(WorkDurationBindingModel model);
bool Update(WorkDurationBindingModel model);
bool Delete(WorkDurationBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicsContracts
{
public interface IWorkLogic
{
List<WorkViewModel>? ReadList(WorkSearchModel? model);
WorkViewModel? ReadElement(WorkSearchModel? model);
bool Create(WorkBindingModel model);
bool Update(WorkBindingModel model);
bool Delete(WorkBindingModel model);
}
}

View File

@ -0,0 +1,10 @@
namespace ServiceStationContracts.SearchModels
{
public class CarSearchModel
{
public int? Id { get; set; }
public string? Brand { get; set; }
public string? Model { get; set; }
public string? VIN { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace ServiceStationContracts.SearchModels
{
public class EmployerSearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
public string? Email { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace ServiceStationContracts.SearchModels
{
public class MaintenanceSearchModel
{
public int? Id { get; set; }
public int? EmployerId { get; set; }
public double? Cost { get; set; }
public DateTime? DateTo { get; set; }
public DateTime? DateFrom { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace ServiceStationContracts.SearchModels
{
public class ServiceSearchModel
{
public int? Id { get; set; }
public string? ServiceDescription { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.SearchModels
{
public class SpareSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public double? Price { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.SearchModels
{
public class StorekeeperSearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
public string? Email { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.SearchModels
{
public class WorkDurationSearchModel
{
public int? Id { get; set; }
public int? Duration { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.SearchModels
{
public class WorkSearchModel
{
public int? Id { get; set; }
public string? Title { get; set; }
public double? Price { get; set; }
public int? StorekeeperId { get; set; }
public int? DurationId { get; set; }
public Dictionary<int, (ISpareModel, int)>? WorkSpares { get; set; }
public Dictionary<int, (IMaintenanceModel, int)>? WorkMaintenances { get; set; }
}
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceStationDataModels\ServiceStationDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface ICarStorage
{
List<CarViewModel> GetFullList();
List<CarViewModel> GetFilteredList(CarSearchModel model);
CarViewModel? GetElement(CarSearchModel model);
CarViewModel? Insert(CarBindingModel model);
CarViewModel? Update(CarBindingModel model);
CarViewModel? Delete(CarBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface IEmployerStorage
{
List<EmployerViewModel> GetFullList();
List<EmployerViewModel> GetFilteredList(EmployerSearchModel model);
EmployerViewModel? GetElement(EmployerSearchModel model);
EmployerViewModel? Insert(EmployerBindingModel model);
EmployerViewModel? Update(EmployerBindingModel model);
EmployerViewModel? Delete(EmployerBindingModel model);
}
}

View File

@ -0,0 +1,18 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface IMaintenanceStorage
{
List<MaintenanceViewModel> GetFullList();
List<MaintenanceViewModel> GetFilteredList(MaintenanceSearchModel model);
MaintenanceViewModel? GetElement(MaintenanceSearchModel model);
MaintenanceViewModel? Insert(MaintenanceBindingModel model);
MaintenanceViewModel? Update(MaintenanceBindingModel model);
MaintenanceViewModel? Delete(MaintenanceBindingModel model);
public List<CarViewModel> GetMaintenaceCars(MaintenanceSearchModel model);
public List<SpareViewModel> GetCarsSpares(MaintenanceSearchModel model1, CarSearchModel model2);
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface IServiceStorage
{
List<ServiceViewModel> GetFullList();
List<ServiceViewModel> GetFilteredList(ServiceSearchModel model);
ServiceViewModel? GetElement(ServiceSearchModel model);
ServiceViewModel? Insert(ServiceBindingModel model);
ServiceViewModel? Update(ServiceBindingModel model);
ServiceViewModel? Delete(ServiceBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface ISpareStorage
{
List<SpareViewModel> GetFullList();
List<SpareViewModel> GetFilteredList(SpareSearchModel model);
SpareViewModel? GetElement(SpareSearchModel model);
SpareViewModel? Insert(SpareBindingModel model);
SpareViewModel? Update(SpareBindingModel model);
SpareViewModel? Delete(SpareBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface IStorekeeperStorage
{
List<StorekeeperViewModel> GetFullList();
List<StorekeeperViewModel> GetFilteredList(StorekeeperSearchModel model);
StorekeeperViewModel? GetElement(StorekeeperSearchModel model);
StorekeeperViewModel? Insert(StorekeeperBindingModel model);
StorekeeperViewModel? Update(StorekeeperBindingModel model);
StorekeeperViewModel? Delete(StorekeeperBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface IWorkDurationStorage
{
List<WorkDurationViewModel> GetFullList();
List<WorkDurationViewModel> GetFilteredList(WorkDurationSearchModel model);
WorkDurationViewModel? GetElement(WorkDurationSearchModel model);
WorkDurationViewModel? Insert(WorkDurationBindingModel model);
WorkDurationViewModel? Update(WorkDurationBindingModel model);
WorkDurationViewModel? Delete(WorkDurationBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.StoragesContracts
{
public interface IWorkStorage
{
List<WorkViewModel> GetFullList();
List<WorkViewModel> GetFilteredList(WorkSearchModel model);
WorkViewModel? GetElement(WorkSearchModel model);
WorkViewModel? Insert(WorkBindingModel model);
WorkViewModel? Update(WorkBindingModel model);
WorkViewModel? Delete(WorkBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class CarViewModel : ICarModel
{
public int Id { get; set; }
[DisplayName("Название бренда")]
public string Brand { get; set; } = string.Empty;
[DisplayName("Название модели")]
public string Model { get; set; } = string.Empty;
[DisplayName("VIN номер")]
public string VIN { get; set; } = string.Empty;
public Dictionary<int, (ISpareModel, int)> CarSpares { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class EmployerViewModel : IEmployerModel
{
public int Id { get; set; }
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
[DisplayName("Почта")]
public string Email { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class MaintenanceViewModel : IMaintenanceModel
{
public int Id { get; set; }
public int EmployerId { get; set; }
[DisplayName("Стоимость")]
public double Cost { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
public Dictionary<int, (ICarModel, int)> MaintenanceCars { get; set; } = new();
}
}

View File

@ -0,0 +1,10 @@
namespace ServiceStationContracts.ViewModels
{
public class ReportViewModel
{
public double Cost { get; set; }
public List<string> Cars { get; set; } = new();
public List<string> Spares { get; set; } = new();
}
}

View File

@ -0,0 +1,12 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class ServiceViewModel : IServiceModel
{
public int Id { get; set; }
[DisplayName("Описание сервиса")]
public string ServiceDescription { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class SpareViewModel : ISpareModel
{
public int Id { get; set; }
[DisplayName("Название")]
public string Name { get; set; } = String.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class StorekeeperViewModel : IStorekeeperModel
{
public int Id { get; set; }
[DisplayName("Логин")]
public string Login { get; set; } = String.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = String.Empty;
[DisplayName("Почта")]
public string Email { get; set; } = String.Empty;
}
}

View File

@ -0,0 +1,12 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class WorkDurationViewModel : IWorkDurationModel
{
public int Id { get; set; }
[DisplayName("Длительность")]
public int Duration { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class WorkViewModel : IWorkModel
{
public int Id { get; set; }
[DisplayName("Название")]
public string Title { get; set; } = String.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public int DurationId { get; set; }
public int StorekeeperId { get; set; }
public Dictionary<int, (ISpareModel, int)> WorkSpares { get; set; } = new();
public Dictionary<int, (IMaintenanceModel, int)> WorkMaintences { get; set; } = new();
}
}

View File

@ -0,0 +1,7 @@
namespace ServiceStationDataModels
{
public interface IId
{
int Id { get; }
}
}

View File

@ -0,0 +1,10 @@
namespace ServiceStationDataModels.Models
{
public interface ICarModel : IId
{
string Brand { get; }
string Model { get; }
string VIN { get; }
Dictionary<int, (ISpareModel, int)> CarSpares { get; }
}
}

View File

@ -0,0 +1,10 @@
namespace ServiceStationDataModels.Models
{
public interface IEmployerModel : IId
{
string Login { get; }
string Password { get; }
string Email { get; }
}
}

View File

@ -0,0 +1,10 @@
namespace ServiceStationDataModels.Models
{
public interface IMaintenanceModel : IId
{
int EmployerId { get; }
double Cost { get; }
DateTime DateCreate { get; }
Dictionary<int, (ICarModel, int)> MaintenanceCars { get; }
}
}

View File

@ -0,0 +1,7 @@
namespace ServiceStationDataModels.Models
{
public interface IServiceModel : IId
{
string ServiceDescription { get; }
}
}

View File

@ -0,0 +1,9 @@
namespace ServiceStationDataModels.Models
{
public interface ISpareModel : IId
{
string Name { get; }
double Price { get; }
}
}

View File

@ -0,0 +1,10 @@
namespace ServiceStationDataModels.Models
{
public interface IStorekeeperModel : IId
{
string Login { get; }
string Password { get; }
string Email { get; }
}
}

View File

@ -0,0 +1,7 @@
namespace ServiceStationDataModels.Models
{
public interface IWorkDurationModel : IId
{
int Duration { get; }
}
}

View File

@ -0,0 +1,16 @@
namespace ServiceStationDataModels.Models
{
public interface IWorkModel : IId
{
string Title { get; }
double Price { get; }
int StorekeeperId { get; }
int DurationId { get; }
Dictionary<int, (ISpareModel, int)> WorkSpares { get; }
Dictionary<int, (IMaintenanceModel, int)> WorkMaintences { get; }
}
}

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Enums\**" />
<EmbeddedResource Remove="Enums\**" />
<None Remove="Enums\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,96 @@
using Microsoft.EntityFrameworkCore;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class CarStorage : ICarStorage
{
public List<CarViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.Cars.Include(x => x.Spares).ThenInclude(x => x.Spare).ToList()
.Select(x => x.GetViewModel).ToList();
}
public List<CarViewModel> GetFilteredList(CarSearchModel model)
{
if (string.IsNullOrEmpty(model.Brand))
{
return new();
}
using var context = new ServiceStationDatabase();
return context.Cars.Include(x => x.Spares).ThenInclude(x => x.Spare)
.Where(x => x.Brand.Contains(model.Brand)).ToList().Select(x => x.GetViewModel).ToList();
}
public CarViewModel? GetElement(CarSearchModel model)
{
if (string.IsNullOrEmpty(model.Brand) && !model.Id.HasValue)
{
return null;
}
using var context = new ServiceStationDatabase();
return context.Cars.Include(x => x.Spares).ThenInclude(x => x.Spare)
.FirstOrDefault(x =>
(!string.IsNullOrEmpty(model.Brand) && x.Brand == model.Brand) ||
(model.Id.HasValue && x.Id == model.Id))
?.GetViewModel;
}
public CarViewModel? Insert(CarBindingModel model)
{
using var context = new ServiceStationDatabase();
var newCar = Car.Create(context, model);
if (newCar == null)
{
return null;
}
context.Cars.Add(newCar);
context.SaveChanges();
return newCar.GetViewModel;
}
public CarViewModel? Update(CarBindingModel model)
{
using var context = new ServiceStationDatabase();
using var transaction = context.Database.BeginTransaction();
try
{
var Car = context.Cars.FirstOrDefault(rec => rec.Id == model.Id);
if (Car == null)
{
return null;
}
Car.Update(model);
context.SaveChanges();
Car.UpdateComponents(context, model);
transaction.Commit();
return Car.GetViewModel;
}
catch
{
transaction.Rollback();
throw;
}
}
public CarViewModel? Delete(CarBindingModel model)
{
using var context = new ServiceStationDatabase();
var element = context.Cars.Include(x => x.Spares).FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
context.Cars.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
return null;
}
}
}

View File

@ -0,0 +1,79 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class EmployerStorage : IEmployerStorage
{
public List<EmployerViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.Employers.Select(x => x.GetViewModel).ToList();
}
public List<EmployerViewModel> GetFilteredList(EmployerSearchModel model)
{
if (string.IsNullOrEmpty(model.Login) && string.IsNullOrEmpty(model.Email))
{
return new();
}
using var context = new ServiceStationDatabase();
return context.Employers.Where(x => (!string.IsNullOrEmpty(model.Login) && x.Login.Contains(model.Login)) ||
(!string.IsNullOrEmpty(model.Email) && !x.Email.Contains(model.Email))).Select(x => x.GetViewModel).ToList();
}
public EmployerViewModel? GetElement(EmployerSearchModel model)
{
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Login) && (string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.Password)))
{
return null;
}
using var context = new ServiceStationDatabase();
return context.Employers.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) ||
(!string.IsNullOrEmpty(model.Login) && x.Login == model.Login) ||
(!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password) && x.Email == model.Email && x.Password == model.Password))?.GetViewModel;
}
public EmployerViewModel? Insert(EmployerBindingModel model)
{
var newEmployer = Employer.Create(model);
if (newEmployer == null)
{
return null;
}
using var context = new ServiceStationDatabase();
context.Employers.Add(newEmployer);
context.SaveChanges();
return newEmployer.GetViewModel;
}
public EmployerViewModel? Update(EmployerBindingModel model)
{
using var context = new ServiceStationDatabase();
var storekeeper = context.Employers.FirstOrDefault(x => x.Id == model.Id);
if (storekeeper == null)
{
return null;
}
storekeeper.Update(model);
context.SaveChanges();
return storekeeper.GetViewModel;
}
public EmployerViewModel? Delete(EmployerBindingModel model)
{
using var context = new ServiceStationDatabase();
var storekeeper = context.Employers.FirstOrDefault(x => x.Id == model.Id);
if (storekeeper != null)
{
context.Employers.Remove(storekeeper);
context.SaveChanges();
return storekeeper.GetViewModel;
}
return null;
}
}
}

View File

@ -0,0 +1,116 @@
using Microsoft.EntityFrameworkCore;
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class MaintenanceStorage : IMaintenanceStorage
{
public List<MaintenanceViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.Maintenances.Include(x => x.Cars).ThenInclude(x => x.Car).ToList()
.Select(x => x.GetViewModel).ToList();
}
public List<MaintenanceViewModel> GetFilteredList(MaintenanceSearchModel model)
{
using var context = new ServiceStationDatabase();
return context.Maintenances.Include(x => x.Cars).ThenInclude(x => x.Car).ToList().Select(x => x.GetViewModel).ToList();
}
public MaintenanceViewModel? GetElement(MaintenanceSearchModel model)
{
if ( !model.Id.HasValue)
{
return null;
}
using var context = new ServiceStationDatabase();
return context.Maintenances.Include(x => x.Cars).ThenInclude(x => x.Car)
.FirstOrDefault(x =>
(model.Id.HasValue && x.Id == model.Id))
?.GetViewModel;
}
public MaintenanceViewModel? Insert(MaintenanceBindingModel model)
{
using var context = new ServiceStationDatabase();
var newMaintenance = Maintenance.Create(context, model);
if (newMaintenance == null)
{
return null;
}
context.Maintenances.Add(newMaintenance);
context.SaveChanges();
return newMaintenance.GetViewModel;
}
public MaintenanceViewModel? Update(MaintenanceBindingModel model)
{
using var context = new ServiceStationDatabase();
using var transaction = context.Database.BeginTransaction();
try
{
var Maintenance = context.Maintenances.FirstOrDefault(rec => rec.Id == model.Id);
if (Maintenance == null)
{
return null;
}
Maintenance.Update(model);
context.SaveChanges();
Maintenance.UpdateComponents(context, model);
transaction.Commit();
return Maintenance.GetViewModel;
}
catch
{
transaction.Rollback();
throw;
}
}
public MaintenanceViewModel? Delete(MaintenanceBindingModel model)
{
using var context = new ServiceStationDatabase();
var element = context.Maintenances.Include(x => x.Cars).FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
context.Maintenances.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
return null;
}
public List<CarViewModel> GetMaintenaceCars(MaintenanceSearchModel model)
{
if (model == null)
{
return new();
}
using var context = new ServiceStationDatabase();
var cars = context.MaintenanceCars
.Where(x => x.MaintenanceId == model.Id)
.Select(x => x.Car.GetViewModel)
.ToList();
return cars;
}
public List<SpareViewModel> GetCarsSpares(MaintenanceSearchModel model1, CarSearchModel model2)
{
if (model1 == null || model2 == null)
{
return new();
}
using var context = new ServiceStationDatabase();
var cars = context.MaintenanceCars.Where(x => x.MaintenanceId == model1.Id).Select(x=>x.Car).ToList();
var spare = context.CarSpares.Where(x => cars.Contains(x.Car)).Select(x => x.Spare.GetViewModel).ToList();
return spare;
}
}
}

View File

@ -0,0 +1,85 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class ServiceStorage : IServiceStorage
{
public List<ServiceViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.Services.Select(x => x.GetViewModel).ToList();
}
public List<ServiceViewModel> GetFilteredList(ServiceSearchModel model)
{
using var context = new ServiceStationDatabase();
return context.Services.Select(x => x.GetViewModel).ToList();
}
public ServiceViewModel? GetElement(ServiceSearchModel model)
{
if (string.IsNullOrEmpty(model.ServiceDescription) && !model.Id.HasValue)
{
return null;
}
using var context = new ServiceStationDatabase();
return context.Services.FirstOrDefault(x =>
(!string.IsNullOrEmpty(model.ServiceDescription) && x.ServiceDescription == model.ServiceDescription) ||
(model.Id.HasValue && x.Id == model.Id))
?.GetViewModel;
}
public ServiceViewModel? Insert(ServiceBindingModel model)
{
using var context = new ServiceStationDatabase();
var newService = Service.Create(model);
if (newService == null)
{
return null;
}
context.Services.Add(newService);
context.SaveChanges();
return newService.GetViewModel;
}
public ServiceViewModel? Update(ServiceBindingModel model)
{
using var context = new ServiceStationDatabase();
using var transaction = context.Database.BeginTransaction();
try
{
var Service = context.Services.FirstOrDefault(rec => rec.Id == model.Id);
if (Service == null)
{
return null;
}
Service.Update(model);
context.SaveChanges();
transaction.Commit();
return Service.GetViewModel;
}
catch
{
transaction.Rollback();
throw;
}
}
public ServiceViewModel? Delete(ServiceBindingModel model)
{
using var context = new ServiceStationDatabase();
var element = context.Services.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
context.Services.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
return null;
}
}
}

View File

@ -0,0 +1,72 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class SpareStorage : ISpareStorage
{
public List<SpareViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.Spares.Select(x => x.GetViewModel).ToList();
}
public List<SpareViewModel> GetFilteredList(SpareSearchModel model)
{
using var context = new ServiceStationDatabase();
return context.Spares.Select(x => x.GetViewModel).ToList();
}
public SpareViewModel? GetElement(SpareSearchModel model)
{
if (!model.Id.HasValue)
{
return null;
}
using var context = new ServiceStationDatabase();
return context.Spares.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
}
public SpareViewModel? Insert(SpareBindingModel model)
{
using var context = new ServiceStationDatabase();
var newSpares = Spare.Create( model);
if(newSpares == null)
{
return null;
}
context.Spares.Add(newSpares);
context.SaveChanges();
return newSpares.GetViewModel;
}
public SpareViewModel? Update(SpareBindingModel model)
{
using var context = new ServiceStationDatabase();
var spares = context.Spares.FirstOrDefault(x=>x.Id == model.Id);
if(spares == null)
{
return null;
}
spares.Update(model);
context.SaveChanges();
return spares.GetViewModel;
}
public SpareViewModel? Delete(SpareBindingModel model)
{
using var context = new ServiceStationDatabase();
var spare = context.Spares.FirstOrDefault(x=>x.Id==model.Id);
if(spare != null)
{
context.Spares.Remove(spare);
context.SaveChanges();
return spare.GetViewModel;
}
return null;
}
}
}

View File

@ -0,0 +1,79 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class StorekeeperStorage : IStorekeeperStorage
{
public List<StorekeeperViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.Storekeepers.Select(x => x.GetViewModel).ToList();
}
public List<StorekeeperViewModel> GetFilteredList(StorekeeperSearchModel model)
{
if(string.IsNullOrEmpty(model.Login) && string.IsNullOrEmpty(model.Email))
{
return new();
}
using var context = new ServiceStationDatabase();
return context.Storekeepers.Where(x => (!string.IsNullOrEmpty(model.Login) && x.Login.Contains(model.Login)) ||
(!string.IsNullOrEmpty(model.Email) && !x.Email.Contains(model.Email))).Select(x => x.GetViewModel).ToList();
}
public StorekeeperViewModel? GetElement(StorekeeperSearchModel model)
{
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Login) && (string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.Password)))
{
return null;
}
using var context = new ServiceStationDatabase();
return context.Storekeepers.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) ||
(!string.IsNullOrEmpty(model.Login) && x.Login == model.Login) ||
(!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password) && x.Email == model.Email && x.Password == model.Password))?.GetViewModel;
}
public StorekeeperViewModel? Insert(StorekeeperBindingModel model)
{
var newStorekeeper = Storekeeper.Create(model);
if(newStorekeeper == null)
{
return null;
}
using var context = new ServiceStationDatabase();
context.Storekeepers.Add(newStorekeeper);
context.SaveChanges();
return newStorekeeper.GetViewModel;
}
public StorekeeperViewModel? Update(StorekeeperBindingModel model)
{
using var context = new ServiceStationDatabase();
var storekeeper = context.Storekeepers.FirstOrDefault(x=>x.Id == model.Id);
if(storekeeper == null)
{
return null;
}
storekeeper.Update(model);
context.SaveChanges();
return storekeeper.GetViewModel;
}
public StorekeeperViewModel? Delete(StorekeeperBindingModel model)
{
using var context = new ServiceStationDatabase();
var storekeeper = context.Storekeepers.FirstOrDefault(x=>x.Id==model.Id);
if(storekeeper != null)
{
context.Storekeepers.Remove(storekeeper);
context.SaveChanges();
return storekeeper.GetViewModel;
}
return null;
}
}
}

View File

@ -0,0 +1,72 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class WorkDurationStorage : IWorkDurationStorage
{
public List<WorkDurationViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.WorkDurations.Select(x => x.GetViewModel).ToList();
}
public List<WorkDurationViewModel> GetFilteredList(WorkDurationSearchModel model)
{
using var context = new ServiceStationDatabase();
return context.WorkDurations.Select(x => x.GetViewModel).ToList();
}
public WorkDurationViewModel? GetElement(WorkDurationSearchModel model)
{
if (!model.Id.HasValue)
{
return null;
}
using var context = new ServiceStationDatabase();
return context.WorkDurations.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
}
public WorkDurationViewModel? Insert(WorkDurationBindingModel model)
{
using var context = new ServiceStationDatabase();
var newWorkDuration = WorkDuration.Create( model);
if(newWorkDuration == null)
{
return null;
}
context.WorkDurations.Add(newWorkDuration);
context.SaveChanges();
return newWorkDuration.GetViewModel;
}
public WorkDurationViewModel? Update(WorkDurationBindingModel model)
{
using var context = new ServiceStationDatabase();
var workDuration = context.WorkDurations.FirstOrDefault(x=>x.Id == model.Id);
if(workDuration == null)
{
return null;
}
workDuration.Update(model);
context.SaveChanges();
return workDuration.GetViewModel;
}
public WorkDurationViewModel? Delete(WorkDurationBindingModel model)
{
using var context = new ServiceStationDatabase();
var workDuration = context.WorkDurations.FirstOrDefault(x=>x.Id==model.Id);
if(workDuration != null)
{
context.WorkDurations.Remove(workDuration);
context.SaveChanges();
return workDuration.GetViewModel;
}
return null;
}
}
}

View File

@ -0,0 +1,78 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.StoragesContracts;
using ServiceStationContracts.ViewModels;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement.Implements
{
public class WorkStorage : IWorkStorage
{
public List<WorkViewModel> GetFullList()
{
using var context = new ServiceStationDatabase();
return context.Works.Select(x => x.GetViewModel).ToList();
}
public List<WorkViewModel> GetFilteredList(WorkSearchModel model)
{
if(string.IsNullOrEmpty(model.Title))
{
return new();
}
using var context = new ServiceStationDatabase();
return context.Works.Select(x => x.GetViewModel).ToList();
}
public WorkViewModel? GetElement(WorkSearchModel model)
{
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Title))
{
return null;
}
using var context = new ServiceStationDatabase();
return context.Works.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) ||
(!string.IsNullOrEmpty(model.Title) && x.Title == model.Title))?.GetViewModel;
}
public WorkViewModel? Insert(WorkBindingModel model)
{
using var context = new ServiceStationDatabase();
var newWork = Work.Create(context, model);
if(newWork == null)
{
return null;
}
context.Works.Add(newWork);
context.SaveChanges();
return newWork.GetViewModel;
}
public WorkViewModel? Update(WorkBindingModel model)
{
using var context = new ServiceStationDatabase();
var work = context.Works.FirstOrDefault(x=>x.Id == model.Id);
if(work == null)
{
return null;
}
work.Update(model);
work.UpdateSpares(context, model);
context.SaveChanges();
return work.GetViewModel;
}
public WorkViewModel? Delete(WorkBindingModel model)
{
using var context = new ServiceStationDatabase();
var work = context.Works.FirstOrDefault(x=>x.Id==model.Id);
if(work != null)
{
context.Works.Remove(work);
context.SaveChanges();
return work.GetViewModel;
}
return null;
}
}
}

View File

@ -0,0 +1,92 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ServiceStationDatabaseImplement.Models
{
public class Car : ICarModel
{
public int Id { get; set; }
[Required]
public string Brand { get; set; } =string.Empty;
[Required]
public string Model { get; set; } = string.Empty;
[Required]
public string VIN { get; set; } = string.Empty;
[ForeignKey("CarId")]
public virtual List<Service> Services { get; set; } = new();
private Dictionary<int, (ISpareModel, int)>? _carSpares = null;
[NotMapped]
public Dictionary<int, (ISpareModel, int)> CarSpares
{
get
{
if (_carSpares == null)
{
_carSpares = Spares.ToDictionary(recCS => recCS.SpareId, recCS => (recCS.Spare as ISpareModel, recCS.Count));
}
return _carSpares;
}
}
[ForeignKey("CarId")]
public virtual List<CarSpare> Spares { get; set; } = new();
public static Car Create(ServiceStationDatabase context, CarBindingModel model)
{
return new Car()
{
Id = model.Id,
Brand = model.Brand,
Model = model.Model,
VIN = model.VIN,
Spares = model.CarSpares.Select(x => new CarSpare
{
Car = context.Cars.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList()
};
}
public void Update(CarBindingModel model)
{
}
public CarViewModel GetViewModel => new()
{
Id = Id,
Brand = Brand,
Model = Model,
VIN = VIN,
CarSpares = CarSpares
};
public void UpdateComponents(ServiceStationDatabase context, CarBindingModel model)
{
var CarSpares = context.CarSpares.Where(recCS => recCS.CarId == model.Id).ToList();
if (CarSpares != null && CarSpares.Count > 0)
{
context.CarSpares.RemoveRange(CarSpares.Where(rec => !model.CarSpares.ContainsKey(rec.CarId)));
context.SaveChanges();
CarSpares = context.CarSpares.Where(rec => rec.CarId == model.Id).ToList();
foreach (var updateComponent in CarSpares)
{
updateComponent.Count = model.CarSpares[updateComponent.CarId].Item2;
model.CarSpares.Remove(updateComponent.CarId);
}
context.SaveChanges();
}
var Car = context.Cars.First(x => x.Id == Id);
foreach (var pc in model.CarSpares)
{
context.CarSpares.Add(new CarSpare
{
Car = Car,
Spare = context.Spares.First(x => x.Id == pc.Key),
Count = pc.Value.Item2
});
context.SaveChanges();
}
_carSpares = null;
}
}
}

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
namespace ServiceStationDatabaseImplement.Models
{
public class CarSpare
{
public int Id { get; set; }
[Required]
public int SpareId { get; set; }
[Required]
public int CarId { get; set; }
[Required]
public int Count { get; set; }
public virtual Car Car { get; set; } = new();
public virtual Spare Spare { get; set; } = new();
}
}

View File

@ -0,0 +1,48 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ServiceStationDatabaseImplement.Models
{
public class Employer : IEmployerModel
{
public int Id { get; set; }
[Required]
public string Login { get; set; } = String.Empty;
[Required]
public string Password { get; set; } = String.Empty;
[Required]
public string Email { get; set; } = String.Empty;
[ForeignKey("EmployerId")]
public virtual List<Maintenance> Maintenances { get; set; } = new();
public static Employer Create(EmployerBindingModel model)
{
return new Employer()
{
Id = model.Id,
Login = model.Login,
Password = model.Password,
Email = model.Email,
};
}
public void Update(EmployerBindingModel model)
{
Login = model.Login;
Password = model.Password;
Email = model.Email;
}
public EmployerViewModel GetViewModel => new()
{
Id = Id,
Login = Login,
Email = Email,
Password = Password
};
}
}

View File

@ -0,0 +1,92 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ServiceStationDatabaseImplement.Models
{
public class Maintenance : IMaintenanceModel
{
public int Id { get; set; }
[Required]
public int EmployerId { get; set; }
[Required]
public double Cost { get; set; }
[Required]
public DateTime DateCreate { get; set; }
private Dictionary<int, (ICarModel, int)> _maintenanceCars = null;
[NotMapped]
public Dictionary<int, (ICarModel, int)> MaintenanceCars
{
get
{
if (_maintenanceCars == null)
{
_maintenanceCars = Cars
.ToDictionary(recCM => recCM.CarId, recCM => (recCM.Car as ICarModel,recCM.Count));
}
return _maintenanceCars;
}
}
[ForeignKey("MaintenanceId")]
public virtual List<MaintenanceCar> Cars { get; set; } = new();
public static Maintenance Create(ServiceStationDatabase context, MaintenanceBindingModel model)
{
return new Maintenance()
{
Id = model.Id,
EmployerId = model.EmployerId,
Cars = model.MaintenanceCars.Select(x => new MaintenanceCar
{
Car = context.Cars.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList()
};
}
public void Update(MaintenanceBindingModel model)
{
Cost = model.Cost;
}
public MaintenanceViewModel GetViewModel => new()
{
Id = Id,
EmployerId = EmployerId,
Cost = Cost,
DateCreate = DateCreate,
MaintenanceCars = MaintenanceCars
};
public void UpdateComponents(ServiceStationDatabase context, MaintenanceBindingModel model)
{
var MaintenanceCars = context.MaintenanceCars.Where(rec => rec.MaintenanceId == model.Id).ToList();
if (MaintenanceCars != null && MaintenanceCars.Count > 0)
{
context.MaintenanceCars.RemoveRange(MaintenanceCars.Where(rec => !model.MaintenanceCars.ContainsKey(rec.CarId)));
context.SaveChanges();
MaintenanceCars = context.MaintenanceCars.Where(rec => rec.MaintenanceId == model.Id).ToList();
foreach (var updateComponent in MaintenanceCars)
{
updateComponent.Count = model.MaintenanceCars[updateComponent.CarId].Item2;
model.MaintenanceCars.Remove(updateComponent.CarId);
}
context.SaveChanges();
}
var Maintenance = context.Maintenances.First(x => x.Id == Id);
foreach (var pc in model.MaintenanceCars)
{
context.MaintenanceCars.Add(new MaintenanceCar
{
Maintenance = Maintenance,
Car = context.Cars.First(x => x.Id == pc.Key),
Count = pc.Value.Item2
});
context.SaveChanges();
}
_maintenanceCars = null;
}
}
}

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
namespace ServiceStationDatabaseImplement.Models
{
public class MaintenanceCar
{
public int Id { get; set; }
[Required]
public int MaintenanceId { get; set; }
[Required]
public int CarId { get; set; }
[Required]
public int Count { get; set; }
public virtual Car Car { get; set; } = new();
public virtual Maintenance Maintenance { get; set; } = new();
}
}

View File

@ -0,0 +1,32 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
namespace ServiceStationDatabaseImplement.Models
{
public class Service : IServiceModel
{
public int Id { get; set; }
[Required]
public string ServiceDescription { get; set; } = string.Empty;
public static Service Create(ServiceBindingModel model)
{
return new Service()
{
Id = model.Id,
ServiceDescription = model.ServiceDescription,
};
}
public void Update(ServiceBindingModel model)
{
ServiceDescription = model.ServiceDescription;
}
public ServiceViewModel GetViewModel => new()
{
Id = Id,
ServiceDescription = ServiceDescription,
};
}
}

View File

@ -0,0 +1,43 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
namespace ServiceStationDatabaseImplement.Models
{
public class Spare : ISpareModel
{
public int Id { get; set; }
[Required]
public string Name { get; set; } = String.Empty;
[Required]
public double Price { get; set; }
public static Spare Create(SpareBindingModel model)
{
return new Spare
{
Id = model.Id,
Name = model.Name,
Price = model.Price,
};
}
public void Update(SpareBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
}
public SpareViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Price = Price,
};
}
}

View File

@ -0,0 +1,48 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ServiceStationDatabaseImplement.Models
{
public class Storekeeper : IStorekeeperModel
{
public int Id { get; set; }
[Required]
public string Login { get; set; } = String.Empty;
[Required]
public string Password { get; set; } = String.Empty;
[Required]
public string Email { get; set; } = String.Empty;
[ForeignKey("StorekeeperId")]
public virtual List<Work> Works { get; set; } = new();
public static Storekeeper Create(StorekeeperBindingModel model)
{
return new Storekeeper()
{
Id = model.Id,
Login = model.Login,
Password = model.Password,
Email = model.Email,
};
}
public void Update(StorekeeperBindingModel model)
{
Login = model.Login;
Password = model.Password;
Email = model.Email;
}
public StorekeeperViewModel GetViewModel => new()
{
Id = Id,
Login = Login,
Email = Email,
Password = Password
};
}
}

View File

@ -0,0 +1,146 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ServiceStationDatabaseImplement.Models
{
public class Work : IWorkModel
{
public int Id { get; set; }
[Required]
public string Title { get; set; } = String.Empty;
[Required]
public double Price { get; set; }
[Required]
public int StorekeeperId { get; set; }
[Required]
public int DurationId { get; set; }
private Dictionary<int, (ISpareModel, int)>? _workSpares { get; set; } = null;
[NotMapped]
public Dictionary<int, (ISpareModel, int)> WorkSpares {
get
{
if (_workSpares == null)
{
_workSpares = Spares.ToDictionary(recWS => recWS.SpareId, recWS =>
(recWS.Spare as ISpareModel, recWS.Count));
}
return _workSpares;
}
}
[ForeignKey("WorkId")]
public virtual List<WorkSpare> Spares { get; set; } = new();
private Dictionary<int, (IMaintenanceModel, int)>? _workMaintenances = null;
[NotMapped]
public Dictionary<int, (IMaintenanceModel, int)> WorkMaintences
{
get
{
if (_workMaintenances == null)
{
_workMaintenances = Maintences.ToDictionary(recWM => recWM.MaintenceId, recWM =>
(recWM.Maintenance as IMaintenanceModel, recWM.Count));
}
return _workMaintenances;
}
}
[ForeignKey("WorkId")]
public virtual List<WorkMaintence> Maintences { get; set; } = new();
public static Work Create(ServiceStationDatabase context, WorkBindingModel model)
{
return new Work()
{
Id = model.Id,
Title = model.Title,
Price = model.Price,
Spares = model.WorkSpares.Select(x => new WorkSpare {
Spare = context.Spares.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList(),
Maintences = model.WorkMaintences.Select(x => new WorkMaintence
{
Maintenance = context.Maintenances.First(y => y.Id == x.Key),
Count = x.Value.Item2
}).ToList()
};
}
public void Update(WorkBindingModel model)
{
Title = model.Title;
Price = model.Price;
}
public WorkViewModel GetViewModel => new()
{
Id = Id,
Title = Title,
Price = Price,
};
public void UpdateSpares(ServiceStationDatabase context, WorkBindingModel model)
{
var WorkSpares = context.WorkSpares.Where(rec => rec.WorkId == model.Id).ToList();
if (WorkSpares != null && WorkSpares.Count > 0)
{
context.WorkSpares.RemoveRange(WorkSpares.Where(rec => !model.WorkSpares.ContainsKey(rec.SpareId)));
context.SaveChanges();
foreach (var updateComponent in WorkSpares)
{
updateComponent.Count = model.WorkSpares[updateComponent.SpareId].Item2;
model.WorkSpares.Remove(updateComponent.SpareId);
}
context.SaveChanges();
}
var Work = context.Works.First(x => x.Id == Id);
foreach (var pc in model.WorkSpares)
{
context.WorkSpares.Add(new WorkSpare
{
Work = Work,
Spare = context.Spares.First(x => x.Id == pc.Key),
Count = pc.Value.Item2
});
context.SaveChanges();
}
_workSpares = null;
}
public void UpdateMaintences(ServiceStationDatabase context, WorkBindingModel model)
{
var WorkMaintence = context.WorkMaintences.Where(rec => rec.WorkId == model.Id).ToList();
if (WorkMaintence != null && WorkMaintence.Count > 0)
{
context.WorkMaintences.RemoveRange(WorkMaintence.Where(rec => !model.WorkMaintences.ContainsKey(rec.MaintenceId)));
context.SaveChanges();
foreach (var updateComponent in WorkMaintence)
{
updateComponent.Count = model.WorkMaintences[updateComponent.MaintenceId].Item2;
model.WorkMaintences.Remove(updateComponent.MaintenceId);
}
context.SaveChanges();
}
var Work = context.Works.First(x => x.Id == Id);
foreach (var pc in model.WorkMaintences)
{
context.WorkMaintences.Add(new WorkMaintence
{
Work = Work,
Maintenance = context.Maintenances.First(x => x.Id == pc.Key),
Count = pc.Value.Item2
});
context.SaveChanges();
}
_workMaintenances = null;
}
}
}

View File

@ -0,0 +1,37 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ServiceStationDatabaseImplement.Models
{
public class WorkDuration : IWorkDurationModel
{
public int Id { get; set; }
[Required]
public int Duration { get; set; }
[ForeignKey("DurationId")]
public virtual List<Work> Works { get; set; }
public static WorkDuration Create(WorkDurationBindingModel model)
{
return new WorkDuration()
{
Id = model.Id,
Duration = model.Duration,
};
}
public void Update(WorkDurationBindingModel model)
{
Duration = model.Duration;
}
public WorkDurationViewModel GetViewModel => new()
{
Id = Id,
Duration = Duration,
};
}
}

View File

@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
namespace ServiceStationDatabaseImplement.Models
{
public class WorkMaintence
{
public int Id { get; set; }
[Required]
public int WorkId { get; set; }
[Required]
public int MaintenceId { get; set; }
[Required]
public int Count { get; set; }
public virtual Work Work { get; set; } = new();
public virtual Maintenance Maintenance { get; set; } = new();
}
}

View File

@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
namespace ServiceStationDatabaseImplement.Models
{
public class WorkSpare
{
public int Id { get; set; }
[Required]
public int WorkId { get; set; }
[Required]
public int SpareId { get; set; }
[Required]
public int Count { get; set; }
public virtual Work Work { get; set; } = new();
public virtual Spare Spare { get; set; } = new();
}
}

View File

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement
{
public class ServiceStationDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-QVK6NSA\SQLEXPRESS03;Initial Catalog=ServiceStation;Integrated Security=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Car> Cars { set; get; }
public virtual DbSet<CarSpare> CarSpares { set; get; }
public virtual DbSet<Employer> Employers { set; get; }
public virtual DbSet<Maintenance> Maintenances { set; get; }
public virtual DbSet<MaintenanceCar> MaintenanceCars { set; get; }
public virtual DbSet<Service> Services { set; get; }
public virtual DbSet<Spare> Spares { set; get; }
public virtual DbSet<Storekeeper> Storekeepers { set; get; }
public virtual DbSet<Work> Works { set; get; }
public virtual DbSet<WorkDuration> WorkDurations { set; get; }
public virtual DbSet<WorkMaintence> WorkMaintences { set; get; }
public virtual DbSet<WorkSpare> WorkSpares { set; get; }
}
}

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceStationContracts\ServiceStationContracts.csproj" />
<ProjectReference Include="..\ServiceStationDataModels\ServiceStationDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,46 @@
namespace ServiceStation
{
partial class Form1
{
/// <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()
{
SuspendLayout();
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Name = "Form1";
Text = "Form1";
Load += Form1_Load;
ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,15 @@
namespace ServiceStation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,40 @@
using ServiceStation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
namespace ServiceStationView
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font;
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<Form1>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<Form1>();
}
}
}

View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceStationBusinessLogic\ServiceStationBusinessLogic.csproj" />
<ProjectReference Include="..\ServiceStationContracts\ServiceStationContracts.csproj" />
<ProjectReference Include="..\ServiceStationDatabaseImplement\ServiceStationDatabaseImplement.csproj" />
</ItemGroup>
</Project>