Merge pull request 'Тотальный слив сущностей' (#9) from sagirovs_part into main
Reviewed-on: #9
This commit is contained in:
commit
eb95536307
@ -41,7 +41,7 @@ namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id);
|
||||
_logger.LogInformation("ReadElement. BundlingId:Id:{ Id}", model.Id);
|
||||
var element = _bundlingStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id);
|
||||
_logger.LogInformation("ReadElement. FeatureId:Id:{ Id}", model.Id);
|
||||
var element = _fatureStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
|
110
CarCenter/CarCenterBusinessLogic/BusinessLogics/OrderLogic.cs
Normal file
110
CarCenter/CarCenterBusinessLogic/BusinessLogics/OrderLogic.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class OrderLogic : IOrderLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. OrderId:Id:{ Id}", model?.Id);
|
||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. OrderId:Id:{ Id}", model.Id);
|
||||
var element = _orderStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_orderStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_orderStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.BuyerFCS == string.Empty)
|
||||
{
|
||||
throw new ArgumentNullException("Нет покупателя", nameof(model.BuyerFCS));
|
||||
}
|
||||
if(model.Sum < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Сумма меньше нуля",nameof(model.Sum));
|
||||
}
|
||||
_logger.LogInformation("Order. Order:Id:{ Id}.Sum:{ Sum}", model.Id, model.Sum);
|
||||
}
|
||||
}
|
||||
}
|
110
CarCenter/CarCenterBusinessLogic/BusinessLogics/PresaleLogic.cs
Normal file
110
CarCenter/CarCenterBusinessLogic/BusinessLogics/PresaleLogic.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class PresaleLogic : IPresaleLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPresaleStorage _presaleStorage;
|
||||
public PresaleLogic(ILogger<PresaleLogic> logger, IPresaleStorage presaleStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_presaleStorage = presaleStorage;
|
||||
}
|
||||
|
||||
public List<PresaleViewModel>? ReadList(PresaleSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. PresaleId:Id:{ Id}", model?.Id);
|
||||
var list = model == null ? _presaleStorage.GetFullList() : _presaleStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public PresaleViewModel? ReadElement(PresaleSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. PresaleId:Id:{ Id}", model.Id);
|
||||
var element = _presaleStorage.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(PresaleBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_presaleStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(PresaleBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_presaleStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(PresaleBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_presaleStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(PresaleBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.Description == string.Empty)
|
||||
{
|
||||
throw new ArgumentNullException("Нет описания", nameof(model.Description));
|
||||
}
|
||||
if (model.DueTill < DateTime.Now)
|
||||
{
|
||||
throw new InvalidOperationException("Срок выполнения раньше текущего времени");
|
||||
}
|
||||
_logger.LogInformation("Presale. Presale:Id:{ Id}.Price:{ Price}", model.Id, model.Description);
|
||||
}
|
||||
}
|
||||
}
|
106
CarCenter/CarCenterBusinessLogic/BusinessLogics/RequestLogic.cs
Normal file
106
CarCenter/CarCenterBusinessLogic/BusinessLogics/RequestLogic.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class RequestLogic : IRequestLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRequestStorage _requestStorage;
|
||||
public RequestLogic(ILogger<RequestLogic> logger, IRequestStorage requestStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_requestStorage = requestStorage;
|
||||
}
|
||||
|
||||
public List<RequestViewModel>? ReadList(RequestSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. RequestId:Id:{ Id}", model?.Id);
|
||||
var list = model == null ? _requestStorage.GetFullList() : _requestStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public RequestViewModel? ReadElement(RequestSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. RequestId:Id:{ Id}", model.Id);
|
||||
var element = _requestStorage.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(RequestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_requestStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(RequestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_requestStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(RequestBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_requestStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(RequestBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.Description == string.Empty)
|
||||
{
|
||||
throw new ArgumentNullException("Нет описания", nameof(model.Description));
|
||||
}
|
||||
_logger.LogInformation("Request. Request:Id:{ Id}.Description:{ Description}", model.Id, model.Description);
|
||||
}
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id);
|
||||
_logger.LogInformation("ReadElement. StorekeeperId:Id:{ Id}", model.Id);
|
||||
var element = _storekeeperStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
@ -100,7 +100,7 @@ namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Нет телефона", nameof(model.PhoneNumber));
|
||||
}
|
||||
_logger.LogInformation("Storekeeper. Storekeeper:Id:{ Id}.Price:{ Price}", model.Id, model.PhoneNumber);
|
||||
_logger.LogInformation("Storekeeper. Storekeeper:Id:{ Id}.PhoneNumber:{ PhoneNumber}", model.Id, model.PhoneNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
106
CarCenter/CarCenterBusinessLogic/BusinessLogics/WorkerLogic.cs
Normal file
106
CarCenter/CarCenterBusinessLogic/BusinessLogics/WorkerLogic.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class WorkerLogic : IWorkerLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IWorkerStorage _workerStorage;
|
||||
public WorkerLogic(ILogger<WorkerLogic> logger, IWorkerStorage workerStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_workerStorage = workerStorage;
|
||||
}
|
||||
|
||||
public List<WorkerViewModel>? ReadList(WorkerSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. WorkerId:Id:{ Id}", model?.Id);
|
||||
var list = model == null ? _workerStorage.GetFullList() : _workerStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public WorkerViewModel? ReadElement(WorkerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id);
|
||||
var element = _workerStorage.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(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_workerStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_workerStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_workerStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(WorkerBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.PhoneNumber <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Нет телефона", nameof(model.PhoneNumber));
|
||||
}
|
||||
_logger.LogInformation("Worker. Worker:Id:{ Id}.PhoneNumber:{ PhoneNumber}", model.Id, model.PhoneNumber);
|
||||
}
|
||||
}
|
||||
}
|
@ -11,9 +11,9 @@ namespace CarCenterContracts.BindingModels
|
||||
public class BundlingBindingModel : IBundlingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public EquipmentPackage EquipmentPackage { get; set; }
|
||||
public TirePackage TirePackage { get; set; }
|
||||
public ToolKit ToolKit { get; set; }
|
||||
public EquipmentPackage EquipmentPackage { get; set; } = EquipmentPackage.Неизвестно;
|
||||
public TirePackage TirePackage { get; set; } = TirePackage.Неизвестно;
|
||||
public ToolKit ToolKit { get; set; } = ToolKit.Неизвестно;
|
||||
public double Price { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ namespace CarCenterContracts.BindingModels
|
||||
public class CarBindingModel : ICarModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public CarBrand CarBrand { get; set; }
|
||||
public CarBrand CarBrand { get; set; } = CarBrand.Неизвестно;
|
||||
public string Model { get; set; } = string.Empty;
|
||||
public CarClass CarClass { get; set; }
|
||||
public CarClass CarClass { get; set; } = CarClass.Неизвестно;
|
||||
public int Year { get; set; }
|
||||
public double Price { get; set; }
|
||||
public long VINnumber { get; set; }
|
||||
|
@ -11,9 +11,9 @@ namespace CarCenterContracts.BindingModels
|
||||
public class FeatureBindingModel : IFeatureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public HelpDevices HelpDevice { get; set; }
|
||||
public HelpDevices HelpDevice { get; set; } = HelpDevices.Неизвестно;
|
||||
public string CabinColor { get; set; } = string.Empty;
|
||||
public DriveTypes DriveType { get; set; }
|
||||
public DriveTypes DriveType { get; set; } = DriveTypes.Неизвестно;
|
||||
public double Price { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class OrderBindingModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public PaymentType PaymentType { get; set; } = PaymentType.Неизвестно;
|
||||
|
||||
public PaymentStatus PaymentStatus { get; set; } = PaymentStatus.Неизвестно;
|
||||
|
||||
public string BuyerFCS { get; set; } = string.Empty;
|
||||
|
||||
public DateTime PaymentDate { get; set; }
|
||||
|
||||
public double Sum { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class PresaleBindingModel : IPresaleModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public PresaleStatus PresaleStatus { get; set; } = PresaleStatus.Неизвестно;
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public DateTime DueTill { get; set; }
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class RequestBindingModel : IRequestModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public RequestTypes RequestType { get; set; } = RequestTypes.Неизвестно;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class WorkerBindingModel : IWorkerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
public string? Patronymic { get; set; }
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public long PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IOrderLogic
|
||||
{
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
OrderViewModel? ReadElement(OrderSearchModel model);
|
||||
bool Create(OrderBindingModel model);
|
||||
bool Update(OrderBindingModel model);
|
||||
bool Delete(OrderBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IPresaleLogic
|
||||
{
|
||||
List<PresaleViewModel>? ReadList(PresaleSearchModel? model);
|
||||
PresaleViewModel? ReadElement(PresaleSearchModel model);
|
||||
bool Create(PresaleBindingModel model);
|
||||
bool Update(PresaleBindingModel model);
|
||||
bool Delete(PresaleBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IRequestLogic
|
||||
{
|
||||
List<RequestViewModel>? ReadList(RequestSearchModel? model);
|
||||
RequestViewModel? ReadElement(RequestSearchModel model);
|
||||
bool Create(RequestBindingModel model);
|
||||
bool Update(RequestBindingModel model);
|
||||
bool Delete(RequestBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IWorkerLogic
|
||||
{
|
||||
List<WorkerViewModel>? ReadList(WorkerSearchModel? model);
|
||||
WorkerViewModel? ReadElement(WorkerSearchModel model);
|
||||
bool Create(WorkerBindingModel model);
|
||||
bool Update(WorkerBindingModel model);
|
||||
bool Delete(WorkerBindingModel model);
|
||||
}
|
||||
}
|
@ -6,11 +6,6 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="SearchModels\" />
|
||||
<Folder Include="BusinessLogicsContracts\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CarCenterDataModels\CarCenterDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class PresaleSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class RequestSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class WorkerSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IOrderStorage
|
||||
{
|
||||
List<OrderViewModel> GetFullList();
|
||||
List<OrderViewModel> GetFilteredList(OrderSearchModel model);
|
||||
OrderViewModel? GetElement(OrderSearchModel model);
|
||||
OrderViewModel? Insert(OrderBindingModel model);
|
||||
OrderViewModel? Update(OrderBindingModel model);
|
||||
OrderViewModel? Delete(OrderBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IPresaleStorage
|
||||
{
|
||||
List<PresaleViewModel> GetFullList();
|
||||
List<PresaleViewModel> GetFilteredList(PresaleSearchModel model);
|
||||
PresaleViewModel? GetElement(PresaleSearchModel model);
|
||||
PresaleViewModel? Insert(PresaleBindingModel model);
|
||||
PresaleViewModel? Update(PresaleBindingModel model);
|
||||
PresaleViewModel? Delete(PresaleBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IRequestStorage
|
||||
{
|
||||
List<RequestViewModel> GetFullList();
|
||||
List<RequestViewModel> GetFilteredList(RequestSearchModel model);
|
||||
RequestViewModel? GetElement(RequestSearchModel model);
|
||||
RequestViewModel? Insert(RequestBindingModel model);
|
||||
RequestViewModel? Update(RequestBindingModel model);
|
||||
RequestViewModel? Delete(RequestBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IWorkerStorage
|
||||
{
|
||||
List<WorkerViewModel> GetFullList();
|
||||
List<WorkerViewModel> GetFilteredList(WorkerSearchModel model);
|
||||
WorkerViewModel? GetElement(WorkerSearchModel model);
|
||||
WorkerViewModel? Insert(WorkerBindingModel model);
|
||||
WorkerViewModel? Update(WorkerBindingModel model);
|
||||
WorkerViewModel? Delete(WorkerBindingModel model);
|
||||
}
|
||||
}
|
26
CarCenter/CarCenterContracts/ViewModels/OrderViewModel.cs
Normal file
26
CarCenter/CarCenterContracts/ViewModels/OrderViewModel.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Тип оплаты")]
|
||||
public PaymentType PaymentType { get; set; } = PaymentType.Неизвестно;
|
||||
[DisplayName("Статус оплаты")]
|
||||
public PaymentStatus PaymentStatus { get; set; } = PaymentStatus.Неизвестно;
|
||||
[DisplayName("ФИО покупателя")]
|
||||
public string BuyerFCS { get; set; } = string.Empty;
|
||||
[DisplayName("Дата оплаты")]
|
||||
public DateTime PaymentDate { get; set; }
|
||||
[DisplayName("Сумма")]
|
||||
public double Sum { get; set; }
|
||||
}
|
||||
}
|
24
CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs
Normal file
24
CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class PresaleViewModel : IPresaleModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Статус работы")]
|
||||
public PresaleStatus PresaleStatus { get; set; } = PresaleStatus.Неизвестно;
|
||||
[DisplayName("Описание")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
[DisplayName("Выполнить до")]
|
||||
public DateTime DueTill { get; set; }
|
||||
[DisplayName("Цена")]
|
||||
public double Price { get; set; }
|
||||
}
|
||||
}
|
20
CarCenter/CarCenterContracts/ViewModels/RequestViewModel.cs
Normal file
20
CarCenter/CarCenterContracts/ViewModels/RequestViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class RequestViewModel : IRequestModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Описание")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
[DisplayName("Тип пожелания")]
|
||||
public RequestTypes RequestType { get; set; } = RequestTypes.Неизвестно;
|
||||
}
|
||||
}
|
27
CarCenter/CarCenterContracts/ViewModels/WorkerViewModel.cs
Normal file
27
CarCenter/CarCenterContracts/ViewModels/WorkerViewModel.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using CarCenterDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class WorkerViewModel : IWorkerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Имя")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Фамилия")]
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
[DisplayName("Отчество")]
|
||||
public string? Patronymic { get; set; }
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[DisplayName("Номер телефона")]
|
||||
public long PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum CarBrand
|
||||
{
|
||||
Неизвестно = -1,
|
||||
Лада = 0,
|
||||
Тойота = 1,
|
||||
Опель = 2,
|
||||
|
@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum CarClass
|
||||
{
|
||||
Неизвестно = -1,
|
||||
Седан = 0,
|
||||
Хетчбек = 1,
|
||||
Универсал = 2,
|
||||
|
@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum DriveTypes
|
||||
{
|
||||
Неизвестно = -1,
|
||||
Полный = 0,
|
||||
Передний = 1,
|
||||
Задний = 2,
|
||||
|
@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum EquipmentPackage
|
||||
{
|
||||
Неизвестно = -1,
|
||||
УлучшенныеТормоза = 0,
|
||||
ТурбоНабор = 1,
|
||||
Компрессор = 2,
|
||||
|
@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum HelpDevices
|
||||
{
|
||||
Неизвестно = -1,
|
||||
ABS = 0,
|
||||
ECS = 1,
|
||||
ПодушкиБезопасноти = 2,
|
||||
|
15
CarCenter/CarCenterDataModels/Enums/PaymentStatus.cs
Normal file
15
CarCenter/CarCenterDataModels/Enums/PaymentStatus.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum PaymentStatus
|
||||
{
|
||||
Неизвестно = -1,
|
||||
ОжидаетОплаты = 0,
|
||||
Оплачено = 1,
|
||||
}
|
||||
}
|
15
CarCenter/CarCenterDataModels/Enums/PaymentType.cs
Normal file
15
CarCenter/CarCenterDataModels/Enums/PaymentType.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum PaymentType
|
||||
{
|
||||
Неизвестно = -1,
|
||||
Безналичная = 0,
|
||||
Наличные = 1,
|
||||
}
|
||||
}
|
15
CarCenter/CarCenterDataModels/Enums/PresaleStatus.cs
Normal file
15
CarCenter/CarCenterDataModels/Enums/PresaleStatus.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum PresaleStatus
|
||||
{
|
||||
Неизвестно = -1,
|
||||
Выполняется = 0,
|
||||
Выполнено = 1
|
||||
}
|
||||
}
|
16
CarCenter/CarCenterDataModels/Enums/RequestTypes.cs
Normal file
16
CarCenter/CarCenterDataModels/Enums/RequestTypes.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum RequestTypes
|
||||
{
|
||||
Неизвестно = -1,
|
||||
Интерьер = 0,
|
||||
Детали = 1,
|
||||
Сотрудники = 2
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum TirePackage
|
||||
{
|
||||
Неизвестно = -1,
|
||||
ЗимнийШипы = 0,
|
||||
ЗимнийЛипучка = 1,
|
||||
Летний = 2,
|
||||
|
@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums
|
||||
{
|
||||
public enum ToolKit
|
||||
{
|
||||
Неизвестно = -1,
|
||||
Чемоданчик = 0,
|
||||
ЧемоданчикПро = 1,
|
||||
Наборчик = 2,
|
||||
|
23
CarCenter/CarCenterDataModels/Models/IOrderModel.cs
Normal file
23
CarCenter/CarCenterDataModels/Models/IOrderModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Models
|
||||
{
|
||||
public interface IOrderModel : IId
|
||||
{
|
||||
PaymentType PaymentType { get; }
|
||||
|
||||
PaymentStatus PaymentStatus { get; }
|
||||
|
||||
string BuyerFCS { get; }
|
||||
|
||||
DateTime PaymentDate { get; }
|
||||
|
||||
double Sum { get; }
|
||||
|
||||
}
|
||||
}
|
21
CarCenter/CarCenterDataModels/Models/IPresaleModel.cs
Normal file
21
CarCenter/CarCenterDataModels/Models/IPresaleModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Models
|
||||
{
|
||||
public interface IPresaleModel : IId
|
||||
{
|
||||
PresaleStatus PresaleStatus { get; }
|
||||
|
||||
string Description { get; }
|
||||
|
||||
DateTime DueTill { get; }
|
||||
|
||||
double Price { get; }
|
||||
|
||||
}
|
||||
}
|
16
CarCenter/CarCenterDataModels/Models/IRequestModel.cs
Normal file
16
CarCenter/CarCenterDataModels/Models/IRequestModel.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using CarCenterDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Models
|
||||
{
|
||||
public interface IRequestModel : IId
|
||||
{
|
||||
string Description { get; }
|
||||
|
||||
RequestTypes RequestType { get; }
|
||||
}
|
||||
}
|
19
CarCenter/CarCenterDataModels/Models/IWorkerModel.cs
Normal file
19
CarCenter/CarCenterDataModels/Models/IWorkerModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CarCenterDataModels.Models
|
||||
{
|
||||
public interface IWorkerModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Surname { get; }
|
||||
string? Patronymic { get; }
|
||||
string Password { get; }
|
||||
string Email { get; }
|
||||
long PhoneNumber { get; }
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user