From 1984a205c1b606a6aee7e74dbcdf2d7ccfff670c Mon Sep 17 00:00:00 2001 From: RozhVan Date: Sat, 14 Dec 2024 15:58:17 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GasStation/Entities/Selling.cs | 5 +---- GasStation/Forms/FormProduct.cs | 2 +- GasStation/Forms/FormSelling.cs | 4 ++-- GasStation/Repositories/Implementations/SellingRepository.cs | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/GasStation/Entities/Selling.cs b/GasStation/Entities/Selling.cs index 033282e..7395802 100644 --- a/GasStation/Entities/Selling.cs +++ b/GasStation/Entities/Selling.cs @@ -6,19 +6,16 @@ public class Selling public int GasmanId { get; private set; } - public int Count { get; private set; } - public IEnumerable ProdutcSellings { get; private set; } = []; public DateTime SellingDateTime { get; private set; } - public static Selling CreateSelling(int id, int gasmanId, int count, IEnumerable produtcSellings) + public static Selling CreateSelling(int id, int gasmanId, IEnumerable produtcSellings) { return new Selling { Id = id, GasmanId = gasmanId, - Count = count, SellingDateTime = DateTime.Now, ProdutcSellings = produtcSellings }; diff --git a/GasStation/Forms/FormProduct.cs b/GasStation/Forms/FormProduct.cs index 52c48db..bdcf36d 100644 --- a/GasStation/Forms/FormProduct.cs +++ b/GasStation/Forms/FormProduct.cs @@ -31,7 +31,7 @@ public partial class FormProduct : Form { throw new InvalidDataException(nameof(product)); } - + numericUpDownCost.Value = product.ProductCost; comboBoxProduct.SelectedItem = product.ProductType; _productId = value; } diff --git a/GasStation/Forms/FormSelling.cs b/GasStation/Forms/FormSelling.cs index 41be98e..3b4e497 100644 --- a/GasStation/Forms/FormSelling.cs +++ b/GasStation/Forms/FormSelling.cs @@ -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(); } diff --git a/GasStation/Repositories/Implementations/SellingRepository.cs b/GasStation/Repositories/Implementations/SellingRepository.cs index 7451ede..daba68b 100644 --- a/GasStation/Repositories/Implementations/SellingRepository.cs +++ b/GasStation/Repositories/Implementations/SellingRepository.cs @@ -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(queryInsert, selling, transaction); var querySubInsert = @"