diff --git a/GasStation/Forms/FormSellings.cs b/GasStation/Forms/FormSellings.cs index 2f16909..6846ee6 100644 --- a/GasStation/Forms/FormSellings.cs +++ b/GasStation/Forms/FormSellings.cs @@ -35,7 +35,7 @@ namespace GasStation.Forms { dataGridViewData.DataSource = _sellingRepository.ReadSelling(); dataGridViewData.Columns["ID"].Visible = false; - dataGridViewData.Columns["SupplyDate"].DefaultCellStyle.Format = "dd MMMM yyyy hh:mm"; + dataGridViewData.Columns["SellingDateTime"].DefaultCellStyle.Format = "dd MMMM yyyy"; } private void FormSellings_Load(object sender, EventArgs e) diff --git a/GasStation/Repositories/Implementations/SellingRepository.cs b/GasStation/Repositories/Implementations/SellingRepository.cs index 6086640..0429f5c 100644 --- a/GasStation/Repositories/Implementations/SellingRepository.cs +++ b/GasStation/Repositories/Implementations/SellingRepository.cs @@ -58,7 +58,7 @@ VALUES (@Id, @ProductID, @Count)"; var builder = new QueryBuilder(); if (dateTime.HasValue) { - builder.AddCondition("s.SellingDateTime = @sellingDateTime"); + builder.AddCondition("s.SellingDateTime = @dateTime"); } if (count.HasValue) { @@ -70,17 +70,17 @@ VALUES (@Id, @ProductID, @Count)"; } using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var querySelect = @" + var querySelect = @$" SELECT - fr.*, + s.*, CONCAT(p.ProductType, ' ', p.ProductName) as ProductName, - ps.ProdutId, + ps.ProductId, ps.Count, - g.GasmanName as 'GasmanName' + g.GasmanName FROM Selling s -LEFT JOIN Gasman g on g.Id = s.GasmanId -INNER JOIN Product_Selling ps ON ps.ProductId = s.Id -LEFT JOIN Product p on p.Id = s.ProductId +LEFT JOIN Gasman g on g.ID = s.GasmanID +INNER JOIN Product_Selling ps ON ps.ID = s.ID +LEFT JOIN Product p on p.Id = ps.ProductID {builder.Build()}"; var sellingDict = new Dictionary>(); var selling = connection.Query(querySelect, (sell, sellings) => @@ -92,16 +92,16 @@ LEFT JOIN Product p on p.Id = s.ProductId } ps.Add(sellings); return sell; - }, splitOn: "ProdutcId", param: new + }, splitOn: "ProductId", param: new {dateTime, count, gasmanID}); _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(selling)); return sellingDict.Select(x => { - var fr = selling.First(y => y.Id == x.Key); - fr.SetProductSelling(x.Value); - return fr; + var s = selling.First(y => y.Id == x.Key); + s.SetProductSelling(x.Value); + return s; }).ToArray(); } diff --git a/GasStation/Repositories/Implementations/SupplyRepository.cs b/GasStation/Repositories/Implementations/SupplyRepository.cs index ce20740..73d191d 100644 --- a/GasStation/Repositories/Implementations/SupplyRepository.cs +++ b/GasStation/Repositories/Implementations/SupplyRepository.cs @@ -83,7 +83,7 @@ WHERE id=@Id"; } using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var querySelect = @"SELECT + var querySelect = @$"SELECT s.*, CONCAT(p.ProductType, ' ', p.ProductName) as ProductName, sup.SupplierName as SupplierName