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