From 289b42dd9b377534dc7028995e40eb77fe88900c Mon Sep 17 00:00:00 2001 From: grishazagidulin Date: Tue, 12 Nov 2024 22:26:11 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Workshop/Entities/Cheque.cs | 28 +++++++++++++++++++++ Workshop/Entities/ChequeProduct.cs | 20 +++++++++++++++ Workshop/Entities/Enums/CreatingState.cs | 15 +++++++++++ Workshop/Entities/Enums/ProductCategory.cs | 16 ++++++++++++ Workshop/Entities/Master.cs | 26 +++++++++++++++++++ Workshop/Entities/Material.cs | 25 +++++++++++++++++++ Workshop/Entities/Product.cs | 26 +++++++++++++++++++ Workshop/Entities/ProductCreate.cs | 29 ++++++++++++++++++++++ Workshop/Entities/ProductMaterial.cs | 23 +++++++++++++++++ Workshop/Form1.Designer.cs | 14 ++++++++--- 10 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 Workshop/Entities/Cheque.cs create mode 100644 Workshop/Entities/ChequeProduct.cs create mode 100644 Workshop/Entities/Enums/CreatingState.cs create mode 100644 Workshop/Entities/Enums/ProductCategory.cs create mode 100644 Workshop/Entities/Master.cs create mode 100644 Workshop/Entities/Material.cs create mode 100644 Workshop/Entities/Product.cs create mode 100644 Workshop/Entities/ProductCreate.cs create mode 100644 Workshop/Entities/ProductMaterial.cs diff --git a/Workshop/Entities/Cheque.cs b/Workshop/Entities/Cheque.cs new file mode 100644 index 0000000..7c1966d --- /dev/null +++ b/Workshop/Entities/Cheque.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Workshop.Entities; + +public class Cheque +{ + public int Id { get; private set; } + public DateTime Date { get; private set; } + public double Sum { get; private set; } + public IEnumerable ChequeProduct { get; private set; } = []; + + public static Cheque CreateEntity(int id, int sum, IEnumerable products) + { + return new Cheque() + { + Id = id, + Sum = sum, + Date = DateTime.Now, + ChequeProduct = products + }; + + } + +} diff --git a/Workshop/Entities/ChequeProduct.cs b/Workshop/Entities/ChequeProduct.cs new file mode 100644 index 0000000..012f739 --- /dev/null +++ b/Workshop/Entities/ChequeProduct.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Workshop.Entities; +public class ChequeProduct +{ + public int ProductId { get; private set; } + public int ChequeId { get; private set; } + public static ChequeProduct CreateEntity(int productid, int chequeid) + { + return new ChequeProduct + { + ProductId = productid, + ChequeId = chequeid + }; + } +} diff --git a/Workshop/Entities/Enums/CreatingState.cs b/Workshop/Entities/Enums/CreatingState.cs new file mode 100644 index 0000000..04034ba --- /dev/null +++ b/Workshop/Entities/Enums/CreatingState.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Workshop.Entities.Enums; + +public enum CreatingState +{ + None = 0, + Created = 1, + InProgress = 2, + Finished = 3 +} diff --git a/Workshop/Entities/Enums/ProductCategory.cs b/Workshop/Entities/Enums/ProductCategory.cs new file mode 100644 index 0000000..79e5b36 --- /dev/null +++ b/Workshop/Entities/Enums/ProductCategory.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Workshop.Entities.Enums; +[Flags] +public enum ProductCategory +{ + None = 0, + Furniture = 1, + Gifts = 2, + Kitchenware = 4, + Tools = 8 +} diff --git a/Workshop/Entities/Master.cs b/Workshop/Entities/Master.cs new file mode 100644 index 0000000..a95ba05 --- /dev/null +++ b/Workshop/Entities/Master.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Workshop.Entities; + +public class Master +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public string LastName { get; private set; } = string.Empty; + public int Age { get; private set; } + + public static Master CreateEntity(int id, string name, string lastName, int age) + { + return new Master + { + Id = id, + Name = name, + LastName = lastName, + Age = age + }; + } +} \ No newline at end of file diff --git a/Workshop/Entities/Material.cs b/Workshop/Entities/Material.cs new file mode 100644 index 0000000..b67a045 --- /dev/null +++ b/Workshop/Entities/Material.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Workshop.Entities; + +public class Material +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public int WarehouseAmount { get; private set; } + public double Price { get; private set; } + public static Material CreateEntity(int id, string name, int warehouseAmount, double price) + { + return new Material + { + Id = id, + Name = name, + WarehouseAmount = warehouseAmount, + Price = price + }; + } +} diff --git a/Workshop/Entities/Product.cs b/Workshop/Entities/Product.cs new file mode 100644 index 0000000..f62d7a9 --- /dev/null +++ b/Workshop/Entities/Product.cs @@ -0,0 +1,26 @@ +using System; +using Workshop.Entities.Enums; + +public class Product +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public double Price { get; private set; } + public int WarehouseAmount { get; private set; } + public ProductCategory Category { get; private set; } + public int MasterId { get; private set; } + public static Product CreateEntity(int id, string name, int price, int warehouseAmount, + ProductCategory category, int masterId) + { + return new Product { + Id = id, + Name = name, + Price = price, + WarehouseAmount = warehouseAmount, + Category = category, + MasterId = masterId + }; + } + + +} diff --git a/Workshop/Entities/ProductCreate.cs b/Workshop/Entities/ProductCreate.cs new file mode 100644 index 0000000..53799da --- /dev/null +++ b/Workshop/Entities/ProductCreate.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Workshop.Entities.Enums; + +namespace Workshop.Entities; + +public class ProductCreate +{ + public int Id { get; private set; } + public int ProductId { get; private set; } + public int MasterId { get; private set; } + public DateTime CreatingDate { get; private set; } + public CreatingState State { get; private set; } + public static ProductCreate CreateOperation(int id, int productid, int masterid, CreatingState? state) + { + return new ProductCreate + { + Id = id, + ProductId = productid, + MasterId = masterid, + State = state ?? CreatingState.None, + CreatingDate = DateTime.Now + }; + } + +} diff --git a/Workshop/Entities/ProductMaterial.cs b/Workshop/Entities/ProductMaterial.cs new file mode 100644 index 0000000..b6debc0 --- /dev/null +++ b/Workshop/Entities/ProductMaterial.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Workshop.Entities; + +public class ProductMaterial +{ + public int ProductId { get; private set; } + public int MaterialId { get; private set; } + public int Count { get; private set; } + public static ProductMaterial CreateEntity(int productId, int materialId, int count) + { + return new ProductMaterial + { + ProductId = productId, + MaterialId = materialId, + Count = count + }; + } +} diff --git a/Workshop/Form1.Designer.cs b/Workshop/Form1.Designer.cs index a95ab49..626f755 100644 --- a/Workshop/Form1.Designer.cs +++ b/Workshop/Form1.Designer.cs @@ -28,10 +28,16 @@ /// 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"; + SuspendLayout(); + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Name = "Form1"; + Text = "Form1"; + ResumeLayout(false); } #endregion