модели и контракты

This commit is contained in:
Галина Федоренко 2024-05-10 14:18:31 +04:00
parent 39766d4c81
commit 83fbbb0289
39 changed files with 538 additions and 0 deletions

49
Storehouse/Storehouse.sln Normal file
View File

@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StorehouseView", "StorehouseView\StorehouseView.csproj", "{2A1C5191-CC20-4015-82E3-AEF00D33C09A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StorehouseDataModels", "StorehouseDataModels\StorehouseDataModels.csproj", "{B1D926C1-F37C-4530-A3C0-02EAC8113B3E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StorehouseContracts", "StorehouseContracts\StorehouseContracts.csproj", "{D5258E85-B904-4299-A07D-1F55B71DB0F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StorehouseBusinessLogics", "StorehouseBusinessLogics\StorehouseBusinessLogics.csproj", "{3F171169-DA8D-4CE6-B100-BDD3A4FEDA77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StorehouseDatabase", "StorehouseDatabase\StorehouseDatabase.csproj", "{F2EA8A47-C7B6-4C2B-8AD0-0F3C0C24DF74}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A1C5191-CC20-4015-82E3-AEF00D33C09A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A1C5191-CC20-4015-82E3-AEF00D33C09A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A1C5191-CC20-4015-82E3-AEF00D33C09A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A1C5191-CC20-4015-82E3-AEF00D33C09A}.Release|Any CPU.Build.0 = Release|Any CPU
{B1D926C1-F37C-4530-A3C0-02EAC8113B3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1D926C1-F37C-4530-A3C0-02EAC8113B3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1D926C1-F37C-4530-A3C0-02EAC8113B3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1D926C1-F37C-4530-A3C0-02EAC8113B3E}.Release|Any CPU.Build.0 = Release|Any CPU
{D5258E85-B904-4299-A07D-1F55B71DB0F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5258E85-B904-4299-A07D-1F55B71DB0F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5258E85-B904-4299-A07D-1F55B71DB0F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5258E85-B904-4299-A07D-1F55B71DB0F8}.Release|Any CPU.Build.0 = Release|Any CPU
{3F171169-DA8D-4CE6-B100-BDD3A4FEDA77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F171169-DA8D-4CE6-B100-BDD3A4FEDA77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F171169-DA8D-4CE6-B100-BDD3A4FEDA77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F171169-DA8D-4CE6-B100-BDD3A4FEDA77}.Release|Any CPU.Build.0 = Release|Any CPU
{F2EA8A47-C7B6-4C2B-8AD0-0F3C0C24DF74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2EA8A47-C7B6-4C2B-8AD0-0F3C0C24DF74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2EA8A47-C7B6-4C2B-8AD0-0F3C0C24DF74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2EA8A47-C7B6-4C2B-8AD0-0F3C0C24DF74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1ED68645-6072-459C-B84E-8E3AD572EBFA}
EndGlobalSection
EndGlobal

View File

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

View File

@ -0,0 +1,12 @@
using StorehouseDataModels.Models;
namespace StorehouseContracts.BindingModels
{
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }
public string ClientFIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,13 @@
using StorehouseDataModels.Enums;
using StorehouseDataModels.Models;
namespace StorehouseContracts.BindingModels
{
public class ProductBindingModel : IProductModel
{
public int Id { get; set; }
public string ProductName { get; set; } = string.Empty;
public int ProductNum { get; set; }
public ProductType ProductType { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using StorehouseDataModels.Models;
namespace StorehouseContracts.BindingModels
{
public class ProviderBindingModel : IProviderModel
{
public int Id { get; set; }
public string ProviderFIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,12 @@
using StorehouseDataModels.Models;
namespace StorehouseContracts.BindingModels
{
public class SaleBindingModel : ISaleModel
{
public int Id { get; set; }
public int ClientId { get; set; }
public int ProductId { get; set; }
public int SaleNum { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using StorehouseDataModels.Models;
namespace StorehouseContracts.BindingModels
{
public class SupplyBindingModel : ISupplyModel
{
public int Id { get; set; }
public int ProviderId { get; set; }
public int ProductId { get; set; }
public int SupplyNum { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.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,15 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.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,15 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.BusinessLogicsContracts
{
public interface IProviderLogic
{
List<ProviderViewModel>? ReadList(ProviderSearchModel? model);
ProviderViewModel? ReadElement(ProviderSearchModel model);
bool Create(ProviderBindingModel model);
bool Update(ProviderBindingModel model);
bool Delete(ProviderBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.BusinessLogicsContracts
{
public interface ISaleLogic
{
List<SaleViewModel>? ReadList(SaleSearchModel? model);
SaleViewModel? ReadElement(SaleSearchModel model);
bool Create(SaleBindingModel model);
bool Update(SaleBindingModel model);
bool Delete(SaleBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.BusinessLogicsContracts
{
public interface ISupplyLogic
{
List<SupplyViewModel>? ReadList(SupplySearchModel? model);
SupplyViewModel? ReadElement(SupplySearchModel model);
bool Create(SupplyBindingModel model);
bool Update(SupplyBindingModel model);
bool Delete(SupplyBindingModel model);
}
}

View File

@ -0,0 +1,10 @@
namespace StorehouseContracts.SearchModels
{
public class ClientSearchModel
{
public int? Id { get; set; }
public string? ClientFIO { get; set; }
public string? Email { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace StorehouseContracts.SearchModels
{
public class ProductSearchModel
{
public int? Id { get; set; }
public string? ProductName { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace StorehouseContracts.SearchModels
{
public class ProviderSearchModel
{
public int? Id { get; set; }
public string? ProviderFIO { get; set; }
public string? Email { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace StorehouseContracts.SearchModels
{
public class SaleSearchModel
{
public int? Id { get; set; }
public int? ClientId { get; set; }
public int? ProductId { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace StorehouseContracts.SearchModels
{
public class SupplySearchModel
{
public int? Id { get; set; }
public int? ProviderId { get; set; }
public int? ProductId { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.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,16 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.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,16 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.StoragesContracts
{
public interface IProviderStorage
{
List<ProviderViewModel> GetFullList();
List<ProviderViewModel> GetFilteredList(ProviderSearchModel model);
ProviderViewModel? GetElement(ProviderSearchModel model);
ProviderViewModel? Insert(ProviderBindingModel model);
ProviderViewModel? Update(ProviderBindingModel model);
ProviderViewModel? Delete(ProviderBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.StoragesContracts
{
public interface ISaleStorage
{
List<SaleViewModel> GetFullList();
List<SaleViewModel> GetFilteredList(SaleSearchModel model);
SaleViewModel? GetElement(SaleSearchModel model);
SaleViewModel? Insert(SaleBindingModel model);
SaleViewModel? Update(SaleBindingModel model);
SaleViewModel? Delete(SaleBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using StorehouseContracts.BindingModels;
using StorehouseContracts.SearchModels;
using StorehouseContracts.ViewModels;
namespace StorehouseContracts.StoragesContracts
{
public interface ISupplyStorage
{
List<SupplyViewModel> GetFullList();
List<SupplyViewModel> GetFilteredList(SupplySearchModel model);
SupplyViewModel? GetElement(SupplySearchModel model);
SupplyViewModel? Insert(SupplyBindingModel model);
SupplyViewModel? Update(SupplyBindingModel model);
SupplyViewModel? Delete(SupplyBindingModel 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="..\StorehouseDataModels\StorehouseDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,16 @@
using StorehouseDataModels.Models;
using System.ComponentModel;
namespace StorehouseContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
[DisplayName("Client's FIO")]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Login (Email)")]
public string Email { get; set; } = string.Empty;
[DisplayName("Password")]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,17 @@
using StorehouseDataModels.Enums;
using StorehouseDataModels.Models;
using System.ComponentModel;
namespace StorehouseContracts.ViewModels
{
public class ProductViewModel : IProductModel
{
public int Id { get; set; }
[DisplayName("Product Name")]
public string ProductName { get; set; } = string.Empty;
[DisplayName("Type Product")]
public ProductType ProductType { get; set; }
[DisplayName("Num")]
public int ProductNum { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using StorehouseDataModels.Models;
using System.ComponentModel;
namespace StorehouseContracts.ViewModels
{
public class ProviderViewModel : IProviderModel
{
public int Id { get; set; }
[DisplayName("Provider's FIO")]
public string ProviderFIO { get; set; } = string.Empty;
[DisplayName("Login (Email)")]
public string Email { get; set; } = string.Empty;
[DisplayName("Password")]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,18 @@
using StorehouseDataModels.Models;
using System.ComponentModel;
namespace StorehouseContracts.ViewModels
{
public class SaleViewModel : ISaleModel
{
public int Id { get; set; }
public int ClientId { get; set; }
[DisplayName("Client")]
public string ClientFIO { get; set; } = string.Empty;
public int ProductId { get; set; }
[DisplayName("Product")]
public string ProductName { get; set; } = string.Empty;
[DisplayName("Num")]
public int SaleNum { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using StorehouseDataModels.Models;
using System.ComponentModel;
namespace StorehouseContracts.ViewModels
{
public class SupplyViewModel : ISupplyModel
{
public int Id { get; set; }
public int ProviderId { get; set; }
[DisplayName("Provider")]
public string ProviderFIO { get; set; } = string.Empty;
public int ProductId { get; set; }
[DisplayName("Product")]
public string ProductName { get; set; } = string.Empty;
[DisplayName("Num")]
public int SupplyNum { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace StorehouseDataModels.Enums
{
public enum ProductType
{
Неизвестен = -1,
Одежда = 0,
Обувь = 1,
Техника = 2,
Гигиена = 3
}
}

View File

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

View File

@ -0,0 +1,9 @@
namespace StorehouseDataModels.Models
{
public interface IClientModel : IId
{
string ClientFIO { get; }
string Email { get; }
string Password { get; }
}
}

View File

@ -0,0 +1,16 @@
using StorehouseDataModels.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StorehouseDataModels.Models
{
public interface IProductModel : IId
{
string ProductName { get; }
int ProductNum { get; }
ProductType ProductType { get; }
}
}

View File

@ -0,0 +1,9 @@
namespace StorehouseDataModels.Models
{
public interface IProviderModel : IId
{
string ProviderFIO { get; }
string Email { get; }
string Password { get; }
}
}

View File

@ -0,0 +1,9 @@
namespace StorehouseDataModels.Models
{
public interface ISaleModel : IId
{
int ClientId { get; set; }
int ProductId { get; set; }
int SaleNum { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace StorehouseDataModels.Models
{
public interface ISupplyModel : IId
{
int ProviderId { get; set; }
int ProductId { get; set; }
int SupplyNum { get; set; }
}
}

View File

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

View File

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

View File

@ -0,0 +1,17 @@
namespace StorehouseView
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>