Правки в слое моделей и добавление слоя контрактов

This commit is contained in:
Табеев Александр 2024-04-21 15:33:17 +04:00
parent 1bdb28d01c
commit 948d0515be
37 changed files with 656 additions and 5 deletions

View File

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountingWarehouseProducts
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountingWarehouseProductsDataModels", "AccountingWarehouseProductsDataModels\AccountingWarehouseProductsDataModels.csproj", "{765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountingWarehouseProductsDataModels", "AccountingWarehouseProductsDataModels\AccountingWarehouseProductsDataModels.csproj", "{765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountingWarehouseProductsContracts", "AccountingWarehouseProductsContracts\AccountingWarehouseProductsContracts.csproj", "{4633456D-A979-41D6-9D0A-A6DAA6A17766}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -21,6 +23,10 @@ Global
{765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}.Debug|Any CPU.Build.0 = Debug|Any CPU {765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}.Release|Any CPU.ActiveCfg = Release|Any CPU {765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}.Release|Any CPU.Build.0 = Release|Any CPU {765B9DAD-2EB2-4C28-B6DD-4670807CB7DC}.Release|Any CPU.Build.0 = Release|Any CPU
{4633456D-A979-41D6-9D0A-A6DAA6A17766}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4633456D-A979-41D6-9D0A-A6DAA6A17766}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4633456D-A979-41D6-9D0A-A6DAA6A17766}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4633456D-A979-41D6-9D0A-A6DAA6A17766}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

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="..\AccountingWarehouseProductsDataModels\AccountingWarehouseProductsDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,20 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public DateTime? DateofOrder { get; set; }
public AccountingWarehouseProductsDataModels.Enums.OrderStatus Status { get; set; } = AccountingWarehouseProductsDataModels.Enums.OrderStatus.Неизвестен;
public Dictionary<int, (IProductModel, int)> OrderProducts { get; set; } = new();
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BindingModels
{
public class ProductBindingModel : IProductModel
{
public int Id { get; set; }
public string ProductName { get; set; } = string.Empty;
public double Cost { get; set; }
public DateTime? ExpirationDate { get; set; }
public string Category { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BindingModels
{
public class ShipmentBindingModel : IShipmentModel
{
public int Id { get; set; }
public DateTime ShipmentDate { get; set; }
public int Count { get; set; }
public string Recipient { get; set; } = string.Empty;
public int OrderId { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BindingModels
{
public class StandBindingModel : IStandModel
{
public int Id { get; set; }
public DateTime? DeliveryDate { get; set; }
public int Count { get; set; }
public int ProductId { get; set; }
public int SupplierId { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BindingModels
{
public class SupplierBindingModel : ISupplierModel
{
public int Id { get; set; }
public string SupplierName { get; set; } = string.Empty;
public string ContactPerson { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BindingModels
{
public class WarehouseBindingModel : IWarehouseModel
{
public int Id { get; set; }
public string WarehouseName { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty;
public int Capacity { get; set; }
public Dictionary<int, (IProductModel, int)> WarehouseProducts { get; set; } = new();
}
}

View File

@ -0,0 +1,27 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BusinessLogicsContracts
{
public interface IOrderLogic
{
List<OrderViewModel>? ReadList(OrderSearchModel? model);
OrderViewModel? ReadElement(OrderSearchModel model);
bool Create(OrderBindingModel model);
bool Update(OrderBindingModel model);
bool Delete(OrderBindingModel model);
bool OrderedOrder(OrderBindingModel model);
bool ComeOrder(OrderBindingModel model);
bool TakeOrder(OrderBindingModel model);
bool ArrangeOrder(OrderBindingModel model);
bool ChekOrder(OrderBindingModel model);
bool DeliverOrder(OrderBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BusinessLogicsContracts
{
public interface IProductLogic
{
List<ProductViewModel>? ReadList(ProductSearchModel? model);
ProductViewModel? ReadElement(ProductSearchModel model);
bool Create(ProductBindingModel model);
bool Update(ProductBindingModel model);
bool Delete(ProductBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BusinessLogicsContracts
{
public interface IShipmentLogic
{
List<ShipmentViewModel>? ReadList(ShipmentSearchModel? model);
ShipmentViewModel? ReadElement(ShipmentSearchModel model);
bool Create(ShipmentBindingModel model);
bool Update(ShipmentBindingModel model);
bool Delete(ShipmentBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BusinessLogicsContracts
{
public interface IStandLogic
{
List<StandViewModel>? ReadList(StandSearchModel? model);
StandViewModel? ReadElement(StandSearchModel model);
bool Create(StandBindingModel model);
bool Update(StandBindingModel model);
bool Delete(StandBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BusinessLogicsContracts
{
public interface ISupplierLogic
{
List<SupplierViewModel>? ReadList(SupplierSearchModel? model);
SupplierViewModel? ReadElement(SupplierSearchModel model);
bool Create(SupplierBindingModel model);
bool Update(SupplierBindingModel model);
bool Delete(SupplierBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.BusinessLogicsContracts
{
public interface IWarehouseLogic
{
List<WarehouseViewModel>? ReadList(WarehouseSearchModel? model);
WarehouseViewModel? ReadElement(WarehouseSearchModel model);
bool Create(WarehouseBindingModel model);
bool Update(WarehouseBindingModel model);
bool Delete(WarehouseBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.SearchModels
{
public class OrderSearchModel
{
public int? Id { 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 AccountingWarehouseProductsContracts.SearchModels
{
public class ProductSearchModel
{
public int? Id { get; set; }
public string? ProductName { 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 AccountingWarehouseProductsContracts.SearchModels
{
public class ShipmentSearchModel
{
public int? Id { get; set; }
public string? Recipient { 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 AccountingWarehouseProductsContracts.SearchModels
{
public class StandSearchModel
{
public int? Id { 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 AccountingWarehouseProductsContracts.SearchModels
{
public class SupplierSearchModel
{
public int? Id { get; set; }
public string? SupplierName { 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 AccountingWarehouseProductsContracts.SearchModels
{
public class WarehouseSearchModel
{
public int? Id { get; set; }
public string? WarehouseName { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.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,22 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.StoragesContracts
{
public interface IProductStorage
{
List<ProductViewModel> GetFullList();
List<ProductViewModel> GetFilteredList(ProductSearchModel model);
ProductViewModel? GetElement(ProductSearchModel model);
ProductViewModel? Insert(ProductBindingModel model);
ProductViewModel? Update(ProductBindingModel model);
ProductViewModel? Delete(ProductBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.StoragesContracts
{
public interface IShipmentStorage
{
List<ShipmentViewModel> GetFullList();
List<ShipmentViewModel> GetFilteredList(ShipmentSearchModel model);
ShipmentViewModel? GetElement(ShipmentSearchModel model);
ShipmentViewModel? Insert(ShipmentBindingModel model);
ShipmentViewModel? Update(ShipmentBindingModel model);
ShipmentViewModel? Delete(ShipmentBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.StoragesContracts
{
public interface IStandStorage
{
List<StandViewModel> GetFullList();
List<StandViewModel> GetFilteredList(StandSearchModel model);
StandViewModel? GetElement(StandSearchModel model);
StandViewModel? Insert(StandBindingModel model);
StandViewModel? Update(StandBindingModel model);
StandViewModel? Delete(StandBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.StoragesContracts
{
public interface ISupplierStorage
{
List<SupplierViewModel> GetFullList();
List<SupplierViewModel> GetFilteredList(SupplierSearchModel model);
SupplierViewModel? GetElement(SupplierSearchModel model);
SupplierViewModel? Insert(SupplierBindingModel model);
SupplierViewModel? Update(SupplierBindingModel model);
SupplierViewModel? Delete(SupplierBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.SearchModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.StoragesContracts
{
public interface IWarehouseStorage
{
List<WarehouseViewModel> GetFullList();
List<WarehouseViewModel> GetFilteredList(WarehouseSearchModel model);
WarehouseViewModel? GetElement(WarehouseSearchModel model);
WarehouseViewModel? Insert(WarehouseBindingModel model);
WarehouseViewModel? Update(WarehouseBindingModel model);
WarehouseViewModel? Delete(WarehouseBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Дата заказа")]
public DateTime? DateofOrder { get; set; }
[DisplayName("Статус заказа")]
public AccountingWarehouseProductsDataModels.Enums.OrderStatus Status { get; set; }
public Dictionary<int, (IProductModel, int)> OrderProducts { get; set; } = new();
}
}

View File

@ -0,0 +1,27 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.ViewModels
{
public class ProductViewModel : IProductModel
{
public int Id { get; set; }
[DisplayName("Название продукта")]
public string ProductName { get; set; } = string.Empty;
[DisplayName("Цена продукта")]
public double Cost { get; set; }
[DisplayName("Срок годности")]
public DateTime? ExpirationDate { get; set; }
[DisplayName("Категория")]
public string Category { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,27 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.ViewModels
{
public class ShipmentViewModel : IShipmentModel
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Дата отгрузки")]
public DateTime ShipmentDate { get; set; }
[DisplayName("Количество")]
public int Count { get; set; }
[DisplayName("Получатель")]
public string Recipient { get; set; } = string.Empty;
public int OrderId { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.ViewModels
{
public class StandViewModel : IStandModel
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Дата поставки")]
public DateTime? DeliveryDate { get; set; }
[DisplayName("Количество")]
public int Count { get; set; }
public int ProductId { get; set; }
public int SupplierId { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.ViewModels
{
public class SupplierViewModel : ISupplierModel
{
public int Id { get; set; }
[DisplayName("Название поставщика")]
public string SupplierName { get; set; } = string.Empty;
[DisplayName("Контактное лицо")]
public string ContactPerson { get; set; } = string.Empty;
[DisplayName("Номер телефона")]
public string Phone { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,26 @@
using AccountingWarehouseProductsDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsContracts.ViewModels
{
public class WarehouseViewModel : IWarehouseModel
{
public int Id { get; set; }
[DisplayName("Название склада")]
public string WarehouseName { get; set; } = string.Empty;
[DisplayName("Адрес")]
public string Address { get; set; } = string.Empty;
[DisplayName("Вместимость")]
public int Capacity { get; set; }
public Dictionary<int, (IProductModel, int)> WarehouseProducts { get; set; } = new();
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace AccountingWarehouseProductsDataModels.Enums namespace AccountingWarehouseProductsDataModels.Enums
{ {
public enum MovementProductStatus public enum OrderStatus
{ {
Неизвестен = -1, Неизвестен = -1,

View File

@ -10,7 +10,7 @@ namespace AccountingWarehouseProductsDataModels.Models
{ {
DateTime? DateofOrder { get; } DateTime? DateofOrder { get; }
string Status { get; } Enums.OrderStatus Status { get; }
Dictionary<int, (IProductModel, int)> OrderProducts { get; } Dictionary<int, (IProductModel, int)> OrderProducts { get; }
} }

View File

@ -8,7 +8,7 @@ namespace AccountingWarehouseProductsDataModels.Models
{ {
public interface IProductModel : IId public interface IProductModel : IId
{ {
string Name { get; } string ProductName { get; }
double Cost { get; } double Cost { get; }

View File

@ -8,7 +8,7 @@ namespace AccountingWarehouseProductsDataModels.Models
{ {
public interface ISupplierModel : IId public interface ISupplierModel : IId
{ {
string Name { get; } string SupplierName { get; }
string ContactPerson { get; } string ContactPerson { get; }

View File

@ -8,7 +8,7 @@ namespace AccountingWarehouseProductsDataModels.Models
{ {
public interface IWarehouseModel : IId public interface IWarehouseModel : IId
{ {
string Name { get; } string WarehouseName { get; }
string Address { get; } string Address { get; }