From f96757212125088e1bd8c31a4cb291ec365b23f9 Mon Sep 17 00:00:00 2001 From: Glliza Date: Thu, 14 Nov 2024 23:56:25 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=20=D0=BB=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=BE=D0=B9=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShoeStore/Entities/Employee.cs | 26 ++++ .../Entities/Enums/ManufacturingCompany.cs | 17 +++ ShoeStore/Entities/Enums/ProductType.cs | 28 ++++ ShoeStore/Entities/Product.cs | 38 ++++++ ShoeStore/Entities/ProductSale.cs | 23 ++++ ShoeStore/Entities/Receipt.cs | 31 +++++ ShoeStore/Entities/Sale.cs | 36 ++++++ ShoeStore/Entities/Storage.cs | 23 ++++ ShoeStore/Form1.Designer.cs | 39 ------ ShoeStore/Form1.cs | 10 -- ShoeStore/Form1.resx | 120 ------------------ ShoeStore/Repositories/IEmployeeRepository.cs | 17 +++ ShoeStore/Repositories/IProductRepository.cs | 17 +++ ShoeStore/Repositories/IReceiptRepository.cs | 14 ++ ShoeStore/Repositories/ISaleRepository.cs | 16 +++ ShoeStore/Repositories/IStorageRepository.cs | 17 +++ ShoeStore/ShoeStore.csproj | 4 + 17 files changed, 307 insertions(+), 169 deletions(-) create mode 100644 ShoeStore/Entities/Employee.cs create mode 100644 ShoeStore/Entities/Enums/ManufacturingCompany.cs create mode 100644 ShoeStore/Entities/Enums/ProductType.cs create mode 100644 ShoeStore/Entities/Product.cs create mode 100644 ShoeStore/Entities/ProductSale.cs create mode 100644 ShoeStore/Entities/Receipt.cs create mode 100644 ShoeStore/Entities/Sale.cs create mode 100644 ShoeStore/Entities/Storage.cs delete mode 100644 ShoeStore/Form1.Designer.cs delete mode 100644 ShoeStore/Form1.cs delete mode 100644 ShoeStore/Form1.resx create mode 100644 ShoeStore/Repositories/IEmployeeRepository.cs create mode 100644 ShoeStore/Repositories/IProductRepository.cs create mode 100644 ShoeStore/Repositories/IReceiptRepository.cs create mode 100644 ShoeStore/Repositories/ISaleRepository.cs create mode 100644 ShoeStore/Repositories/IStorageRepository.cs diff --git a/ShoeStore/Entities/Employee.cs b/ShoeStore/Entities/Employee.cs new file mode 100644 index 0000000..2bacd40 --- /dev/null +++ b/ShoeStore/Entities/Employee.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Entities; + +public class Employee +{ + public int Id { get; private set; } + public DateTime Date { get; private set; } + public int NumberStorage { get; private set; } + public int StorageSize { get; private set; } + + public Employee CreateEntity(int id, int numberStorage, int storageSize) + { + return new Employee + { + Id = id, + Date = DateTime.Now, + NumberStorage = numberStorage, + StorageSize = storageSize + }; + } +} diff --git a/ShoeStore/Entities/Enums/ManufacturingCompany.cs b/ShoeStore/Entities/Enums/ManufacturingCompany.cs new file mode 100644 index 0000000..15e041e --- /dev/null +++ b/ShoeStore/Entities/Enums/ManufacturingCompany.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Entities.Enums; + +[Flags] +public enum ManufacturingCompany +{ + None = 0, + Adidas = 1, + Nike = 2, + NewBalance = 4, + Puma = 8 +} diff --git a/ShoeStore/Entities/Enums/ProductType.cs b/ShoeStore/Entities/Enums/ProductType.cs new file mode 100644 index 0000000..42bf3e7 --- /dev/null +++ b/ShoeStore/Entities/Enums/ProductType.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Entities.Enums; + +public enum ProductType +{ + None = 0, + /// + /// сапоги + /// + Boots = 1, + /// + /// кроссовки + /// + Sneakers = 2, + /// + /// туфли + /// + Shoes = 3, + /// + /// шлепки + /// + Spanking = 4 +} diff --git a/ShoeStore/Entities/Product.cs b/ShoeStore/Entities/Product.cs new file mode 100644 index 0000000..88945de --- /dev/null +++ b/ShoeStore/Entities/Product.cs @@ -0,0 +1,38 @@ +using ShoeStore.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web; + +namespace ShoeStore.Entities; + +public class Product +{ + public int Id { get; private set; } + public int StorageProductId { get; private set; } + + public string NameOfShoes { get; private set; } + + public ManufacturingCompany ManufacturingCompany { get; private set; } + + public int Price { get; private set; } + public ProductType ProductType { get; private set; } + public int StorageSize { get; private set; } + + public Product CreateEntity(int id, int storageProductId, string nameOfShoes, ManufacturingCompany manufacturingCompany, int price, + ProductType productType, int storageSize) + { + return new Product + { + Id = id, + StorageProductId = storageProductId, + NameOfShoes = nameOfShoes, + ManufacturingCompany = manufacturingCompany, + Price = price, + ProductType = productType, + StorageSize = storageSize + }; + } +} diff --git a/ShoeStore/Entities/ProductSale.cs b/ShoeStore/Entities/ProductSale.cs new file mode 100644 index 0000000..fdc258f --- /dev/null +++ b/ShoeStore/Entities/ProductSale.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Entities; + +public class ProductSale +{ + public int ProductId { get; private set; } + public int SaleId { get; private set; } + public int Amount { get; private set; } + + public ProductSale CreateEntities(int productId, int saleId, int amount) + { + return new ProductSale { + ProductId = productId, + SaleId = saleId, + Amount = amount + }; + } +} diff --git a/ShoeStore/Entities/Receipt.cs b/ShoeStore/Entities/Receipt.cs new file mode 100644 index 0000000..b851c80 --- /dev/null +++ b/ShoeStore/Entities/Receipt.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Entities; + +public class Receipt +{ + public int Id { get; private set; } + public int StorageProductId { get; private set; } + public int ReceiptNumber {get; private set; } + public DateTime DateOfReceipt { get; private set; } + public int NumberOfPairsReceived { get; private set; } + public int StorageSize { get; private set; } + + public Receipt CreateOperation(int id, int storageProductId, int receiptNumber, int numberOfPairsReceived, int storageSize) + { + return new Receipt + { + Id = id, + StorageProductId = storageProductId, + ReceiptNumber = receiptNumber, + DateOfReceipt = DateTime.Now, + NumberOfPairsReceived = numberOfPairsReceived, + StorageSize = storageSize + }; + } + +} diff --git a/ShoeStore/Entities/Sale.cs b/ShoeStore/Entities/Sale.cs new file mode 100644 index 0000000..28a760d --- /dev/null +++ b/ShoeStore/Entities/Sale.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Entities; + +public class Sale +{ + public int Id { get; private set; } + public int ProductId { get; private set; } + public int StorageProductId { get; private set; } + public DateTime DateOfSale { get; private set; } + public int SalesNumber { get; private set; } + public int StorageSize { get; private set; } + public IEnumerable productSales + { + get; + private set; + } = []; + + public Sale CreateOperation (int id, int productId, int storageProductId, int salesNumber, int storageSize) + { + return new Sale + { + Id = id, + ProductId = productId, + StorageProductId = storageProductId, + DateOfSale = DateTime.Now, + SalesNumber = salesNumber, + StorageSize = storageSize + }; + } + +} diff --git a/ShoeStore/Entities/Storage.cs b/ShoeStore/Entities/Storage.cs new file mode 100644 index 0000000..1f5eb01 --- /dev/null +++ b/ShoeStore/Entities/Storage.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Entities; + +public class Storage +{ + public int Size { get; private set; } + public int QuantityInStock { get; private set; } + public int NumberStorage { get; private set; } + public Storage CreateEntity(int size, int quantityInStock, int numberStorage) + { + return new Storage + { + Size = size, + QuantityInStock = quantityInStock, + NumberStorage = numberStorage + }; + } +} diff --git a/ShoeStore/Form1.Designer.cs b/ShoeStore/Form1.Designer.cs deleted file mode 100644 index a3a9828..0000000 --- a/ShoeStore/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ShoeStore -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} diff --git a/ShoeStore/Form1.cs b/ShoeStore/Form1.cs deleted file mode 100644 index 98ad686..0000000 --- a/ShoeStore/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ShoeStore -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ShoeStore/Form1.resx b/ShoeStore/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/ShoeStore/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/ShoeStore/Repositories/IEmployeeRepository.cs b/ShoeStore/Repositories/IEmployeeRepository.cs new file mode 100644 index 0000000..77d528d --- /dev/null +++ b/ShoeStore/Repositories/IEmployeeRepository.cs @@ -0,0 +1,17 @@ +using ShoeStore.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Repositories; + +public interface IEmployeeRepository +{ + IEnumerable ReadEmployees(); + Employee ReadEmployeeById(int id); + void CreateEmployee(Employee employee); + void UpdateEmployee(Employee employee); + void DeleteEmployee(int id); +} diff --git a/ShoeStore/Repositories/IProductRepository.cs b/ShoeStore/Repositories/IProductRepository.cs new file mode 100644 index 0000000..1f18cf9 --- /dev/null +++ b/ShoeStore/Repositories/IProductRepository.cs @@ -0,0 +1,17 @@ +using ShoeStore.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Repositories; + +public interface IProductRepository +{ + IEnumerable ReadProducts(); + Employee ReadProductById(int id); + void CreateProduct(Product product); + void UpdateProduct(Product product); + void DeleteProduct(int id); +} diff --git a/ShoeStore/Repositories/IReceiptRepository.cs b/ShoeStore/Repositories/IReceiptRepository.cs new file mode 100644 index 0000000..7c9af88 --- /dev/null +++ b/ShoeStore/Repositories/IReceiptRepository.cs @@ -0,0 +1,14 @@ +using ShoeStore.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Repositories; + +public interface IReceiptRepository +{ + IEnumerable ReadReceipts(DateTime? dateForm = null, DateTime? dateTo = null, int? storageProductId = null, int? storageSize = null); + void CreateReceipt(Receipt receipt); +} diff --git a/ShoeStore/Repositories/ISaleRepository.cs b/ShoeStore/Repositories/ISaleRepository.cs new file mode 100644 index 0000000..bdc1f8b --- /dev/null +++ b/ShoeStore/Repositories/ISaleRepository.cs @@ -0,0 +1,16 @@ +using ShoeStore.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Repositories; + +public interface ISaleRepository +{ + IEnumerable ReadSales(DateTime? dateForm = null, DateTime? dateTo = null, int? productId = null, int? storageSize = null); + void CreateSale(Sale sale); + void DeleteSale(Sale sale); +} + diff --git a/ShoeStore/Repositories/IStorageRepository.cs b/ShoeStore/Repositories/IStorageRepository.cs new file mode 100644 index 0000000..fe297d4 --- /dev/null +++ b/ShoeStore/Repositories/IStorageRepository.cs @@ -0,0 +1,17 @@ +using ShoeStore.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShoeStore.Repositories; + +public interface IStorageRepository +{ + IEnumerable ReadStorages(); + Storage ReadStorageById(int id); + void CreateStorage(Storage storage); + void UpdateStorage(Storage storage); + void DeleteStorage(int id); +} diff --git a/ShoeStore/ShoeStore.csproj b/ShoeStore/ShoeStore.csproj index 663fdb8..965c19f 100644 --- a/ShoeStore/ShoeStore.csproj +++ b/ShoeStore/ShoeStore.csproj @@ -8,4 +8,8 @@ enable + + + + \ No newline at end of file