Добавление слоя контрактов

This commit is contained in:
Володя 2023-04-22 14:12:21 +03:00
parent aaff2b4674
commit f053f70389
37 changed files with 721 additions and 0 deletions

View File

@ -0,0 +1,22 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class CarBM : ICar
{
public string Model { get; set; } = string.Empty;
public int Tonnage { get; set; }
public int StatusId { get; set; }
public string StatusTitle { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class CompanyBM : ICompany
{
public string Title { get; set; } = string.Empty;
public int StatusId {get; set; }
public string StatusTitle { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class HumanBM : IHuman
{
public string Name { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public int StatusId { get; set; }
public string StatusTitle { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class PlaceBM : IPlace
{
public string Title { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class RouteBM : IRoute
{
public int PlaceStart { get; set; }
public int PlaceEnd { get; set; }
public int Length { get; set; }
public string Title { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class StatusBM : IStatus
{
public string Title { get; set; } = string.Empty;
public int Id {get; set;}
}
}

View File

@ -0,0 +1,32 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class VoyageBM : IVoyage
{
public int CarId { get; set; }
public string CarName { get; set; } = string.Empty;
public int HumanId { get; set; }
public string HumanName { get; set; } = string.Empty;
public int CompanyId { get; set; }
public string CompanyName { get; set; } = string.Empty;
public int RouteId { get; set; }
public DateTime DateStart { get; set; }
public DateTime DateEnd { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogic
{
public interface ICarLogic
{
List<CarVM>? ReadList(CarSM model);
CarVM? ReadElement(CarSM model);
bool Create(CarBM model);
bool Update(CarBM model);
bool Delete(CarBM model);
}
}

View File

@ -0,0 +1,20 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogic
{
public interface ICompanyLogic
{
List<CompanyVM>? ReadList(CompanySM model);
CompanyVM? ReadElement(CompanySM model);
bool Create(CompanyBM model);
bool Update(CompanyBM model);
bool Delete(CompanyBM model);
}
}

View File

@ -0,0 +1,20 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogic
{
public interface IHumanLogic
{
List<HumanVM>? ReadList(HumanSM model);
HumanVM? ReadElement(HumanSM model);
bool Create(HumanBM model);
bool Update(HumanBM model);
bool Delete(HumanBM model);
}
}

View File

@ -0,0 +1,20 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogic
{
public interface IPlaceLogic
{
List<PlaceVM>? ReadList(PlaceSM model);
PlaceVM? ReadElement(PlaceSM model);
bool Create(PlaceBM model);
bool Update(PlaceBM model);
bool Delete(PlaceBM model);
}
}

View File

@ -0,0 +1,20 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogic
{
public interface IRouteLogic
{
List<RouteVM>? ReadList(RouteSM model);
RouteVM? ReadElement(RouteSM model);
bool Create(RouteBM model);
bool Update(RouteBM model);
bool Delete(RouteBM model);
}
}

View File

@ -0,0 +1,20 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogic
{
public interface IStatusLogic
{
List<StatusVM>? ReadList();
StatusVM? ReadElement(StatusSM model);
bool Create(StatusBM model);
bool Update(StatusBM model);
bool Delete(StatusBM model);
}
}

View File

@ -0,0 +1,20 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogic
{
public interface IVoyageLogic
{
List<VoyageVM>? ReadList(VoyageSM model);
VoyageVM? ReadElement(VoyageSM model);
bool Create(VoyageBM model);
bool Update(VoyageBM model);
bool Delete(VoyageBM model);
}
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Subd\DataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.SearchModel
{
public class CarSM
{
public string? Model { get; set; }
public int? Id { get; set; }
public int? StatusId { 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 Contracts.SearchModel
{
public class CompanySM
{
public string? Title { get; set; }
public int? Id { get; set; }
public int? StatusId { 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 Contracts.SearchModel
{
public class HumanSM
{
public string? Name { get; set; }
public int? Id { get; set; }
public int? StatusId { 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 Contracts.SearchModel
{
public class PlaceSM
{
public string? Title { get; set; }
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.SearchModel
{
public class RouteSM
{
public int? Length { get; set; }
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.SearchModel
{
public class StatusSM
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.SearchModel
{
public class VoyageSM
{
public int? Id { get; set; }
public DateTime? DateStart { get; set; }
public DateTime? DateEnd { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Storage
{
public interface ICarStorage
{
List<CarVM> GetFullList();
List<CarVM> GetFilteredList(CarSM model);
CarVM? GetElement(CarSM model);
CarVM? Insert(CarBM model);
CarVM? Update(CarBM model);
CarVM? Delete(CarBM model);
}
}

View File

@ -0,0 +1,21 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Storage
{
public interface ICompanyStorage
{
List<CompanyVM> GetFullList();
List<CompanyVM> GetFilteredList(CompanySM model);
CompanyVM? GetElement(CompanySM model);
CompanyVM? Insert(CompanyBM model);
CompanyVM? Update(CompanyBM model);
CompanyVM? Delete(CompanyBM model);
}
}

View File

@ -0,0 +1,21 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Storage
{
public interface IHumanStorage
{
List<HumanVM> GetFullList();
List<HumanVM> GetFilteredList(HumanSM model);
HumanVM? GetElement(HumanSM model);
HumanVM? Insert(HumanBM model);
HumanVM? Update(HumanBM model);
HumanVM? Delete(HumanBM model);
}
}

View File

@ -0,0 +1,21 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Storage
{
public interface IPlaceStorage
{
List<PlaceVM> GetFullList();
List<PlaceVM> GetFilteredList(PlaceSM model);
PlaceVM? GetElement(PlaceSM model);
PlaceVM? Insert(PlaceBM model);
PlaceVM? Update(PlaceBM model);
PlaceVM? Delete(PlaceBM model);
}
}

View File

@ -0,0 +1,21 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Storage
{
public interface IRouteStorage
{
List<RouteVM> GetFullList();
List<RouteVM> GetFilteredList(RouteSM model);
RouteVM? GetElement(RouteSM model);
RouteVM? Insert(RouteBM model);
RouteVM? Update(RouteBM model);
RouteVM? Delete(RouteBM model);
}
}

View File

@ -0,0 +1,21 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Storage
{
public interface IStatusStorage
{
List<StatusVM> GetFullList();
List<StatusVM> GetFilteredList(StatusSM model);
StatusVM? GetElement(StatusSM model);
StatusVM? Insert(StatusBM model);
StatusVM? Update(StatusBM model);
StatusVM? Delete(StatusBM model);
}
}

View File

@ -0,0 +1,21 @@
using Contracts.BindingModels;
using Contracts.SearchModel;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Storage
{
public interface IVoyageStorage
{
List<VoyageVM> GetFullList();
List<VoyageVM> GetFilteredList(VoyageSM model);
VoyageVM? GetElement(VoyageSM model);
VoyageVM? Insert(VoyageBM model);
VoyageVM? Update(VoyageBM model);
VoyageVM? Delete(VoyageBM model);
}
}

View File

@ -0,0 +1,24 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class CarVM : ICar
{
[DisplayName("Модель")]
public string Model { get; set; } = string.Empty;
[DisplayName("Грузоподъемность")]
public int Tonnage { get; set; }
public int StatusId { get; set; }
[DisplayName("Статус")]
public string StatusTitle { get; set; } = string.Empty;
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class CompanyVM : ICompany
{
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
public int StatusId { get; set; }
[DisplayName("Статус")]
public string StatusTitle { get; set; } = string.Empty;
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class HumanVM : IHuman
{
[DisplayName("ФИО")]
public string Name { get; set; } = string.Empty;
[DisplayName("Телефон")]
public string Phone { get; set; } = string.Empty;
public int StatusId { get; set; }
[DisplayName("Статус")]
public string StatusTitle { get; set; } = string.Empty;
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class PlaceVM : IPlace
{
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class RouteVM : IRoute
{
public int PlaceStart { get; set; }
public int PlaceEnd { get; set; }
public int Length { get; set; }
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class StatusVM : IStatus
{
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,33 @@
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class VoyageVM : IVoyage
{
public int CarId { get; set; }
[DisplayName("Машина")]
public string CarName { get; set; } = string.Empty;
public int HumanId { get; set; }
[DisplayName("Водитель")]
public string HumanName { get; set; } = string.Empty;
public int CompanyId { get; set; }
[DisplayName("Заказчик")]
public string CompanyName { get; set; } = string.Empty;
public int RouteId { get; set; }
[DisplayName("Дата выезда")]
public DateTime DateStart { get; set; }
[DisplayName("Срок")]
public DateTime DateEnd { get; set; }
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataModels", "Subd\DataModels.csproj", "{4F51BFA8-D899-4A30-96AA-0B6BFE630E9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{AB284C76-C880-4A90-8E6D-00A8ACCA531A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +17,10 @@ Global
{4F51BFA8-D899-4A30-96AA-0B6BFE630E9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F51BFA8-D899-4A30-96AA-0B6BFE630E9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F51BFA8-D899-4A30-96AA-0B6BFE630E9C}.Release|Any CPU.Build.0 = Release|Any CPU
{AB284C76-C880-4A90-8E6D-00A8ACCA531A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB284C76-C880-4A90-8E6D-00A8ACCA531A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB284C76-C880-4A90-8E6D-00A8ACCA531A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB284C76-C880-4A90-8E6D-00A8ACCA531A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE