WIP Исправление

This commit is contained in:
H0llowVoid 2024-12-24 12:49:19 +04:00
parent ab5e73553b
commit 01426cc8a0
4 changed files with 8 additions and 8 deletions

View File

@ -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
};
}

View File

@ -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
//

View File

@ -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)
{

View File

@ -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)