PIbd-22 ZagidulinG.A. LabWork04 #4
@ -58,7 +58,7 @@ namespace Workshop.Forms
|
||||
return list.GroupBy(
|
||||
x => x.ProductId,
|
||||
x => x.Amount,
|
||||
(id, counts) => ChequeProduct.CreateEntity(0, id, counts.Sum())).ToList();
|
||||
(id, counts) => ChequeProduct.CreateEntity(id, 0, counts.Sum())).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,12 +44,12 @@ internal class ChartReport
|
||||
{
|
||||
return _creatingRepository
|
||||
.ReadProductCreates(dateFrom: dateTimeStart, dateTo: dateTimeEnd)
|
||||
.GroupBy(x => x.ProductId, (key, group) => new
|
||||
.GroupBy(x => x.ProductName, (key, group) => new
|
||||
{
|
||||
Id = key,
|
||||
ProductName = key,
|
||||
Count = group.Count()
|
||||
})
|
||||
.Select(x => (x.Id.ToString(), (double)x.Count))
|
||||
.Select(x => (x.ProductName.ToString(), (double)x.Count))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ INSERT INTO CHEQUE_PRODUCT (ProductID, ChequeID, Amount)
|
||||
VALUES (@ProductId, @ChequeID, @Amount)";
|
||||
foreach (var elem in cheque.ChequeProduct)
|
||||
{
|
||||
connection.Execute(querySubInsert, new {chequeId, elem.ProductId, elem.Amount});
|
||||
connection.Execute(querySubInsert, new { elem.ProductId, chequeId, elem.Amount});
|
||||
}
|
||||
transaction.Commit();
|
||||
}
|
||||
@ -61,9 +61,9 @@ VALUES (@ProductId, @ChequeID, @Amount)";
|
||||
{
|
||||
var builder = new QueryBuilder();
|
||||
if (dateFrom.HasValue)
|
||||
builder.AddCondition("cp.CreatingDate >= @dateFrom");
|
||||
builder.AddCondition("c.Date >= @dateFrom");
|
||||
if (dateTo.HasValue)
|
||||
builder.AddCondition("cp.CreatingDate <= @dateTo");
|
||||
builder.AddCondition("c.Date <= @dateTo");
|
||||
if (productId.HasValue)
|
||||
builder.AddCondition("cp.ProductId = @productId");
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
|
Loading…
x
Reference in New Issue
Block a user