сделал свою более сложную работу
This commit is contained in:
parent
68f790bcda
commit
fbddedb5e9
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarCenter", "CarCenter.cspr
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarCenterDataModels", "..\CarCenterDataModels\CarCenterDataModels.csproj", "{5C83F791-9BDF-4EE7-A2F9-E163E9A26613}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarCenterContracts", "..\CarCenterContracts\CarCenterContracts.csproj", "{4A207999-1093-4596-B779-7366629753D3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{5C83F791-9BDF-4EE7-A2F9-E163E9A26613}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5C83F791-9BDF-4EE7-A2F9-E163E9A26613}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5C83F791-9BDF-4EE7-A2F9-E163E9A26613}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A207999-1093-4596-B779-7366629753D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A207999-1093-4596-B779-7366629753D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A207999-1093-4596-B779-7366629753D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A207999-1093-4596-B779-7366629753D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
17
CarCenterContracts/BindingModels/ClientBindingModel.cs
Normal file
17
CarCenterContracts/BindingModels/ClientBindingModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using CarCenterDataModels;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class ClientBindingModel : IClientModel
|
||||
{
|
||||
public int DirectorId { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public int Course { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
17
CarCenterContracts/BindingModels/DirectorBindingModel.cs
Normal file
17
CarCenterContracts/BindingModels/DirectorBindingModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using CarCenterDataModels;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class DirectorBindingModel : IDirectorModel
|
||||
{
|
||||
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;
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
17
CarCenterContracts/BindingModels/RequirementBindingModel.cs
Normal file
17
CarCenterContracts/BindingModels/RequirementBindingModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using CarCenterDataModels;
|
||||
using CarCenterDataModels.ProxyModels;
|
||||
|
||||
namespace CarCenterContracts.BindingModels
|
||||
{
|
||||
public class RequirementBindingModel : IRequirementModel
|
||||
{
|
||||
public int DirectorId { get; set; }
|
||||
|
||||
public string NameOfRequirement { get; set; } = string.Empty;
|
||||
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, RequirementByCarModel> CarsModels { get; set; } = new();
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
15
CarCenterContracts/BusinessLogicContracts/IClientLogic.cs
Normal file
15
CarCenterContracts/BusinessLogicContracts/IClientLogic.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IClientLogic
|
||||
{
|
||||
List<ClientViewModel> ReadList(ClientSearchModel? model = null);
|
||||
ClientViewModel ReadElement(ClientSearchModel model);
|
||||
bool Create(ClientBindingModel model);
|
||||
bool Update(ClientBindingModel model);
|
||||
bool Delete(ClientBindingModel model);
|
||||
}
|
||||
}
|
12
CarCenterContracts/BusinessLogicContracts/IDirectorLogic.cs
Normal file
12
CarCenterContracts/BusinessLogicContracts/IDirectorLogic.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IDirectorLogic
|
||||
{
|
||||
DirectorViewModel ReadElement(DirectorSearchModel model);
|
||||
bool Create(DirectorBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IRequirementLogic
|
||||
{
|
||||
List<RequirementViewModel> ReadList(RequirementSearchModel? model = null);
|
||||
RequirementViewModel ReadElement(RequirementSearchModel model);
|
||||
bool Create(RequirementBindingModel model);
|
||||
bool Update(RequirementBindingModel model);
|
||||
bool Delete(RequirementBindingModel model);
|
||||
}
|
||||
}
|
13
CarCenterContracts/CarCenterContracts.csproj
Normal file
13
CarCenterContracts/CarCenterContracts.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CarCenterDataModels\CarCenterDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
11
CarCenterContracts/SearchModels/ClientSearchModel.cs
Normal file
11
CarCenterContracts/SearchModels/ClientSearchModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class ClientSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? DirectorId { get; set; }
|
||||
|
||||
public List<int>? CarsIds { get; set; }
|
||||
}
|
||||
}
|
9
CarCenterContracts/SearchModels/DirectorSearchModel.cs
Normal file
9
CarCenterContracts/SearchModels/DirectorSearchModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class DirectorSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Login { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace CarCenterContracts.SearchModels
|
||||
{
|
||||
public class RequirementSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? DirectorId { get; set; }
|
||||
}
|
||||
}
|
16
CarCenterContracts/StoragesContracts/IClientStorage.cs
Normal file
16
CarCenterContracts/StoragesContracts/IClientStorage.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IClientStorage
|
||||
{
|
||||
List<ClientViewModel> GetFullList();
|
||||
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
|
||||
ClientViewModel? GetElement(ClientSearchModel model);
|
||||
ClientViewModel? Insert(ClientBindingModel model);
|
||||
ClientViewModel? Update(ClientBindingModel model);
|
||||
ClientViewModel? Delete(ClientBindingModel model);
|
||||
}
|
||||
}
|
12
CarCenterContracts/StoragesContracts/IDirectorStorage.cs
Normal file
12
CarCenterContracts/StoragesContracts/IDirectorStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IDirectorStorage
|
||||
{
|
||||
DirectorViewModel? GetElement(DirectorSearchModel model);
|
||||
DirectorViewModel? Insert(DirectorBindingModel model);
|
||||
}
|
||||
}
|
16
CarCenterContracts/StoragesContracts/IRequirementStorage.cs
Normal file
16
CarCenterContracts/StoragesContracts/IRequirementStorage.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.ViewModels;
|
||||
|
||||
namespace CarCenterContracts.StoragesContracts
|
||||
{
|
||||
public interface IRequirementStorage
|
||||
{
|
||||
List<RequirementViewModel> GetFullList();
|
||||
List<RequirementViewModel> GetFilteredList(RequirementSearchModel model);
|
||||
RequirementViewModel? GetElement(RequirementSearchModel model);
|
||||
RequirementViewModel? Insert(RequirementBindingModel model);
|
||||
RequirementViewModel? Update(RequirementBindingModel model);
|
||||
RequirementViewModel? Delete(RequirementBindingModel model);
|
||||
}
|
||||
}
|
28
CarCenterContracts/ViewModels/ClientViewModel.cs
Normal file
28
CarCenterContracts/ViewModels/ClientViewModel.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using CarCenterDataModels;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int DirectorId { get; set; }
|
||||
public string DirectorLogin { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[JsonIgnore]
|
||||
public List<CarViewModel> Cars { get; set; } = new();
|
||||
public override string ToString()
|
||||
{
|
||||
var result = new StringBuilder();
|
||||
foreach (var Car in Cars)
|
||||
{
|
||||
result.Append($"Клиентом {Name} была приобретена марка {Car.ClientsModel[Id].DateOfClient.ToShortDateString()}, " +
|
||||
$"модель{Car.Name}.\n");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
19
CarCenterContracts/ViewModels/DirectorViewModel.cs
Normal file
19
CarCenterContracts/ViewModels/DirectorViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using CarCenterDataModels;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class DirectorViewModel : IDirectorModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Фамилия")]
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
[DisplayName("Имя")]
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
21
CarCenterContracts/ViewModels/RequirementViewModel.cs
Normal file
21
CarCenterContracts/ViewModels/RequirementViewModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using CarCenterDataModels;
|
||||
using System.ComponentModel;
|
||||
using CarCenterDataModels.ProxyModels;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
public class RequirementViewModel : IRequirementModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int DirectorId { get; set; }
|
||||
[DisplayName("Логин сотрудника")]
|
||||
public string DirectorLogin { get; set; } = string.Empty;
|
||||
[DisplayName("Наименование")]
|
||||
public string NameOfRequirement { get; set; } = string.Empty;
|
||||
[DisplayName("Стоимость")]
|
||||
public double Price { get; set; }
|
||||
|
||||
// Дата счета дисциплины для отчета
|
||||
public Dictionary<int, RequirementByCarModel> CarsModels { get; set; } = new();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user