diff --git a/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/CatergoryWorkLogic.cs b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/CatergoryWorkLogic.cs new file mode 100644 index 0000000..6d1a7c2 --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/CatergoryWorkLogic.cs @@ -0,0 +1,89 @@ +using Microsoft.Extensions.Logging; +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.BusinessLogicContracts; +using ServiceStationContracts.SearchModels; +using ServiceStationContracts.ViewModels; +using ServiceStationsContracts.StorageContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceSourceBusinessLogic.BusinessLogic { + public class CatergoryWorkLogic : ICategoryWorkLogic { + + private readonly ILogger _logger; + private readonly ICategoryWorkStorage _storage; + + public CatergoryWorkLogic(ILogger logger, ICategoryWorkStorage storage) { + _logger = logger; + _storage = storage; + } + + public bool Create(CategoryWorkBindingModel model) { + CheckModel(model); + if (_storage.Insert(model) == null) { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Delete(CategoryWorkBindingModel model) { + CheckModel(model, false); + _logger.LogInformation($"Delete. Id:{model.Id}"); + if (_storage.Delete(model) == null) { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + public bool Update(CategoryWorkBindingModel model) { + CheckModel(model); + if (_storage.Update(model) == null) { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public List? ReadList(CategoryWorkSearchModel? model) { + _logger.LogInformation($"ReadList. Id:{model?.Id}"); + var list = model == null ? _storage.GetFullList() : _storage.GetFilteredList(model); + if (list == null) { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation($"ReadList. Count:{list.Count}"); + return list; + } + + private void CheckModel(CategoryWorkBindingModel model, bool withParams = true) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) { + return; + } + if (string.IsNullOrEmpty((model.Id).ToString())) { + throw new ArgumentNullException("Нет Id категории", nameof(model.Id)); + } + if (string.IsNullOrEmpty((model.ExecutorId).ToString())) { + throw new ArgumentNullException("Нет Id исполнителя", nameof(model.ExecutorId)); + } + if (string.IsNullOrEmpty(model.Name)) { + throw new ArgumentNullException("Нет названия категории работы", nameof(model.Name)); + } + _logger.LogInformation($"CategoryWork. Id:{model.Id}.Name:{model.Name}"); + + var element = _storage.GetElement(new CategoryWorkSearchModel { + Name = model.Name + }); + if (element != null && element.Id != model.Id) { + throw new InvalidOperationException("Категория с таким названием уже есть"); + } + } + } +} diff --git a/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ClientLogic.cs b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ClientLogic.cs new file mode 100644 index 0000000..c47eb05 --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ClientLogic.cs @@ -0,0 +1,115 @@ +using Microsoft.Extensions.Logging; +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.BusinessLogicContracts; +using ServiceStationContracts.SearchModels; +using ServiceStationContracts.ViewModels; +using ServiceStationsContracts.StorageContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceSourceBusinessLogic.BusinessLogic { + public class ClientLogic : IClientLogic { + + private readonly ILogger _logger; + private readonly IClientStorage _storage; + + public ClientLogic(ILogger logger, IClientStorage storage) { + _logger = logger; + _storage = storage; + } + + public bool Create(ClientBindingModel model) { + CheckModel(model); + if (_storage.Insert(model) == null) { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Delete(ClientBindingModel model) { + CheckModel(model, false); + _logger.LogInformation($"Delete.Id:{model.Id}"); + if (_storage.Delete(model) == null) { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + public bool Update(ClientBindingModel model) { + CheckModel(model); + if (_storage.Update(model) == null) { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public ClientViewModel? ReadElement(ClientSearchModel model) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation($"ReadElement.Id:{model.Id}.LastName:{model.LastName}"); + var element = _storage.GetElement(model); + if (element == null) { + _logger.LogWarning("ReadElement. element not fount"); + return null; + } + _logger.LogInformation($"ReadElement.find.Id:{element.Id}"); + return element; + } + + public List? ReadList(ClientSearchModel? model = null) { + _logger.LogInformation($"ReadList.ClientId:{model?.Id}"); + var list = model == null ? _storage.GetFullList() : _storage.GetFilteredList(model); + if (list == null) { + _logger.LogWarning("ReadList. return null list"); + return null; + } + _logger.LogInformation($"ReadList.Count:{list.Count}"); + return list; + } + + + + private void CheckModel(ClientBindingModel model, bool withParams = true) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) { + return; + } + if (string.IsNullOrEmpty((model.Id).ToString())) { + throw new ArgumentNullException("Нет Id клиента", nameof(model.Id)); + } + if (string.IsNullOrEmpty(model.FirstName)) { + throw new ArgumentNullException("Нет имени пользователя",nameof(model.FirstName)); + } + if (string.IsNullOrEmpty(model.LastName)) { + throw new ArgumentNullException("Нет фамилии пользователя", nameof(model.LastName)); + } + if (string.IsNullOrEmpty(model.Email)) { + throw new ArgumentNullException("Нет почты клиента", nameof(model.Email)); + } + if (string.IsNullOrEmpty(model.Password)) { + throw new ArgumentNullException("Нет пароля пользователя", nameof(model.Password)); + } + if (string.IsNullOrEmpty(model.PhoneNumber)) { + throw new ArgumentNullException("Нет номера телефона пользователя", nameof(model.PhoneNumber)); + } + _logger.LogInformation($"Client. Id:{model.Id}.FirstName:{model.FirstName}.LastName:{model.LastName}." + + $"Email:{model.Email}.Password:{model.Password}.PhoneNumber:{model.PhoneNumber}.Login:{model.Login}" + + $"Point:{model.Point}"); + var element = _storage.GetElement(new ClientSearchModel { Email = model.Email }); + if (element != null && element.Id != model.Id) { + throw new InvalidOperationException("Такая почта уже имеется"); + } + } + } +} diff --git a/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ClientWorkLogic.cs b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ClientWorkLogic.cs new file mode 100644 index 0000000..270f989 --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ClientWorkLogic.cs @@ -0,0 +1,79 @@ +using Microsoft.Extensions.Logging; +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.BusinessLogicContracts; +using ServiceStationContracts.SearchModels; +using ServiceStationContracts.ViewModels; +using ServiceStationDataModels; +using ServiceStationsContracts.StorageContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceSourceBusinessLogic.BusinessLogic { + public class ClientWorkLogic : IClintWorkLogic { + + private readonly ILogger _logger; + private readonly IClientWorkStorage _storage; + + public ClientWorkLogic(ILogger logger, IClientWorkStorage storage) { + _logger = logger; + _storage = storage; + } + + public bool Create(ClientWorkBindingModel model) { + CheckModel(model); + if (_storage.Insert(model) == null) { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Delete(ClientWorkBindingModel model) { + CheckModel(model, false); + _logger.LogInformation($"Delete. ClientID:{model.ClientId}"); + if (_storage.Delete(model) == null) { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + public bool Update(ClientWorkBindingModel model) { + CheckModel(model); + if (_storage.Update(model) == null) { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public List? ReadList(ClientWorkSearchModel? model) { + _logger.LogInformation($"ReadList. ClientId:{model?.ClientId}.WorkId:{model?.WorkId}"); + var list = model == null ? _storage.GetFullList() : _storage.GetFilteredList(model); + if (list == null) { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation($"ReadList. Count:{list.Count}"); + return list; + } + + private void CheckModel(ClientWorkBindingModel model, bool withParams = true) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) { + return; + } + if (string.IsNullOrEmpty((model.ClientId).ToString())) { + throw new ArgumentNullException("Нет Id клиента", nameof(model.ClientId)); + } + if (string.IsNullOrEmpty((model.WorkId).ToString())) { + throw new ArgumentNullException("Нет Id работы", nameof(model.WorkId)); + } + _logger.LogInformation($"ClientWork. ClientId:{model.ClientId}.WorkId:{model.WorkId}"); + } + } +} diff --git a/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ExecutorLogic.cs b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ExecutorLogic.cs new file mode 100644 index 0000000..c1a3cbf --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ExecutorLogic.cs @@ -0,0 +1,110 @@ +using Microsoft.Extensions.Logging; +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.BusinessLogicContracts; +using ServiceStationContracts.SearchModels; +using ServiceStationContracts.ViewModels; +using ServiceStationsContracts.StorageContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceSourceBusinessLogic.BusinessLogic { + public class ExecutorLogic : IExecutorLogic { + + private readonly ILogger _logger; + private readonly IExecutorStorage _storage; + + public ExecutorLogic(ILogger logger, IExecutorStorage storage) { + _logger = logger; + _storage = storage; + } + + public bool Create(ExecutorBindingModel model) { + CheckModel(model); + if (_storage.Insert(model) == null) { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Delete(ExecutorBindingModel model) { + CheckModel(model, false); + _logger.LogInformation($"Delete.Id:{model.Id}"); + if (_storage.Delete(model) == null) { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + public bool Update(ExecutorBindingModel model) { + CheckModel(model); + if (_storage.Update(model) == null) { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public ExecutorViewModel? ReadElement(ExecutorSearchModel model) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation($"ReadElement.Id:{model.Id}.LastName:{model.LastName}"); + var element = _storage.GetElement(model); + if (element == null) { + _logger.LogWarning("ReadElement. element not fount"); + return null; + } + _logger.LogInformation($"ReadElement.find.Id:{element.Id}"); + return element; + } + + public List? ReadList(ExecutorSearchModel? model = null) { + _logger.LogInformation($"ReadList.ClientId:{model?.Id}"); + var list = model == null ? _storage.GetFullList() : _storage.GetFilteredList(model); + if (list == null) { + _logger.LogWarning("ReadList. return null list"); + return null; + } + _logger.LogInformation($"ReadList.Count:{list.Count}"); + return list; + } + + private void CheckModel(ExecutorBindingModel model, bool withParams = true) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) { + return; + } + if (string.IsNullOrEmpty((model.Id).ToString())) { + throw new ArgumentNullException("Нет Id исполнителя", nameof(model.Id)); + } + if (string.IsNullOrEmpty(model.FirstName)) { + throw new ArgumentNullException("Нет имени пользователя", nameof(model.FirstName)); + } + if (string.IsNullOrEmpty(model.LastName)) { + throw new ArgumentNullException("Нет фамилии пользователя", nameof(model.LastName)); + } + if (string.IsNullOrEmpty(model.Email)) { + throw new ArgumentNullException("Нет почты клиента", nameof(model.Email)); + } + if (string.IsNullOrEmpty(model.Password)) { + throw new ArgumentNullException("Нет пароля пользователя", nameof(model.Password)); + } + if (string.IsNullOrEmpty(model.PhoneNumber)) { + throw new ArgumentNullException("Нет номера телефона пользователя", nameof(model.PhoneNumber)); + } + _logger.LogInformation($"Client. Id:{model.Id}.FirstName:{model.FirstName}.LastName:{model.LastName}." + + $"Email:{model.Email}.Password:{model.Password}.PhoneNumber:{model.PhoneNumber}.Login:{model.Login}"); + var element = _storage.GetElement(new ExecutorSearchModel { Email = model.Email }); + if (element != null && element.Id != model.Id) { + throw new InvalidOperationException("Такая почта уже имеется"); + } + } + } +} diff --git a/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ReportLogic.cs b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ReportLogic.cs new file mode 100644 index 0000000..6cd25b6 --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ReportLogic.cs @@ -0,0 +1,79 @@ +using Microsoft.Extensions.Logging; +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.BusinessLogicContracts; +using ServiceStationContracts.SearchModels; +using ServiceStationContracts.ViewModels; +using ServiceStationsContracts.StorageContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceSourceBusinessLogic.BusinessLogic { + public class ReportLogic : IReportLogic { + + private readonly ILogger _logger; + private readonly IReportStorage _storage; + + public ReportLogic(ILogger logger, IReportStorage storage) { + _logger = logger; + _storage = storage; + } + + public bool Create(ReportBindingModel model) { + CheckModel(model); + if (_storage.Insert(model) == null) { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Delete(ReportBindingModel model) { + CheckModel(model, false); + _logger.LogInformation($"Delete. Id:{model.Id}"); + if (_storage.Delete(model) == null) { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + public bool Update(ReportBindingModel model) { + CheckModel(model); + if (_storage.Update(model) == null) { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public List? ReadList(ReportSearchModel model) { + _logger.LogInformation($"ReadList. Id:{model?.Id}"); + var list = model == null ? _storage.GetFullList() : _storage.GetFilteredList(model); + if (list == null) { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation($"ReadList. Count:{list.Count}"); + return list; + } + + private void CheckModel(ReportBindingModel model, bool withParams = true) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) { + return; + } + if (string.IsNullOrEmpty((model.Id).ToString())) { + throw new ArgumentNullException("Нет Id отчета", nameof(model.Id)); + } + if (model.Count == 0) { + throw new ArgumentNullException("Нет отчетов", nameof(model.Id)); + } + _logger.LogInformation($"Report. Id:{model.Id}.Count:{model.Count}"); + } + } +} diff --git a/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ReportWork.cs b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ReportWork.cs new file mode 100644 index 0000000..5fb3f81 --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/ReportWork.cs @@ -0,0 +1,32 @@ +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.BusinessLogicContracts; +using ServiceStationContracts.SearchModels; +using ServiceStationContracts.ViewModels; +using ServiceStationsContracts.StorageContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceSourceBusinessLogic.BusinessLogic { + public class ReportWork : IReportWorkLogic { + + private readonly IWorkStorage _storage; + + public ReportWork(IWorkStorage storage) { + _storage = storage; + } + + public List GetWorks(ReportWorkBindingModel model) { + return _storage.GetFilteredList(new WorkSearchModel { + Date = model.Date + }).Select(x => new ReportWorkViewModel { + Id = x.Id, + Date = x.Date, + price = x.Price, + WorkStatus = x.Status.ToString(), + }).ToList(); + } + } +} diff --git a/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/WorkLogic.cs b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/WorkLogic.cs new file mode 100644 index 0000000..dbf7d56 --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/BusinessLogic/WorkLogic.cs @@ -0,0 +1,94 @@ +using Microsoft.Extensions.Logging; +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.BusinessLogicContracts; +using ServiceStationContracts.SearchModels; +using ServiceStationContracts.ViewModels; +using ServiceStationDataModels; +using ServiceStationsContracts.StorageContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceSourceBusinessLogic.BusinessLogic { + public class WorkLogic : IWorkLogic { + + private readonly ILogger _logger; + private readonly IWorkStorage _storage; + + private WorkLogic(ILogger logger, IWorkStorage storage) { + _logger = logger; + _storage = storage; + } + + public bool Create(WorkBindingModel model) { + CheckModel(model); + model.Status = WorkStatus.Принят; + if (_storage.Insert(model) == null) { + _logger.LogInformation("Insert operation failed"); + return false; + } + return true; + } + + public bool FinishWork(WorkBindingModel model) { + return StatusUpdate(model, WorkStatus.Готов); + } + + public bool IssuedWork(WorkBindingModel model) { + return StatusUpdate(model, WorkStatus.Выдан); + } + + public bool TakeWorkInWork(WorkBindingModel model) { + return StatusUpdate(model, WorkStatus.Выполняется); + } + + public List? ReadList(WorkSearchModel? model = null) { + throw new NotImplementedException(); + } + + private void CheckModel(WorkBindingModel model, bool withParams = true) { + if (model == null) { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) { + return; + } + if (string.IsNullOrEmpty((model.Id).ToString())) { + throw new ArgumentNullException("Нет Id работы", nameof(model.Id)); + } + if (string.IsNullOrEmpty((model.ExecutorId).ToString())) { + throw new ArgumentNullException("Нет Id исполнителя", nameof(model.ExecutorId)); + } + if (string.IsNullOrEmpty((model.ReportId).ToString())) { + throw new ArgumentNullException("Нет Id работы", nameof(model.ReportId)); + } + if (string.IsNullOrEmpty((model.CategoryWorkId).ToString())) { + throw new ArgumentNullException("Нет Id категории работы", nameof(model.CategoryWorkId)); + } + if (model.Price <= 0) { + throw new ArgumentNullException("Цена за работу должна быть больше 0", nameof(model.Price)); + } + _logger.LogInformation($"Work. Id:{model.Id}.Price.{model.Price}.Status:{model.Status}.ExecutorId:{model.ExecutorId}" + + $"ReportId:{model.ReportId}.CategoryWordId:{model.CategoryWorkId}"); + } + private bool StatusUpdate(WorkBindingModel model, WorkStatus newOrderStatus) { + CheckModel(model, false); + var viewModel = _storage.GetElement(new WorkSearchModel { Id = model.Id }); + if (viewModel == null) { + throw new ArgumentNullException(nameof(model)); + } + if (viewModel.Status + 1 != newOrderStatus) { + _logger.LogWarning("Status update to " + newOrderStatus.ToString() + " operation failed."); + return false; + } + model.Status = newOrderStatus; + if (_storage.Update(model) == null) { + _logger.LogWarning("Update operarion failed"); + return false; + } + return true; + } + } +} diff --git a/ServiceStation/ServiceSourceBusinessLogic/ServiceSourceBusinessLogic.csproj b/ServiceStation/ServiceSourceBusinessLogic/ServiceSourceBusinessLogic.csproj new file mode 100644 index 0000000..d021d84 --- /dev/null +++ b/ServiceStation/ServiceSourceBusinessLogic/ServiceSourceBusinessLogic.csproj @@ -0,0 +1,17 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + diff --git a/ServiceStation/ServiceSourceClientApp/ServiceSourceExecutorApp.csproj b/ServiceStation/ServiceSourceClientApp/ServiceSourceExecutorApp.csproj index 1b28a01..4c2bb77 100644 --- a/ServiceStation/ServiceSourceClientApp/ServiceSourceExecutorApp.csproj +++ b/ServiceStation/ServiceSourceClientApp/ServiceSourceExecutorApp.csproj @@ -1,7 +1,7 @@ - net8.0 + net7.0 enable enable diff --git a/ServiceStation/ServiceSourceRestAPI/ServiceSourceRestAPI.csproj b/ServiceStation/ServiceSourceRestAPI/ServiceSourceRestAPI.csproj index dbedb64..92cd166 100644 --- a/ServiceStation/ServiceSourceRestAPI/ServiceSourceRestAPI.csproj +++ b/ServiceStation/ServiceSourceRestAPI/ServiceSourceRestAPI.csproj @@ -1,7 +1,7 @@  - net8.0 + net7.0 enable enable diff --git a/ServiceStation/ServiceStation.sln b/ServiceStation/ServiceStation.sln index 5347392..0d2b7fd 100644 --- a/ServiceStation/ServiceStation.sln +++ b/ServiceStation/ServiceStation.sln @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceSourceRestAPI", "Ser EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceSourceExecutorApp", "ServiceSourceClientApp\ServiceSourceExecutorApp.csproj", "{809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceSourceBusinessLogic", "ServiceSourceBusinessLogic\ServiceSourceBusinessLogic.csproj", "{A114772E-80AB-43A2-9D00-AB19F309F6ED}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}.Release|Any CPU.Build.0 = Release|Any CPU + {A114772E-80AB-43A2-9D00-AB19F309F6ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A114772E-80AB-43A2-9D00-AB19F309F6ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A114772E-80AB-43A2-9D00-AB19F309F6ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A114772E-80AB-43A2-9D00-AB19F309F6ED}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ServiceStation/ServiceStationContracts/BindingModels/ClientBindingModel.cs b/ServiceStation/ServiceStationContracts/BindingModels/ClientBindingModel.cs index 04aefbe..129d00e 100644 --- a/ServiceStation/ServiceStationContracts/BindingModels/ClientBindingModel.cs +++ b/ServiceStation/ServiceStationContracts/BindingModels/ClientBindingModel.cs @@ -18,7 +18,7 @@ namespace ServiceStationContracts.BindingModels public string Login { get; set; } = string.Empty; - public int? Point { get; set; } + public int Point { get; set; } public int Id { get; set; } } diff --git a/ServiceStation/ServiceStationContracts/BindingModels/ReportWorkBindingModel.cs b/ServiceStation/ServiceStationContracts/BindingModels/ReportWorkBindingModel.cs new file mode 100644 index 0000000..028d202 --- /dev/null +++ b/ServiceStation/ServiceStationContracts/BindingModels/ReportWorkBindingModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceStationContracts.BindingModels { + public class ReportWorkBindingModel { + public string FileName { get; set; } = string.Empty; + public DateTime? Date { get; set; } + } +} diff --git a/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IReportLogic.cs b/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IReportLogic.cs index 81ce83c..1949baf 100644 --- a/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IReportLogic.cs +++ b/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IReportLogic.cs @@ -6,7 +6,7 @@ namespace ServiceStationContracts.BusinessLogicContracts { public interface IReportLogic { - ReportViewModel? ReadList(ReportSearchModel model); + List? ReadList(ReportSearchModel model); bool Create(ReportBindingModel model); bool Update(ReportBindingModel model); bool Delete(ReportBindingModel model); diff --git a/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IReportWorkLogic.cs b/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IReportWorkLogic.cs new file mode 100644 index 0000000..38e7f1e --- /dev/null +++ b/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IReportWorkLogic.cs @@ -0,0 +1,14 @@ +using ServiceStationContracts.BindingModels; +using ServiceStationContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceStationContracts.BusinessLogicContracts { + public interface IReportWorkLogic { + // Получение списка заказов за определенный период + List GetWorks(ReportWorkBindingModel model); + } +} diff --git a/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IWorkLogic.cs b/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IWorkLogic.cs index 07a4e66..cd3e944 100644 --- a/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IWorkLogic.cs +++ b/ServiceStation/ServiceStationContracts/BusinessLogicContracts/IWorkLogic.cs @@ -8,7 +8,9 @@ namespace ServiceStationContracts.BusinessLogicContracts { List? ReadList(WorkSearchModel? model = null); bool Create(WorkBindingModel model); - bool Update(WorkBindingModel model); - bool Delete(WorkBindingModel model); + + bool TakeWorkInWork(WorkBindingModel model); + bool FinishWork(WorkBindingModel model); + bool IssuedWork(WorkBindingModel model); } } diff --git a/ServiceStation/ServiceStationContracts/ViewModels/ClientViewModel.cs b/ServiceStation/ServiceStationContracts/ViewModels/ClientViewModel.cs index 4cfa417..28ad361 100644 --- a/ServiceStation/ServiceStationContracts/ViewModels/ClientViewModel.cs +++ b/ServiceStation/ServiceStationContracts/ViewModels/ClientViewModel.cs @@ -18,7 +18,7 @@ namespace ServiceStationContracts.ViewModels [DisplayName("Логин")] public string Login { get; set; } = string.Empty; [DisplayName("Бонусы")] - public int? Point { get; set; } + public int Point { get; set; } public int Id { get; set; } } diff --git a/ServiceStation/ServiceStationContracts/ViewModels/ReportWorkViewModel.cs b/ServiceStation/ServiceStationContracts/ViewModels/ReportWorkViewModel.cs new file mode 100644 index 0000000..66b6235 --- /dev/null +++ b/ServiceStation/ServiceStationContracts/ViewModels/ReportWorkViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceStationContracts.ViewModels { + public class ReportWorkViewModel { + public int Id { get; set; } + public DateTime Date { get; set; } + public double price { get; set; } + + public string WorkStatus { get; set; } = string.Empty; + } +} diff --git a/ServiceStation/ServiceStationDataModels/IClientModel.cs b/ServiceStation/ServiceStationDataModels/IClientModel.cs index 425c699..1302d82 100644 --- a/ServiceStation/ServiceStationDataModels/IClientModel.cs +++ b/ServiceStation/ServiceStationDataModels/IClientModel.cs @@ -10,6 +10,6 @@ namespace ServiceStationDataModels string Password { get; } string PhoneNumber { get; } string Login { get; } - int? Point { get; } + int Point { get; } } } diff --git a/ServiceStation/ServiceStationsDataBaseImplement/Models/Client.cs b/ServiceStation/ServiceStationsDataBaseImplement/Models/Client.cs index 6b842c5..ef26a02 100644 --- a/ServiceStation/ServiceStationsDataBaseImplement/Models/Client.cs +++ b/ServiceStation/ServiceStationsDataBaseImplement/Models/Client.cs @@ -25,7 +25,7 @@ namespace ServiceStationsDataBaseImplement.Models [Required] public string Login { get; set; } = string.Empty; [Required] - public int? Point { get; set; } + public int Point { get; set; } public int Id { get; set; } public static Client? Create(ClientBindingModel? model) { @@ -77,6 +77,7 @@ namespace ServiceStationsDataBaseImplement.Models } public ClientViewModel GetViewModel => new() { + FirstName = FirstName, LastName = LastName, Email = Email, @@ -86,5 +87,7 @@ namespace ServiceStationsDataBaseImplement.Models Point = Point, Id = Id }; + + } }