Реализован проект Contracts

This commit is contained in:
Никита Потапов 2024-02-25 18:57:38 +04:00
parent fc59da0008
commit fb38ed9959
16 changed files with 210 additions and 5 deletions

View File

@ -0,0 +1,11 @@
using SecuritySystemDataModels.Models;
namespace SecuritySystemContracts.BindingModels
{
public class ComponentBindingModel : IComponentModel
{
public int Id { get; set; }
public string ComponentName { get; set; } = string.Empty;
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using SecuritySystemDataModels.Enums;
using SecuritySystemDataModels.Models;
namespace SecuritySystemContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public int SecureId { get; set; }
public int Count { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using SecuritySystemDataModels.Models;
namespace SecuritySystemContracts.BindingModels
{
public class SecureBindingModel : ISecureModel
{
public int Id { get; set; }
public string SecureName { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> SecureComponents { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
using SecuritySystemContracts.BindingModels;
using SecuritySystemContracts.SearchModels;
using SecuritySystemContracts.ViewModels;
namespace SecuritySystemContracts.BusinessLogicsContracts
{
public interface IComponentLogic
{
List<ComponentViewModel>? ReadList(ComponentSearchModel? model);
ComponentViewModel? ReadElement(ComponentSearchModel model);
bool Create(ComponentBindingModel model);
bool Update(ComponentBindingModel model);
bool Delete(ComponentBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using SecuritySystemContracts.BindingModels;
using SecuritySystemContracts.SearchModels;
using SecuritySystemContracts.ViewModels;
namespace SecuritySystemContracts.BusinessLogicsContracts
{
public interface IOrderLogic
{
List<OrderViewModel>? ReadList(OrderSearchModel? model);
bool CreateOrder(OrderBindingModel model);
bool TakeOrderInWork(OrderBindingModel model);
bool FinishOrder(OrderBindingModel model);
bool DeliveryOrder(OrderBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using SecuritySystemContracts.BindingModels;
using SecuritySystemContracts.SearchModels;
using SecuritySystemContracts.ViewModels;
namespace SecuritySystemContracts.BusinessLogicsContracts
{
public interface ISecureLogic
{
List<SecureViewModel>? ReadList(SecureSearchModel? model);
SecureViewModel? ReadElement(SecureSearchModel model);
bool Create(SecureBindingModel model);
bool Update(SecureBindingModel model);
bool Delete(SecureBindingModel model);
}
}

View File

@ -0,0 +1,8 @@
namespace SecuritySystemContracts.SearchModels
{
public class ComponentSearchModel
{
public int? Id { get; set; }
public string? ComponentName { get; set; }
}
}

View File

@ -0,0 +1,7 @@
namespace SecuritySystemContracts.SearchModels
{
public class OrderSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace SecuritySystemContracts.SearchModels
{
public class SecureSearchModel
{
public int? Id { get; set; }
public string? SecureName { get; set; }
}
}

View File

@ -7,11 +7,7 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="BindingModels\" />
<Folder Include="SearchModels\" />
<Folder Include="ViewModels\" />
<Folder Include="BusinessLogicsContracts\" />
<Folder Include="StoragesContracts\" />
<ProjectReference Include="..\SecuritySystemDataModels\SecuritySystemDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,16 @@
using SecuritySystemContracts.BindingModels;
using SecuritySystemContracts.SearchModels;
using SecuritySystemContracts.ViewModels;
namespace SecuritySystemContracts.StoragesContracts
{
public interface IComponentStorage
{
List<ComponentViewModel> GetFullList();
List<ComponentViewModel> GetFilteredList(ComponentSearchModel model);
ComponentViewModel? GetElement(ComponentSearchModel model);
ComponentViewModel? Insert(ComponentBindingModel model);
ComponentViewModel? Update(ComponentBindingModel model);
ComponentViewModel? Delete(ComponentBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using SecuritySystemContracts.BindingModels;
using SecuritySystemContracts.SearchModels;
using SecuritySystemContracts.ViewModels;
namespace SecuritySystemContracts.StoragesContracts
{
public interface IOrderStorage
{
List<OrderViewModel> GetFullList();
List<OrderViewModel> GetFilteredList(OrderSearchModel model);
OrderViewModel? GetElement(OrderSearchModel model);
OrderViewModel? Insert(OrderBindingModel model);
OrderViewModel? Update(OrderBindingModel model);
OrderViewModel? Delete(OrderBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using SecuritySystemContracts.BindingModels;
using SecuritySystemContracts.SearchModels;
using SecuritySystemContracts.ViewModels;
namespace SecuritySystemContracts.StoragesContracts
{
public interface ISecureStorage
{
List<SecureViewModel> GetFullList();
List<SecureViewModel> GetFilteredList(SecureSearchModel model);
SecureViewModel? GetElement(SecureSearchModel model);
SecureViewModel? Insert(SecureBindingModel model);
SecureViewModel? Update(SecureBindingModel model);
SecureViewModel? Delete(SecureBindingModel model);
}
}

View File

@ -0,0 +1,14 @@
using SecuritySystemDataModels.Models;
using System.ComponentModel;
namespace SecuritySystemContracts.ViewModels
{
public class ComponentViewModel : IComponentModel
{
public int Id { get; set; }
[DisplayName("Название компонента")]
public string ComponentName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using SecuritySystemDataModels.Enums;
using SecuritySystemDataModels.Models;
using System.ComponentModel;
namespace SecuritySystemContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
public int SecureId { get; set; }
[DisplayName("Изделие")]
public string SecureName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }
[DisplayName("Сумма")]
public double Sum { get; set; }
[DisplayName("Статус")]
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using SecuritySystemDataModels.Models;
using System.ComponentModel;
namespace SecuritySystemContracts.ViewModels
{
public class SecureViewModel : ISecureModel
{
public int Id { get; set; }
[DisplayName("Название изделия")]
public string SecureName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> SecureComponents { get; set; } = new();
}
}