лови лимонку ахи брат
This commit is contained in:
parent
fbddedb5e9
commit
c0b83e1d87
15
CarCenterContracts/BindingModels/AccountBindingModel.cs
Normal file
15
CarCenterContracts/BindingModels/AccountBindingModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using CarCenterDataModels;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class AccountBindingModel : IAccountModel
|
||||
{
|
||||
public int ClientByCarId { get; set; }
|
||||
|
||||
public DateOnly DateOfAccount { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
21
CarCenterContracts/BindingModels/CarBindingModel.cs
Normal file
21
CarCenterContracts/BindingModels/CarBindingModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.ComponentModel;
|
||||
using CarCenterDataModels;
|
||||
using CarCenterDataModels.ProxyModels;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class CarBindingModel : ICarModel
|
||||
{
|
||||
public int ImplementerId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
|
||||
public DateOnly DateOfReceipt { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
public DateOnly DateOfPassage { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
|
||||
public Dictionary<int, ClientByCarModel> ClientsModel { get; set; } = new();
|
||||
public List<RequirementByCarModel> RequirementsModel { get; set; } = new();
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
14
CarCenterContracts/BindingModels/ImplementerBindingModel.cs
Normal file
14
CarCenterContracts/BindingModels/ImplementerBindingModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using CarCenterDataModels;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class ImplementerBindingModel : IImplementerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
public string Login { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
18
CarCenterContracts/BusinessLogicContracts/IAccountLogic.cs
Normal file
18
CarCenterContracts/BusinessLogicContracts/IAccountLogic.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IAccountLogic
|
||||
{
|
||||
List<AccountViewModel> ReadList(AccountSearchModel model);
|
||||
AccountViewModel ReadElement(AccountSearchModel model);
|
||||
bool Create(AccountBindingModel model);
|
||||
|
||||
/// <summary>
|
||||
/// Получение полной и оплаченной стоимости в бизнес логике, по клиенту и дисциплине
|
||||
/// </summary>
|
||||
bool GetAccountInfo(AccountSearchModel model, out double fullPrice, out double paidPrice);
|
||||
}
|
||||
}
|
16
CarCenterContracts/BusinessLogicContracts/ICarLogic.cs
Normal file
16
CarCenterContracts/BusinessLogicContracts/ICarLogic.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface ICarLogic
|
||||
{
|
||||
List<CarViewModel> ReadList(CarSearchModel? model = null);
|
||||
CarViewModel ReadElement(CarSearchModel model);
|
||||
bool Create(CarBindingModel model);
|
||||
bool Update(CarBindingModel model);
|
||||
bool Delete(CarBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IImplementerLogic
|
||||
{
|
||||
ImplementerViewModel ReadElement(ImplementerSearchModel model);
|
||||
bool Create(ImplementerBindingModel model);
|
||||
}
|
||||
}
|
13
CarCenterContracts/SearchModels/AccountSearchModel.cs
Normal file
13
CarCenterContracts/SearchModels/AccountSearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class AccountSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? ClientId { get; set; }
|
||||
public int? CarId { get; set; }
|
||||
|
||||
public DateOnly? DateFrom { get; set; }
|
||||
public DateOnly? DateTo { get; set; }
|
||||
}
|
||||
}
|
13
CarCenterContracts/SearchModels/CarSearchModel.cs
Normal file
13
CarCenterContracts/SearchModels/CarSearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class CarSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public DateOnly? DateFrom { get; set; }
|
||||
public DateOnly? DateTo { get; set; }
|
||||
|
||||
public List<int>? ClientsIds { get; set; }
|
||||
|
||||
public int? ImplementerId { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class ImplementerSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Login { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
14
CarCenterContracts/StoragesContracts/IAccountStorage.cs
Normal file
14
CarCenterContracts/StoragesContracts/IAccountStorage.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IAccountStorage
|
||||
{
|
||||
List<AccountViewModel> GetFullList();
|
||||
List<AccountViewModel> GetFilteredList(AccountSearchModel model);
|
||||
AccountViewModel? GetElement(AccountSearchModel model);
|
||||
AccountViewModel? Insert(AccountBindingModel model);
|
||||
}
|
||||
}
|
18
CarCenterContracts/StoragesContracts/ICarStorage.cs
Normal file
18
CarCenterContracts/StoragesContracts/ICarStorage.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.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);
|
||||
|
||||
List<AccountViewModel> GetAccountsFromCarAndClient(CarSearchModel modelCar, ClientSearchModel modelClient);
|
||||
}
|
||||
}
|
12
CarCenterContracts/StoragesContracts/IImplementerStorage.cs
Normal file
12
CarCenterContracts/StoragesContracts/IImplementerStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IImplementerStorage
|
||||
{
|
||||
ImplementerViewModel? GetElement(ImplementerSearchModel model);
|
||||
ImplementerViewModel? Insert(ImplementerBindingModel model);
|
||||
}
|
||||
}
|
21
CarCenterContracts/ViewModels/AccountViewModel.cs
Normal file
21
CarCenterContracts/ViewModels/AccountViewModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using CarCenterDataModels;
|
||||
using System.ComponentModel;
|
||||
using CarCenterDataModels.ProxyModels;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class AccountViewModel : IAccountModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ClientByCarId { get; set; }
|
||||
public DateOnly DateOfAccount { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public ClientByCarModel ClientByCar { get; set; }
|
||||
|
||||
public ClientViewModel? Client { get; set; }
|
||||
|
||||
public CarViewModel? Car { get; set; }
|
||||
}
|
||||
}
|
37
CarCenterContracts/ViewModels/CarViewModel.cs
Normal file
37
CarCenterContracts/ViewModels/CarViewModel.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using CarCenterDataModels;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using CarCenterDataModels.ProxyModels;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class CarViewModel : ICarModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ImplementerId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
|
||||
[DisplayName("Логин клиента")]
|
||||
public string DirectorLogin { get; set; } = string.Empty;
|
||||
|
||||
public Dictionary<int, ClientByCarModel> ClientsModel { get; set; } = new();
|
||||
public List<RequirementViewModel> RequirementViewModels { get; set; } = new();
|
||||
|
||||
public List<ClientViewModel> ClientViewModels { get; set; } = new();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var result = new StringBuilder(
|
||||
$"Автомобиль {Name} " +
|
||||
$"был куплен клиентом:");
|
||||
for (int i = 0; i < ClientViewModels.Count; i++)
|
||||
{
|
||||
var Car = ClientViewModels[i];
|
||||
result.Append($"\n\t{i + 1}. {Car.Name} на " +
|
||||
$"{ClientsModel[Car.Id].DateOfClient.ToShortDateString()}");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
16
CarCenterContracts/ViewModels/ImplementerViewModel.cs
Normal file
16
CarCenterContracts/ViewModels/ImplementerViewModel.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using CarCenterDataModels;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class ImplementerViewModel : IImplementerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string Login { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user