From 01426cc8a00e7e4e7ed4f1046acb0826eb1d7cbe Mon Sep 17 00:00:00 2001 From: H0llowVoid Date: Tue, 24 Dec 2024 12:49:19 +0400 Subject: [PATCH] =?UTF-8?q?WIP=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectOpticsSalon/ProjectOpticsSalon/Entites/Production.cs | 6 +++--- .../ProjectOpticsSalon/Forms/FormProduction.Designer.cs | 4 ++-- .../ProjectOpticsSalon/Forms/FormProduction.cs | 4 ++-- .../Repositories/Implementations/ProductionRepository.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ProjectOpticsSalon/ProjectOpticsSalon/Entites/Production.cs b/ProjectOpticsSalon/ProjectOpticsSalon/Entites/Production.cs index 58d2b55..1e7e1fd 100644 --- a/ProjectOpticsSalon/ProjectOpticsSalon/Entites/Production.cs +++ b/ProjectOpticsSalon/ProjectOpticsSalon/Entites/Production.cs @@ -11,16 +11,16 @@ public class Production public int Id { get; private set; } public double ComponentsPrice { get; private set; } public double WorkPrice { get; private set; } - public Product Product { get; private set; } + public int ProductId { get; private set; } public DateTime Date { get; private set; } - public static Production CreateProduction(int id, double componentsPrice, double workPrice, Product product) + public static Production CreateProduction(int id, double componentsPrice, double workPrice, int productId) { return new Production { Id = id, ComponentsPrice = componentsPrice, WorkPrice = workPrice, - Product = product, + ProductId = productId, Date = DateTime.Now }; } diff --git a/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.Designer.cs b/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.Designer.cs index 743e795..2916d0f 100644 --- a/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.Designer.cs +++ b/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.Designer.cs @@ -61,9 +61,9 @@ label3.AutoSize = true; label3.Location = new Point(84, 185); label3.Name = "label3"; - label3.Size = new Size(66, 20); + label3.Size = new Size(91, 20); label3.TabIndex = 2; - label3.Text = "Продукт"; + label3.Text = "ID продукта"; // // maskedTextBoxComponentsPrice // diff --git a/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.cs b/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.cs index 5b736af..f2ff3fb 100644 --- a/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.cs +++ b/ProjectOpticsSalon/ProjectOpticsSalon/Forms/FormProduction.cs @@ -32,7 +32,7 @@ namespace ProjectOpticsSalon.Forms maskedTextBoxComponentsPrice.Text = production.ComponentsPrice.ToString(); maskedTextBoxWorkPrice.Text = production.WorkPrice.ToString(); - comboBoxProduct.SelectedItem = production.Product; + comboBoxProduct.SelectedItem = production.ProductId; _productionId = value; } @@ -62,7 +62,7 @@ namespace ProjectOpticsSalon.Forms { throw new Exception("Имеются незаполненные поля"); } - _productionRepository.CreateProduction(Production.CreateProduction(0, Convert.ToDouble(maskedTextBoxComponentsPrice.Text), Convert.ToDouble(maskedTextBoxWorkPrice.Text), (Product)comboBoxProduct.SelectedItem!)); + _productionRepository.CreateProduction(Production.CreateProduction(0, Convert.ToDouble(maskedTextBoxComponentsPrice.Text), Convert.ToDouble(maskedTextBoxWorkPrice.Text), (int)comboBoxProduct.SelectedItem!)); } catch (Exception ex) { diff --git a/ProjectOpticsSalon/ProjectOpticsSalon/Repositories/Implementations/ProductionRepository.cs b/ProjectOpticsSalon/ProjectOpticsSalon/Repositories/Implementations/ProductionRepository.cs index 5f1a7e7..88ecd88 100644 --- a/ProjectOpticsSalon/ProjectOpticsSalon/Repositories/Implementations/ProductionRepository.cs +++ b/ProjectOpticsSalon/ProjectOpticsSalon/Repositories/Implementations/ProductionRepository.cs @@ -20,7 +20,7 @@ public class ProductionRepository : IProductionRepository public Production ReadProductionById(int id) { - return Production.CreateProduction(0,0,0,null); + return Production.CreateProduction(0,0,0,0); } public void UpdateProduction(Production production)