Contracts

This commit is contained in:
Vadim 2023-04-08 18:52:03 +04:00
parent 5175f7bb75
commit 6c7c5fa390
44 changed files with 651 additions and 0 deletions

View File

@ -0,0 +1,14 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class CarBindingModel : ICarModel
{
public int Id { get; set; }
public string Brand { get; set; } = string.Empty;
public string Model { get; set; } = string.Empty;
public string VIN { get; set; } = string.Empty;
public Dictionary<int, (ISpareModel, int)> CarSpares { get; set; } = new();
}
}

View File

@ -0,0 +1,12 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class EmployerBindingModel : IEmployerModel
{
public int Id { get; set; }
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,13 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class MaintenanceBindingModel : IMaintenanceModel
{
public int Id { get; set; }
public int EmployerId { get; set; }
public double Cost { get; set; }
public DateTime DateCreate { get; set; }
public Dictionary<int, (ICarModel, int)> MaintenanceCars { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace STOContracts.BindingModels
{
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,10 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class ServiceBindingModel : IServiceModel
{
public int Id { get; set; }
public string ServiceDescription { get; set; }=string.Empty;
}
}

View File

@ -0,0 +1,13 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class SpareBindingModel : ISpareModel
{
public int Id { get; set; }
public string Name { get; set; } = String.Empty;
public double Price { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class StorekeeperBindingModel : IStorekeeperModel
{
public int Id { get; set; }
public string Login { get; set; } = String.Empty;
public string Password { get; set; } = String.Empty;
public string Email { get; set; } = String.Empty;
}
}

View File

@ -0,0 +1,25 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class WorkBindingModel : IWorkModel
{
public int Id { get; set; }
public string Title { get; set; } = String.Empty;
public double Price { get; set; }
public int StorekeeperId { get; set; }
public int DurationId { get; set; }
public DateTime Date { get; set; } = DateTime.Now;
public Dictionary<int, (ISpareModel, int)> WorkSpares { get; set; } = new();
public Dictionary<int, (IMaintenanceModel, int)> WorkMaintences { get; set; } = new();
}
}

View File

@ -0,0 +1,11 @@
using STODataModels.Models;
namespace STOContracts.BindingModels
{
public class WorkDurationBindingModel : IWorkDurationModel
{
public int Id { get; set; }
public int Duration { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface ICarLogic
{
List<CarViewModel>? ReadList(CarSearchModel? model);
CarViewModel? ReadElement(CarSearchModel? model);
bool Create(CarBindingModel model);
bool Update(CarBindingModel model);
bool Delete(CarBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface IEmployerLogic
{
List<EmployerViewModel>? ReadList(EmployerSearchModel? model);
EmployerViewModel? ReadElement(EmployerSearchModel? model);
bool Create(EmployerBindingModel model);
bool Update(EmployerBindingModel model);
bool Delete(EmployerBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface IMaintenanceLogic
{
List<MaintenanceViewModel>? ReadList(MaintenanceSearchModel? model);
MaintenanceViewModel? ReadElement(MaintenanceSearchModel? model);
bool Create(MaintenanceBindingModel model);
bool Update(MaintenanceBindingModel model);
bool Delete(MaintenanceBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
using STOContracts.BindingModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface IReportLogic
{
List<ReportViewModel> GetSpares(ReportBindingModel model);
void SaveToWordFile(ReportBindingModel model);
void SaveToExcelFile(ReportBindingModel model);
void SaveToPdfFile(ReportBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface IServiceLogic
{
List<ServiceViewModel>? ReadList(ServiceSearchModel? model);
ServiceViewModel? ReadElement(ServiceSearchModel? model);
bool Create(ServiceBindingModel model);
bool Update(ServiceBindingModel model);
bool Delete(ServiceBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface ISpareLogic
{
List<SpareViewModel>? ReadList(SpareSearchModel? model);
SpareViewModel? ReadElement(SpareSearchModel? model);
bool Create(SpareBindingModel model);
bool Update(SpareBindingModel model);
bool Delete(SpareBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface IStorekeeperLogic
{
List<StorekeeperViewModel>? ReadList(StorekeeperSearchModel? model);
StorekeeperViewModel? ReadElement(StorekeeperSearchModel? model);
bool Create(StorekeeperBindingModel model);
bool Update(StorekeeperBindingModel model);
bool Delete(StorekeeperBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface IWorkDurationLogic
{
List<WorkDurationViewModel>? ReadList(WorkDurationSearchModel? model);
WorkDurationViewModel? ReadElement(WorkDurationSearchModel? model);
bool Create(WorkDurationBindingModel model);
bool Update(WorkDurationBindingModel model);
bool Delete(WorkDurationBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.BusinessLogicsContracts
{
public interface IWorkLogic
{
List<WorkViewModel>? ReadList(WorkSearchModel? model);
WorkViewModel? ReadElement(WorkSearchModel? model);
bool Create(WorkBindingModel model);
bool Update(WorkBindingModel model);
bool Delete(WorkBindingModel 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="..\STODataModels\STODataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,10 @@
namespace STOContracts.SearchModels
{
public class CarSearchModel
{
public int? Id { get; set; }
public string? Brand { get; set; }
public string? Model { get; set; }
public string? VIN { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace STOContracts.SearchModels
{
public class EmployerSearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
public string? Email { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace STOContracts.SearchModels
{
public class MaintenanceSearchModel
{
public int? Id { get; set; }
public int? EmployerId { get; set; }
public double? Cost { get; set; }
public DateTime? Date { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace STOContracts.SearchModels
{
public class ServiceSearchModel
{
public int? Id { get; set; }
public string? ServiceDescription { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using STODataModels.Models;
namespace STOContracts.SearchModels
{
public class SpareSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public double? Price { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using STODataModels.Models;
namespace STOContracts.SearchModels
{
public class StorekeeperSearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
public string? Email { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using STODataModels.Models;
namespace STOContracts.SearchModels
{
public class WorkDurationSearchModel
{
public int? Id { get; set; }
public int? Duration { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using STODataModels.Models;
namespace STOContracts.SearchModels
{
public class WorkSearchModel
{
public int? Id { get; set; }
public string? Title { get; set; }
public double? Price { get; set; }
public int? StorekeeperId { get; set; }
public int? DurationId { get; set; }
public DateTime? DateTo { get; set; }
public DateTime? DateFrom { get; set; }
public Dictionary<int, (ISpareModel, int)>? WorkSpares { get; set; }
public Dictionary<int, (IMaintenanceModel, int)>? WorkMaintenances { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.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);
}
}

View File

@ -0,0 +1,16 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.StoragesContracts
{
public interface IEmployerStorage
{
List<EmployerViewModel> GetFullList();
List<EmployerViewModel> GetFilteredList(EmployerSearchModel model);
EmployerViewModel? GetElement(EmployerSearchModel model);
EmployerViewModel? Insert(EmployerBindingModel model);
EmployerViewModel? Update(EmployerBindingModel model);
EmployerViewModel? Delete(EmployerBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.StoragesContracts
{
public interface IMaintenanceStorage
{
List<MaintenanceViewModel> GetFullList();
List<MaintenanceViewModel> GetFilteredList(MaintenanceSearchModel model);
MaintenanceViewModel? GetElement(MaintenanceSearchModel model);
MaintenanceViewModel? Insert(MaintenanceBindingModel model);
MaintenanceViewModel? Update(MaintenanceBindingModel model);
MaintenanceViewModel? Delete(MaintenanceBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.StoragesContracts
{
public interface IServiceStorage
{
List<ServiceViewModel> GetFullList();
List<ServiceViewModel> GetFilteredList(ServiceSearchModel model);
ServiceViewModel? GetElement(ServiceSearchModel model);
ServiceViewModel? Insert(ServiceBindingModel model);
ServiceViewModel? Update(ServiceBindingModel model);
ServiceViewModel? Delete(ServiceBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.StoragesContracts
{
public interface ISpareStorage
{
List<SpareViewModel> GetFullList();
List<SpareViewModel> GetFilteredList(SpareSearchModel model);
SpareViewModel? GetElement(SpareSearchModel model);
SpareViewModel? Insert(SpareBindingModel model);
SpareViewModel? Update(SpareBindingModel model);
SpareViewModel? Delete(SpareBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.StoragesContracts
{
public interface IStorekeeperStorage
{
List<StorekeeperViewModel> GetFullList();
List<StorekeeperViewModel> GetFilteredList(StorekeeperSearchModel model);
StorekeeperViewModel? GetElement(StorekeeperSearchModel model);
StorekeeperViewModel? Insert(StorekeeperBindingModel model);
StorekeeperViewModel? Update(StorekeeperBindingModel model);
StorekeeperViewModel? Delete(StorekeeperBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.StoragesContracts
{
public interface IWorkDurationStorage
{
List<WorkDurationViewModel> GetFullList();
List<WorkDurationViewModel> GetFilteredList(WorkDurationSearchModel model);
WorkDurationViewModel? GetElement(WorkDurationSearchModel model);
WorkDurationViewModel? Insert(WorkDurationBindingModel model);
WorkDurationViewModel? Update(WorkDurationBindingModel model);
WorkDurationViewModel? Delete(WorkDurationBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using STOContracts.BindingModels;
using STOContracts.SearchModels;
using STOContracts.ViewModels;
namespace STOContracts.StoragesContracts
{
public interface IWorkStorage
{
List<WorkViewModel> GetFullList();
List<WorkViewModel> GetFilteredList(WorkSearchModel model);
WorkViewModel? GetElement(WorkSearchModel model);
WorkViewModel? Insert(WorkBindingModel model);
WorkViewModel? Update(WorkBindingModel model);
WorkViewModel? Delete(WorkBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class CarViewModel : ICarModel
{
public int Id { get; set; }
[DisplayName("Название бренда")]
public string Brand { get; set; } = string.Empty;
[DisplayName("Название модели")]
public string Model { get; set; } = string.Empty;
[DisplayName("VIN номер")]
public string VIN { get; set; } = string.Empty;
public Dictionary<int, (ISpareModel, int)> CarSpares { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class EmployerViewModel : IEmployerModel
{
public int Id { get; set; }
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
[DisplayName("Почта")]
public string Email { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,16 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class MaintenanceViewModel : IMaintenanceModel
{
public int Id { get; set; }
public int EmployerId { get; set; }
[DisplayName("Стоимость")]
public double Cost { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
public Dictionary<int, (ICarModel, int)> MaintenanceCars { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace STOContracts.ViewModels
{
public class ReportViewModel
{
public string Name { get; set; } = string.Empty;
public List<string> Spares { get; set; } = new();
}
}

View File

@ -0,0 +1,12 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class ServiceViewModel : IServiceModel
{
public int Id { get; set; }
[DisplayName("Описание сервиса")]
public string ServiceDescription { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class SpareViewModel : ISpareModel
{
public int Id { get; set; }
[DisplayName("Название")]
public string Name { get; set; } = String.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class StorekeeperViewModel : IStorekeeperModel
{
public int Id { get; set; }
[DisplayName("Логин")]
public string Login { get; set; } = String.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = String.Empty;
[DisplayName("Почта")]
public string Email { get; set; } = String.Empty;
}
}

View File

@ -0,0 +1,12 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class WorkDurationViewModel : IWorkDurationModel
{
public int Id { get; set; }
[DisplayName("Длительность")]
public int Duration { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using STODataModels.Models;
using System.ComponentModel;
namespace STOContracts.ViewModels
{
public class WorkViewModel : IWorkModel
{
public int Id { get; set; }
[DisplayName("Название")]
public string Title { get; set; } = String.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public int DurationId { get; set; }
public int StorekeeperId { get; set; }
public DateTime Date { get; set; } = DateTime.Now;
public Dictionary<int, (ISpareModel, int)> WorkSpares { get; set; } = new();
public Dictionary<int, (IMaintenanceModel, int)> WorkMaintences { get; set; } = new();
}
}