небольшой фикс
This commit is contained in:
parent
c5db05fbb1
commit
1984a205c1
@ -6,19 +6,16 @@ public class Selling
|
|||||||
|
|
||||||
public int GasmanId { get; private set; }
|
public int GasmanId { get; private set; }
|
||||||
|
|
||||||
public int Count { get; private set; }
|
|
||||||
|
|
||||||
public IEnumerable<ProductSelling> ProdutcSellings { get; private set; } = [];
|
public IEnumerable<ProductSelling> ProdutcSellings { get; private set; } = [];
|
||||||
|
|
||||||
public DateTime SellingDateTime { get; private set; }
|
public DateTime SellingDateTime { get; private set; }
|
||||||
|
|
||||||
public static Selling CreateSelling(int id, int gasmanId, int count, IEnumerable<ProductSelling> produtcSellings)
|
public static Selling CreateSelling(int id, int gasmanId, IEnumerable<ProductSelling> produtcSellings)
|
||||||
{
|
{
|
||||||
return new Selling
|
return new Selling
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
GasmanId = gasmanId,
|
GasmanId = gasmanId,
|
||||||
Count = count,
|
|
||||||
SellingDateTime = DateTime.Now,
|
SellingDateTime = DateTime.Now,
|
||||||
ProdutcSellings = produtcSellings
|
ProdutcSellings = produtcSellings
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@ public partial class FormProduct : Form
|
|||||||
{
|
{
|
||||||
throw new InvalidDataException(nameof(product));
|
throw new InvalidDataException(nameof(product));
|
||||||
}
|
}
|
||||||
|
numericUpDownCost.Value = product.ProductCost;
|
||||||
comboBoxProduct.SelectedItem = product.ProductType;
|
comboBoxProduct.SelectedItem = product.ProductType;
|
||||||
_productId = value;
|
_productId = value;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ namespace GasStation.Forms
|
|||||||
throw new Exception("Имеются незаполненые поля");
|
throw new Exception("Имеются незаполненые поля");
|
||||||
}
|
}
|
||||||
|
|
||||||
_sellingRepository.CreateSelling(Selling.CreateSelling(0, (int)comboBoxGasman.SelectedValue!,
|
_sellingRepository.CreateSelling(Selling.CreateSelling(0, (int)comboBoxGasman.SelectedValue!
|
||||||
0, CreateProductSellingsFromDataGrid()));
|
, CreateProductSellingsFromDataGrid()));
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ public class SellingRepository : ISellingRepository
|
|||||||
connection.Open();
|
connection.Open();
|
||||||
using var transaction = connection.BeginTransaction();
|
using var transaction = connection.BeginTransaction();
|
||||||
var queryInsert = @"
|
var queryInsert = @"
|
||||||
INSERT INTO selling (sellingDateTime, gasmanId, count)
|
INSERT INTO selling (sellingDateTime, gasmanId)
|
||||||
VALUES (@SellingDateTime, @GasmanId, @Count);
|
VALUES (@SellingDateTime, @GasmanId);
|
||||||
SELECT MAX(Id) FROM selling";
|
SELECT MAX(Id) FROM selling";
|
||||||
var Id = connection.QueryFirst<int>(queryInsert, selling, transaction);
|
var Id = connection.QueryFirst<int>(queryInsert, selling, transaction);
|
||||||
var querySubInsert = @"
|
var querySubInsert = @"
|
||||||
|
Loading…
Reference in New Issue
Block a user