From 40971f299745b9a63d4a9940b62b9e6c3faf4071 Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Sun, 27 Oct 2024 15:16:44 +0300
Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BD=D1=83=D1=82=D1=80=D0=B5=D0=BD?=
=?UTF-8?q?=D0=BD=D1=8F=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BusinessLogics.csproj} | 5 +-
.../BusinessLogics/ProductLogic.cs | 103 ++++++++++++++++++
.../BindingModels/ProductBindingModel.cs | 19 ++++
.../BusinessLogicContracts/IProductLogic.cs | 20 ++++
WinFormsLibrary1/Contracts/Contracts.csproj | 14 +++
.../SearchModels/ProductSearchModel.cs | 16 +++
.../StorageContracts/IProductStorage.cs | 21 ++++
.../Contracts/ViewModels/ProductViewModel.cs | 24 ++++
.../DatabaseImplement/Database.cs | 15 +++
.../DatabaseImplement.csproj | 23 ++++
.../Implements/ProductStorage.cs | 78 +++++++++++++
.../20241027113242_InitialCreate.Designer.cs | 56 ++++++++++
.../20241027113242_InitialCreate.cs | 38 +++++++
.../Migrations/DatabaseModelSnapshot.cs | 53 +++++++++
.../DatabaseImplement/Models/Product.cs | 64 +++++++++++
WinFormsLibrary1/Models/Enums/Category.cs | 20 ++++
WinFormsLibrary1/Models/IId.cs | 7 ++
WinFormsLibrary1/Models/Models.csproj | 10 ++
.../Models/Models/IProductModel.cs | 17 +++
WinFormsLibrary1/WinFormsApp1/Forms.csproj | 28 +++++
WinFormsLibrary1/WinFormsLibrary1.sln | 28 ++++-
...FormsLibrary1.csproj => Components.csproj} | 1 +
22 files changed, 655 insertions(+), 5 deletions(-)
rename WinFormsLibrary1/{WinFormsApp1/WinFormsApp1.csproj => Businesslogic/BusinessLogics.csproj} (69%)
create mode 100644 WinFormsLibrary1/Businesslogic/BusinessLogics/ProductLogic.cs
create mode 100644 WinFormsLibrary1/Contracts/BindingModels/ProductBindingModel.cs
create mode 100644 WinFormsLibrary1/Contracts/BusinessLogicContracts/IProductLogic.cs
create mode 100644 WinFormsLibrary1/Contracts/Contracts.csproj
create mode 100644 WinFormsLibrary1/Contracts/SearchModels/ProductSearchModel.cs
create mode 100644 WinFormsLibrary1/Contracts/StorageContracts/IProductStorage.cs
create mode 100644 WinFormsLibrary1/Contracts/ViewModels/ProductViewModel.cs
create mode 100644 WinFormsLibrary1/DatabaseImplement/Database.cs
create mode 100644 WinFormsLibrary1/DatabaseImplement/DatabaseImplement.csproj
create mode 100644 WinFormsLibrary1/DatabaseImplement/Implements/ProductStorage.cs
create mode 100644 WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.Designer.cs
create mode 100644 WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.cs
create mode 100644 WinFormsLibrary1/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs
create mode 100644 WinFormsLibrary1/DatabaseImplement/Models/Product.cs
create mode 100644 WinFormsLibrary1/Models/Enums/Category.cs
create mode 100644 WinFormsLibrary1/Models/IId.cs
create mode 100644 WinFormsLibrary1/Models/Models.csproj
create mode 100644 WinFormsLibrary1/Models/Models/IProductModel.cs
create mode 100644 WinFormsLibrary1/WinFormsApp1/Forms.csproj
rename WinFormsLibrary1/WinFormsLibrary1/{WinFormsLibrary1.csproj => Components.csproj} (86%)
diff --git a/WinFormsLibrary1/WinFormsApp1/WinFormsApp1.csproj b/WinFormsLibrary1/Businesslogic/BusinessLogics.csproj
similarity index 69%
rename from WinFormsLibrary1/WinFormsApp1/WinFormsApp1.csproj
rename to WinFormsLibrary1/Businesslogic/BusinessLogics.csproj
index 3e8ed13..1dcfeab 100644
--- a/WinFormsLibrary1/WinFormsApp1/WinFormsApp1.csproj
+++ b/WinFormsLibrary1/Businesslogic/BusinessLogics.csproj
@@ -1,7 +1,6 @@
- WinExe
net8.0-windows
enable
true
@@ -9,7 +8,7 @@
-
+
-
\ No newline at end of file
+
diff --git a/WinFormsLibrary1/Businesslogic/BusinessLogics/ProductLogic.cs b/WinFormsLibrary1/Businesslogic/BusinessLogics/ProductLogic.cs
new file mode 100644
index 0000000..46e23a0
--- /dev/null
+++ b/WinFormsLibrary1/Businesslogic/BusinessLogics/ProductLogic.cs
@@ -0,0 +1,103 @@
+using Contracts.BindingModels;
+using Contracts.BusinessLogicContracts;
+using Contracts.SearchModels;
+using Contracts.StorageContracts;
+using Contracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BusinessLogics.BusinessLogics
+{
+ public class ProductLogic : IProductLogic
+ {
+ private readonly IProductStorage _productStorage;
+
+ public ProductLogic(IProductStorage productStorage)
+ {
+ _productStorage = productStorage;
+ }
+
+ public List ReadList(ProductSearchModel? model)
+ {
+ var list = model == null ? _productStorage.GetFullList() : _productStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ return null;
+ }
+ return list;
+ }
+
+ public ProductViewModel ReadElement(ProductSearchModel? model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _productStorage.GetElement(model);
+
+ if (element == null)
+ {
+ return null;
+ }
+ return element;
+ }
+ public bool Create(ProductBindingModel model)
+ {
+ CheckModel(model);
+ if (_productStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Update(ProductBindingModel model)
+ {
+ CheckModel(model);
+ if (_productStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(ProductBindingModel model)
+ {
+ CheckModel(model, false);
+ if (_productStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(ProductBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.Name))
+ {
+ throw new ArgumentException("Введите название продукта", nameof(model.Name));
+ }
+ if (string.IsNullOrEmpty(model.Description))
+ {
+ throw new ArgumentException("Введите описание продукта", nameof(model.Description));
+ }
+ if (model.Category == null)
+ {
+ throw new ArgumentException("Введите категорию продукта", nameof(model.Category));
+ }
+ if (model.CountOnStorage < 0)
+ {
+ throw new ArgumentException("Укажите валидное число продукта на складе", nameof(model.CountOnStorage));
+ }
+ }
+ }
+}
diff --git a/WinFormsLibrary1/Contracts/BindingModels/ProductBindingModel.cs b/WinFormsLibrary1/Contracts/BindingModels/ProductBindingModel.cs
new file mode 100644
index 0000000..aecda91
--- /dev/null
+++ b/WinFormsLibrary1/Contracts/BindingModels/ProductBindingModel.cs
@@ -0,0 +1,19 @@
+using Models.Enums;
+using Models.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.BindingModels
+{
+ public class ProductBindingModel : IProductModel
+ {
+ public int Id { get; set; }
+ public string Name { get; set; } = string.Empty;
+ public string Description { get; set; } = string.Empty;
+ public Category Category { get; set; }
+ public int CountOnStorage { get; set; }
+ }
+}
diff --git a/WinFormsLibrary1/Contracts/BusinessLogicContracts/IProductLogic.cs b/WinFormsLibrary1/Contracts/BusinessLogicContracts/IProductLogic.cs
new file mode 100644
index 0000000..34c0337
--- /dev/null
+++ b/WinFormsLibrary1/Contracts/BusinessLogicContracts/IProductLogic.cs
@@ -0,0 +1,20 @@
+using Contracts.BindingModels;
+using Contracts.SearchModels;
+using Contracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.BusinessLogicContracts
+{
+ public interface IProductLogic
+ {
+ List? ReadList(ProductSearchModel? model);
+ ProductViewModel? ReadElement(ProductSearchModel? model);
+ bool Create(ProductBindingModel model);
+ bool Update(ProductBindingModel model);
+ bool Delete(ProductBindingModel model);
+ }
+}
diff --git a/WinFormsLibrary1/Contracts/Contracts.csproj b/WinFormsLibrary1/Contracts/Contracts.csproj
new file mode 100644
index 0000000..c7c2625
--- /dev/null
+++ b/WinFormsLibrary1/Contracts/Contracts.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
diff --git a/WinFormsLibrary1/Contracts/SearchModels/ProductSearchModel.cs b/WinFormsLibrary1/Contracts/SearchModels/ProductSearchModel.cs
new file mode 100644
index 0000000..e405b00
--- /dev/null
+++ b/WinFormsLibrary1/Contracts/SearchModels/ProductSearchModel.cs
@@ -0,0 +1,16 @@
+using Models.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.SearchModels
+{
+ public class ProductSearchModel
+ {
+ public int? Id { get; set; }
+ public string? Name { get; set; }
+ public Category? Category { get; set; }
+ }
+}
diff --git a/WinFormsLibrary1/Contracts/StorageContracts/IProductStorage.cs b/WinFormsLibrary1/Contracts/StorageContracts/IProductStorage.cs
new file mode 100644
index 0000000..fb8ef6b
--- /dev/null
+++ b/WinFormsLibrary1/Contracts/StorageContracts/IProductStorage.cs
@@ -0,0 +1,21 @@
+using Contracts.BindingModels;
+using Contracts.SearchModels;
+using Contracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.StorageContracts
+{
+ public interface IProductStorage
+ {
+ List GetFullList();
+ List GetFilteredList(ProductSearchModel model);
+ ProductViewModel? GetElement(ProductSearchModel model);
+ ProductViewModel? Insert(ProductBindingModel model);
+ ProductViewModel? Update(ProductBindingModel model);
+ ProductViewModel? Delete(ProductBindingModel model);
+ }
+}
diff --git a/WinFormsLibrary1/Contracts/ViewModels/ProductViewModel.cs b/WinFormsLibrary1/Contracts/ViewModels/ProductViewModel.cs
new file mode 100644
index 0000000..d75dbd9
--- /dev/null
+++ b/WinFormsLibrary1/Contracts/ViewModels/ProductViewModel.cs
@@ -0,0 +1,24 @@
+using Models.Enums;
+using Models.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.ViewModels
+{
+ public class ProductViewModel : IProductModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название")]
+ public string Name { get; set; } = string.Empty;
+ [DisplayName("Описание")]
+ public string Description { get; set; } = string.Empty;
+ [DisplayName("Категория продукта")]
+ public Category Category { get; set; }
+ [DisplayName("Количество товаров на складе")]
+ public int CountOnStorage { get; set; }
+ }
+}
diff --git a/WinFormsLibrary1/DatabaseImplement/Database.cs b/WinFormsLibrary1/DatabaseImplement/Database.cs
new file mode 100644
index 0000000..6341781
--- /dev/null
+++ b/WinFormsLibrary1/DatabaseImplement/Database.cs
@@ -0,0 +1,15 @@
+using DatabaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace DatabaseImplement
+{
+ public class Database : DbContext
+ {
+ public DbSet Products { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=kop;Username=postgres;Password=postgres");
+ }
+ }
+}
diff --git a/WinFormsLibrary1/DatabaseImplement/DatabaseImplement.csproj b/WinFormsLibrary1/DatabaseImplement/DatabaseImplement.csproj
new file mode 100644
index 0000000..8492a73
--- /dev/null
+++ b/WinFormsLibrary1/DatabaseImplement/DatabaseImplement.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
diff --git a/WinFormsLibrary1/DatabaseImplement/Implements/ProductStorage.cs b/WinFormsLibrary1/DatabaseImplement/Implements/ProductStorage.cs
new file mode 100644
index 0000000..d3d220b
--- /dev/null
+++ b/WinFormsLibrary1/DatabaseImplement/Implements/ProductStorage.cs
@@ -0,0 +1,78 @@
+using Contracts.BindingModels;
+using Contracts.SearchModels;
+using Contracts.StorageContracts;
+using Contracts.ViewModels;
+using DatabaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DatabaseImplement.Implements
+{
+ public class ProductStorage : IProductStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new Database();
+ return context.Products.Select(x => x.GetViewModel).ToList();
+ }
+
+ public List GetFilteredList(ProductSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.Name))
+ {
+ return new();
+ }
+ using var context = new Database();
+ return context.Products
+ .Where(x => x.Name == model.Name)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public ProductViewModel? GetElement(ProductSearchModel model)
+ {
+ if (!model.Id.HasValue)
+ {
+ return null;
+ }
+ using var context = new Database();
+ return context.Products.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ }
+
+ public ProductViewModel? Insert(ProductBindingModel model)
+ {
+ var newProvider = Product.Create(model);
+ if (newProvider == null) return null;
+ using var context = new Database();
+ context.Products.Add(newProvider);
+ context.SaveChanges();
+ return newProvider.GetViewModel;
+ }
+
+ public ProductViewModel? Update(ProductBindingModel model)
+ {
+ using var context = new Database();
+ var provider = context.Products.FirstOrDefault(x => x.Id == model.Id);
+ if (provider == null) return null;
+ provider.Update(model);
+ context.SaveChanges();
+ return provider.GetViewModel;
+ }
+
+ public ProductViewModel? Delete(ProductBindingModel model)
+ {
+ using var context = new Database();
+ var element = context.Products.FirstOrDefault(x => x.Id == model.Id);
+ if (element != null)
+ {
+ context.Products.Remove(element);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+ return null;
+ }
+ }
+}
diff --git a/WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.Designer.cs b/WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.Designer.cs
new file mode 100644
index 0000000..671b29e
--- /dev/null
+++ b/WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.Designer.cs
@@ -0,0 +1,56 @@
+//
+using DatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace DatabaseImplement.Migrations
+{
+ [DbContext(typeof(Database))]
+ [Migration("20241027113242_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("DatabaseImplement.Models.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Category")
+ .HasColumnType("integer");
+
+ b.Property("CountOnStorage")
+ .HasColumnType("integer");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Products");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.cs b/WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.cs
new file mode 100644
index 0000000..a432bf2
--- /dev/null
+++ b/WinFormsLibrary1/DatabaseImplement/Migrations/20241027113242_InitialCreate.cs
@@ -0,0 +1,38 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace DatabaseImplement.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Products",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ Description = table.Column(type: "text", nullable: false),
+ Category = table.Column(type: "integer", nullable: false),
+ CountOnStorage = table.Column(type: "integer", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Products", x => x.Id);
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Products");
+ }
+ }
+}
diff --git a/WinFormsLibrary1/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs b/WinFormsLibrary1/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs
new file mode 100644
index 0000000..c5415f3
--- /dev/null
+++ b/WinFormsLibrary1/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs
@@ -0,0 +1,53 @@
+//
+using DatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace DatabaseImplement.Migrations
+{
+ [DbContext(typeof(Database))]
+ partial class DatabaseModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("DatabaseImplement.Models.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Category")
+ .HasColumnType("integer");
+
+ b.Property("CountOnStorage")
+ .HasColumnType("integer");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Products");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/WinFormsLibrary1/DatabaseImplement/Models/Product.cs b/WinFormsLibrary1/DatabaseImplement/Models/Product.cs
new file mode 100644
index 0000000..f9bbd2e
--- /dev/null
+++ b/WinFormsLibrary1/DatabaseImplement/Models/Product.cs
@@ -0,0 +1,64 @@
+using Contracts.BindingModels;
+using Contracts.ViewModels;
+using Models.Enums;
+using Models.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DatabaseImplement.Models
+{
+ public class Product : IProductModel
+ {
+ public int Id { get; private set; }
+
+ [Required]
+ public string Name { get; private set; } = string.Empty;
+
+ [Required]
+ public string Description { get; private set; } = string.Empty;
+
+ [Required]
+ public Category Category { get; private set; }
+
+ [Required]
+ public int CountOnStorage { get; private set; }
+
+ public static Product? Create(ProductBindingModel model)
+ {
+ if (model == null) return null;
+
+ return new Product
+ {
+ Id = model.Id,
+ Name = model.Name,
+ Description = model.Description,
+ Category = model.Category,
+ CountOnStorage = model.CountOnStorage,
+ };
+ }
+
+ public void Update(ProductBindingModel model)
+ {
+ if (model == null) return;
+
+ Name = model.Name;
+ Description = model.Description;
+ Category = model.Category;
+ CountOnStorage = model.CountOnStorage;
+ }
+
+ public ProductViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Name = Name,
+ Description = Description,
+ Category = Category,
+ CountOnStorage = CountOnStorage,
+ };
+ }
+}
diff --git a/WinFormsLibrary1/Models/Enums/Category.cs b/WinFormsLibrary1/Models/Enums/Category.cs
new file mode 100644
index 0000000..0d481b9
--- /dev/null
+++ b/WinFormsLibrary1/Models/Enums/Category.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Models.Enums
+{
+ public enum Category
+ {
+ None,
+ Food,
+ Clothes,
+ House,
+ Health,
+ Technic,
+ Gift,
+ Sport
+ }
+}
diff --git a/WinFormsLibrary1/Models/IId.cs b/WinFormsLibrary1/Models/IId.cs
new file mode 100644
index 0000000..eab9233
--- /dev/null
+++ b/WinFormsLibrary1/Models/IId.cs
@@ -0,0 +1,7 @@
+namespace Models
+{
+ public interface IId
+ {
+ int Id { get;}
+ }
+}
diff --git a/WinFormsLibrary1/Models/Models.csproj b/WinFormsLibrary1/Models/Models.csproj
new file mode 100644
index 0000000..3e210aa
--- /dev/null
+++ b/WinFormsLibrary1/Models/Models.csproj
@@ -0,0 +1,10 @@
+
+
+
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
diff --git a/WinFormsLibrary1/Models/Models/IProductModel.cs b/WinFormsLibrary1/Models/Models/IProductModel.cs
new file mode 100644
index 0000000..1cf0e7a
--- /dev/null
+++ b/WinFormsLibrary1/Models/Models/IProductModel.cs
@@ -0,0 +1,17 @@
+using Models.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Models.Models
+{
+ public interface IProductModel : IId
+ {
+ string Name { get;}
+ string Description { get;}
+ Category Category { get;}
+ int CountOnStorage { get;}
+ }
+}
diff --git a/WinFormsLibrary1/WinFormsApp1/Forms.csproj b/WinFormsLibrary1/WinFormsApp1/Forms.csproj
new file mode 100644
index 0000000..f406c44
--- /dev/null
+++ b/WinFormsLibrary1/WinFormsApp1/Forms.csproj
@@ -0,0 +1,28 @@
+
+
+
+ WinExe
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WinFormsLibrary1/WinFormsLibrary1.sln b/WinFormsLibrary1/WinFormsLibrary1.sln
index 54ee565..efbd16f 100644
--- a/WinFormsLibrary1/WinFormsLibrary1.sln
+++ b/WinFormsLibrary1/WinFormsLibrary1.sln
@@ -3,9 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34916.146
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsLibrary1", "WinFormsLibrary1\WinFormsLibrary1.csproj", "{4F13F436-1BE0-4F8D-A720-FCBF3893BA55}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Components", "WinFormsLibrary1\Components.csproj", "{4F13F436-1BE0-4F8D-A720-FCBF3893BA55}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsApp1", "WinFormsApp1\WinFormsApp1.csproj", "{4B1A0E96-B60A-4D73-B4AB-CF5157E593E5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Forms", "WinFormsApp1\Forms.csproj", "{4B1A0E96-B60A-4D73-B4AB-CF5157E593E5}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "Models\Models.csproj", "{C4816B78-EBAF-4183-8775-1180D91250D5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessLogics", "Businesslogic\BusinessLogics.csproj", "{753AC945-F64F-4A41-9036-6450AAB5A890}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{027FB9BF-E927-4C34-AFAD-C71EB03398EE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseImplement", "DatabaseImplement\DatabaseImplement.csproj", "{02E84641-9C21-43C3-99CD-765878F8C8F6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +29,22 @@ Global
{4B1A0E96-B60A-4D73-B4AB-CF5157E593E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B1A0E96-B60A-4D73-B4AB-CF5157E593E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B1A0E96-B60A-4D73-B4AB-CF5157E593E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C4816B78-EBAF-4183-8775-1180D91250D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C4816B78-EBAF-4183-8775-1180D91250D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C4816B78-EBAF-4183-8775-1180D91250D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C4816B78-EBAF-4183-8775-1180D91250D5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {753AC945-F64F-4A41-9036-6450AAB5A890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {753AC945-F64F-4A41-9036-6450AAB5A890}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {753AC945-F64F-4A41-9036-6450AAB5A890}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {753AC945-F64F-4A41-9036-6450AAB5A890}.Release|Any CPU.Build.0 = Release|Any CPU
+ {027FB9BF-E927-4C34-AFAD-C71EB03398EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {027FB9BF-E927-4C34-AFAD-C71EB03398EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {027FB9BF-E927-4C34-AFAD-C71EB03398EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {027FB9BF-E927-4C34-AFAD-C71EB03398EE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {02E84641-9C21-43C3-99CD-765878F8C8F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {02E84641-9C21-43C3-99CD-765878F8C8F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {02E84641-9C21-43C3-99CD-765878F8C8F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {02E84641-9C21-43C3-99CD-765878F8C8F6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/WinFormsLibrary1/WinFormsLibrary1/WinFormsLibrary1.csproj b/WinFormsLibrary1/WinFormsLibrary1/Components.csproj
similarity index 86%
rename from WinFormsLibrary1/WinFormsLibrary1/WinFormsLibrary1.csproj
rename to WinFormsLibrary1/WinFormsLibrary1/Components.csproj
index ea36566..22ca5db 100644
--- a/WinFormsLibrary1/WinFormsLibrary1/WinFormsLibrary1.csproj
+++ b/WinFormsLibrary1/WinFormsLibrary1/Components.csproj
@@ -5,6 +5,7 @@
enable
true
enable
+ True