Создание слоя с контрактами.

This commit is contained in:
Programmist73 2023-03-29 23:22:17 +04:00
parent 9284ac6bea
commit 287b5b7c1d
31 changed files with 593 additions and 7 deletions

View File

@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompany", "TransportCompany\TransportCompany.csproj", "{0512F64B-00F5-49BA-9613-7A396C075C0C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompany", "TransportCompany\TransportCompany.csproj", "{0512F64B-00F5-49BA-9613-7A396C075C0C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompanyDataModels", "TransportCompanyDataModels\TransportCompanyDataModels.csproj", "{C57B4449-A725-4804-833D-7CE33965F001}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompanyDataModels", "TransportCompanyDataModels\TransportCompanyDataModels.csproj", "{C57B4449-A725-4804-833D-7CE33965F001}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompanyContracts", "TransportCompanyContracts\TransportCompanyContracts.csproj", "{8707D719-D7B3-4F64-8BBE-DE9C7014DD13}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,6 +23,10 @@ Global
{C57B4449-A725-4804-833D-7CE33965F001}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C57B4449-A725-4804-833D-7CE33965F001}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C57B4449-A725-4804-833D-7CE33965F001}.Release|Any CPU.Build.0 = Release|Any CPU
{8707D719-D7B3-4F64-8BBE-DE9C7014DD13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8707D719-D7B3-4F64-8BBE-DE9C7014DD13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8707D719-D7B3-4F64-8BBE-DE9C7014DD13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8707D719-D7B3-4F64-8BBE-DE9C7014DD13}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.BindingModels
{
public class CargoBindingModel : ICargoModel
{
public int Id { get; set; }
public string TypeCargo { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.BindingModels
{
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Surname { get; set; } = string.Empty;
public string Patronymic { get; set; } = string.Empty;
public string TelephoneNumber { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.BindingModels
{
public class TransportBindingModel : ITransportModel
{
public int Id { get; set; }
public string Tranport { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.BindingModels
{
public class TransportationBindingModel : ITransportationModel
{
public int Id {get; set;}
public string TransportationType { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.BindingModels
{
public class TruckingBindingModel : ITruckingModel
{
public int Id { get; set; }
public int ClientId { get; set; }
public int CargoId { get; set; }
public double Price { get; set; }
public DateTime DateStart { get; set; }
public DateTime DateEnd { get; set; }
public int TransportationId { get; set; }
public int TransportId { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.BusinessLogicsContracts
{
public interface ICargoLogic
{
List<CargoViewModel>? ReadList(CargoSearchModel? model);
CargoViewModel? ReadElement(CargoSearchModel model);
bool Create(CargoBindingModel model);
bool Update(CargoBindingModel model);
bool Delete(CargoBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.BusinessLogicsContracts
{
public interface IClientLogic
{
List<ClientViewModel>? ReadList(ClientSearchModel? model);
ClientViewModel? ReadElement(ClientSearchModel model);
bool Create(ClientBindingModel model);
bool Update(ClientBindingModel model);
bool Delete(ClientBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.BusinessLogicsContracts
{
public interface ITransportLogic
{
List<TransportViewModel>? ReadList(TransportSearchModel? model);
TransportViewModel? ReadElement(TransportSearchModel model);
bool Create(TransportBindingModel model);
bool Update(TransportBindingModel model);
bool Delete(TransportBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.BusinessLogicsContracts
{
public interface ITransportationLogic
{
List<TransportationViewModel>? ReadList(TransportationSearchModel? model);
TransportationViewModel? ReadElement(TransportationSearchModel model);
bool Create(TransportationBindingModel model);
bool Update(TransportationBindingModel model);
bool Delete(TransportationBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.BusinessLogicsContracts
{
public interface ITruckingLogic
{
List<TruckingViewModel>? ReadList(TruckingSearchModel? model);
TruckingViewModel? ReadElement(TruckingSearchModel model);
bool Create(TruckingBindingModel model);
bool Update(TruckingBindingModel model);
bool Delete(TruckingBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TransportCompanyContracts.SearchModels
{
public class CargoSearchModel
{
public int? Id { get; set; }
public string? TypeCargo { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TransportCompanyContracts.SearchModels
{
public class ClientSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public string? Surname { get; set; }
public string? Patronymic { get; set; }
public string? TelephoneNumber { get; set; }
public string? Email { get;}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TransportCompanyContracts.SearchModels
{
public class TransportSearchModel
{
public int? Id { get; set; }
public string? Tranport { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TransportCompanyContracts.SearchModels
{
public class TransportationSearchModel
{
public int? Id { get; set; }
public string? TransportationType { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TransportCompanyContracts.SearchModels
{
public class TruckingSearchModel
{
public int? Id { get; set; }
public int? ClientId { get; set; }
public DateTime? DateStart { get; set; }
public DateTime? DateEnd { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.StoragesContracts
{
public interface ICargoStorage
{
List<CargoViewModel> GetFullList();
List<CargoViewModel> GetFilteredList(CargoSearchModel model);
CargoViewModel? GetElement(CargoSearchModel model);
CargoViewModel? Insert(CargoBindingModel model);
CargoViewModel? Update(CargoBindingModel model);
CargoViewModel? Delete(CargoBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.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);
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.StoragesContracts
{
public interface ITransportStorage
{
List<TransportViewModel> GetFullList();
List<TransportViewModel> GetFilteredList(TransportSearchModel model);
TransportViewModel? GetElement(TransportSearchModel model);
TransportViewModel? Insert(TransportBindingModel model);
TransportViewModel? Update(TransportBindingModel model);
TransportViewModel? Delete(TransportBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.StoragesContracts
{
public interface ITransportationStorage
{
List<TransportationViewModel> GetFullList();
List<TransportationViewModel> GetFilteredList(TransportationSearchModel model);
TransportationViewModel? GetElement(TransportationSearchModel model);
TransportationViewModel? Insert(TransportationBindingModel model);
TransportationViewModel? Update(TransportationBindingModel model);
TransportationViewModel? Delete(TransportationBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyContracts.StoragesContracts
{
public interface ITruckingStorage
{
List<TruckingViewModel> GetFullList();
List<TruckingViewModel> GetFilteredList(TruckingSearchModel model);
TruckingViewModel? GetElement(TruckingSearchModel model);
TruckingViewModel? Insert(TruckingBindingModel model);
TruckingViewModel? Update(TruckingBindingModel model);
TruckingViewModel? Delete(TruckingBindingModel model);
}
}

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.ViewModels
{
public class CargoViewModel : ICargoModel
{
public int Id { get; set; }
[DisplayName("Тип груза")]
public string TypeCargo {get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
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; } = string.Empty;
[DisplayName("Телефон")]
public string TelephoneNumber { get; set; } = string.Empty;
[DisplayName("Почта")]
public string Email { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.ViewModels
{
public class TransportViewModel : ITransportModel
{
public int Id { get; set; }
[DisplayName("Вид транспорта")]
public string Tranport { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.ViewModels
{
public class TransportationViewModel : ITransportationModel
{
public int Id { get; set; }
[DisplayName("Тип транспортировки")]
public string TransportationType { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyDataModels.Models;
namespace TransportCompanyContracts.ViewModels
{
public class TruckingViewModel : ITruckingModel
{
public int Id { get; set; }
public int ClientId { get; set; }
[DisplayName("Имя")]
public string ClientName { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string ClientSurname { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string ClientPatronymic { get; set; } = string.Empty;
public int TransportationId { get; set; }
[DisplayName("Тип перевозки")]
public string TypeTransportation { get; set; } = string.Empty;
public int TransportId { get; set; }
[DisplayName("Тип транспорта")]
public string TransportName { get; set; } = string.Empty;
public int CargoId { get; set; }
[DisplayName("Объект перевозки")]
public string Cargo { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
[DisplayName("Дата оформления перевозки")]
public DateTime DateStart { get; set; }
[DisplayName("Дата завершения перевозки")]
public DateTime DateEnd { get; set; }
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace TransportCompanyDataModels.Models
{
public interface ICargo : IId
public interface ICargoModel : IId
{
//тип груза
string TypeCargo { get; }

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace TransportCompanyDataModels.Models
{
public interface IClient : IId
public interface IClientModel : IId
{
string Name { get; }

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace TransportCompanyDataModels.Models
{
public interface ITransportationType : IId
public interface ITransportationModel : IId
{
//тип транспортировки
string TransportationType { get; }

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace TransportCompanyDataModels.Models
{
public interface ITrucking : IId
public interface ITruckingModel : IId
{
int ClientId { get; }
@ -18,7 +18,7 @@ namespace TransportCompanyDataModels.Models
DateTime DateEnd { get; }
int TypeTransportationId { get; }
int TransportationId { get; }
int TransportId { get; }
}