Слои модели данных и контракты(кроме SearchModels)

This commit is contained in:
sardq 2024-04-20 21:18:59 +04:00
parent 6c989354a8
commit d7e2bd5dff
29 changed files with 484 additions and 0 deletions

31
Factory.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FactoryDataModels", "FactoryDataModels\FactoryDataModels.csproj", "{CBE4843B-F023-4C97-925E-BEFE960D0EEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FactoryContracts", "FactoryContracts\FactoryContracts.csproj", "{87BA79A9-CF35-4CB4-98BD-86C01918C81C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CBE4843B-F023-4C97-925E-BEFE960D0EEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBE4843B-F023-4C97-925E-BEFE960D0EEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBE4843B-F023-4C97-925E-BEFE960D0EEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBE4843B-F023-4C97-925E-BEFE960D0EEA}.Release|Any CPU.Build.0 = Release|Any CPU
{87BA79A9-CF35-4CB4-98BD-86C01918C81C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87BA79A9-CF35-4CB4-98BD-86C01918C81C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87BA79A9-CF35-4CB4-98BD-86C01918C81C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87BA79A9-CF35-4CB4-98BD-86C01918C81C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8AB53DAE-273C-4081-BC52-E0656BEC52E5}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,15 @@
using FactoryDataModels.Models;
namespace FactoryContracts.BindingModels
{
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }
public string Login { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using FactoryDataModels.Models;
using FactoryDataModels.Enums;
namespace FactoryContracts.BindingModels
{
public class ExecutionPhaseBindingModel : IExecutionPhaseModel
{
public int Id { get; set; }
public string ImplementerFIO { get; set; } = string.Empty;
public ExecutionPhaseStatus Status { get; set; } = ExecutionPhaseStatus.Неизвестен;
public int ClientId { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using FactoryDataModels.Models;
namespace FactoryContracts.BindingModels
{
public class PlanProductionBindingModel : IPlanProductionModel
{
public int Id { get; set; }
public int ExecutionPhaseId { get; set; }
public int ClientId { get; set; }
public string ProductionName { get; set; } = string.Empty;
public int Count { get; set; }
public DateTime Term { get; set; }
public Dictionary<int, (IWorkpieceModel, int)> PlanProductionWorkpieces { get; set; } = new();
}
}

View File

@ -0,0 +1,17 @@
using FactoryDataModels.Models;
namespace FactoryContracts.BindingModels
{
public class WorkpieceBindingModel : IWorkpieceModel
{
public int Id { get; set; }
public int ClientId { get; set; }
public string WorkpieceName { get; set; } = string.Empty;
public string Material { get; set; } = string.Empty;
public double Cost { get; set; }
//public Dictionary<int, (IComponentModel, int)> WorkComponents { get; set; } = new();
}
}

View File

@ -0,0 +1,19 @@
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels;
namespace FactoryContracts.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,19 @@
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels;
namespace FactoryContracts.BusinessLogicsContracts
{
public interface IExecutionPhaseLogic
{
List<ExecutionPhaseViewModel>? ReadList(ExecutionPhaseSearchModel? model);
ExecutionPhaseViewModel? ReadElement(ExecutionPhaseSearchModel model);
bool Create(ExecutionPhaseBindingModel model);
bool Update(ExecutionPhaseBindingModel model);
bool Delete(ExecutionPhaseBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels;
namespace FactoryContracts.BusinessLogicsContracts
{
public interface IPlanProductionLogic
{
List<PlanProductionViewModel>? ReadList(PlanProductionSearchModel? model);
PlanProductionViewModel? ReadElement(PlanProductionSearchModel model);
bool CreatePlanProduction(PlanProductionBindingModel model);
bool TakePlanProductionInWork(PlanProductionBindingModel model);
bool FinishPlanProduction(PlanProductionBindingModel model);
bool DeliveryPlanProduction(PlanProductionBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels;
namespace FactoryContracts.BusinessLogicsContracts
{
public interface IWorkpieceLogic
{
List<WorkpieceViewModel>? ReadList(WorkpieceSearchModel? model);
WorkpieceViewModel? ReadElement(WorkpieceSearchModel model);
bool Create(WorkpieceBindingModel model);
bool Update(WorkpieceBindingModel model);
bool Delete(WorkpieceBindingModel 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="..\FactoryDataModels\FactoryDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,11 @@
namespace FactoryContracts.SearchModels
{
public class ClientSearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace FactoryContracts.SearchModels
{
public class ExecutionPhaseSearchModel
{
public int? Id { get; set; }
public string? ImplementerFIO { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using FactoryDataModels.Enums;
namespace FactoryContracts.SearchModels
{
public class PlanProductionSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace FactoryContracts.SearchModels
{
public class WorkpieceSearchModel
{
public int? Id { get; set; }
public string? WorkName { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using FactoryContracts.ViewModels;
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
namespace FactoryContracts.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,21 @@
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels;
namespace FactoryContracts.StoragesContracts
{
public interface IExecutionPhaseStorage
{
List<ExecutionPhaseViewModel> GetFullList();
List<ExecutionPhaseViewModel> GetFilteredList(ExecutionPhaseSearchModel model);
ExecutionPhaseViewModel? GetElement(ExecutionPhaseSearchModel model);
ExecutionPhaseViewModel? Insert(ExecutionPhaseBindingModel model);
ExecutionPhaseViewModel? Update(ExecutionPhaseBindingModel model);
ExecutionPhaseViewModel? Delete(ExecutionPhaseBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels;
namespace FactoryContracts.StoragesContracts
{
public interface IPlanProductionStorage
{
List<PlanProductionViewModel> GetFullList();
List<PlanProductionViewModel> GetFilteredList(PlanProductionSearchModel model);
PlanProductionViewModel? GetElement(PlanProductionSearchModel model);
PlanProductionViewModel? Insert(ExecutionPhaseBindingModel model);
PlanProductionViewModel? Update(ExecutionPhaseBindingModel model);
PlanProductionViewModel? Delete(ExecutionPhaseBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using FactoryContracts.BindingModels;
using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels;
namespace FactoryContracts.StoragesContracts
{
public interface IWorkpieceStorage
{
List<WorkpieceViewModel> GetFullList();
List<WorkpieceViewModel> GetFilteredList(WorkpieceSearchModel model);
WorkpieceViewModel? GetElement(WorkpieceSearchModel model);
WorkpieceViewModel? Insert(WorkpieceBindingModel model);
WorkpieceViewModel? Update(WorkpieceBindingModel model);
WorkpieceViewModel? Delete(WorkpieceBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using FactoryDataModels.Models;
using System.ComponentModel;
namespace FactoryContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Электронная почта")]
public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,21 @@
using FactoryDataModels.Enums;
using FactoryDataModels.Models;
using System.ComponentModel;
namespace FactoryContracts.ViewModels
{
public class ExecutionPhaseViewModel : IExecutionPhaseModel
{
public int Id { get; set; }
[DisplayName("ФИО исполнителя")]
public string ImplementerFIO { get; set; } = string.Empty;
[DisplayName("Статус этапа")]
public ExecutionPhaseStatus Status { get; set; } = ExecutionPhaseStatus.Неизвестен;
[DisplayName("Номер клиента")]
public int ClientId { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using FactoryDataModels.Enums;
using FactoryDataModels.Models;
using System.ComponentModel;
namespace FactoryContracts.ViewModels
{
public class PlanProductionViewModel : IPlanProductionModel
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Номер этапа выполнения")]
public int ExecutionPhaseId { get; set; }
[DisplayName("Этап выполнения")]
public ExecutionPhaseStatus ExecutionPhase { get; set; } = ExecutionPhaseStatus.Неизвестен;
[DisplayName("Номер клиента")]
public int ClientId { get; set; }
[DisplayName("Наименование")]
public string ProductionName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }
[DisplayName("Срок выполнения")]
public DateTime Term { get; set; }
[DisplayName("Заготовки")]
public Dictionary<int, (IWorkpieceModel, int)> PlanProductionWorkpieces { get; set; } = new();
}
}

View File

@ -0,0 +1,22 @@
using FactoryDataModels.Models;
using System.ComponentModel;
namespace FactoryContracts.ViewModels
{
public class WorkpieceViewModel : IWorkpieceModel
{
public int Id { get; set; }
[DisplayName("Название заготовки")]
public string WorkpieceName { get; set; } = string.Empty;
[DisplayName("Материал")]
public string Material { get; set; } = string.Empty;
[DisplayName("Название заготовки")]
public double Cost { get; set; }
[DisplayName("Номер клиента")]
public int ClientId { get; set; }
//[DisplayName("Изделия")]
//public Dictionary<int, (IProductModel, int)> WorkpieceProducts { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
namespace FactoryDataModels.Enums
{
public enum ExecutionPhaseStatus
{
Неизвестен = -1,
Принят = 0,
Выполняется = 1,
Готов = 2,
Выдан = 3
}
}

View File

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

7
FactoryDataModels/IId.cs Normal file
View File

@ -0,0 +1,7 @@
namespace FactoryDataModels
{
public interface IId
{
int Id { get; }
}
}

View File

@ -0,0 +1,11 @@
namespace FactoryDataModels.Models
{
public interface IClientModel : IId
{
string Login { get; }
string Email { get; }
string Password { get; }
}
}

View File

@ -0,0 +1,12 @@

using FactoryDataModels.Enums;
namespace FactoryDataModels.Models
{
public interface IExecutionPhaseModel : IId
{
string ImplementerFIO { get; }
ExecutionPhaseStatus Status { get; }
int ClientId { get; }
}
}

View File

@ -0,0 +1,16 @@
namespace FactoryDataModels.Models
{
public interface IPlanProductionModel : IId
{
int ExecutionPhaseId { get; }
int ClientId { get; }
string ProductionName { get; }
int Count { get; }
DateTime Term { get; }
Dictionary<int, (IWorkpieceModel, int)> PlanProductionWorkpieces { get; }
}
}

View File

@ -0,0 +1,15 @@
namespace FactoryDataModels.Models
{
public interface IWorkpieceModel : IId
{
string WorkpieceName { get; }
string Material { get; }
double Cost { get; }
int ClientId { get; }
//Dictionary<int, (IProductModel, int)> WorkpieceProducts { get; }
}
}