всё ещё присутствуют недоработки
This commit is contained in:
parent
71a39fa73e
commit
3ed7fda20d
@ -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)
|
||||
|
@ -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<int, List<ProductSelling>>();
|
||||
var selling = connection.Query<Selling, ProductSelling, Selling>(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();
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user