ИСЭбд-21 Мосевнин А.М. LabWork_4 #4

Closed
Aleks_andr435 wants to merge 7 commits from Labwork_4 into Labwork_3
3 changed files with 10 additions and 7 deletions
Showing only changes of commit f0df960fce - Show all commits

View File

@ -34,7 +34,7 @@ namespace ProjectLibrary.Entites
[DisplayName("Отданные книги")]
public string BookOrdersing => BookOrders != null ?
string.Join(", ", BookOrders.Select(x => $"{x.BookID}{x.Count}")) :
string.Join(", ", BookOrders.Select(x => $"{x.BookID}({x.Count})")) :
string.Empty;
public static Orders CreateEntity(int id, DateTime returnDate, int readerID, IEnumerable<Book_Orders> bookOrders)

View File

@ -42,8 +42,9 @@ public class TableReport
private List<string[]> GetData(DateTime? startDate = null, DateTime? endDate = null)
{
//var s = _orderRepository
// .ReadOrders(StartDate: startDate, EndDate: endDate);
var s = _orderRepository
.ReadOrders(StartDate: startDate, EndDate: endDate);
var data = _orderRepository
.ReadOrders(StartDate: startDate, EndDate: endDate)
.Select(x => new
@ -51,7 +52,7 @@ public class TableReport
x.Id,
DateOrder = x.OrderDate,
DateReturn = x.ReturnDate,
Book = x.BookOrders.FirstOrDefault(y => y.OrderID == x.Id)?.BookName,
Book = x.BookOrders.FirstOrDefault(y => y.OrderID == x.Id)?.BookID,//вот эти данные не вставляются в эксель
Count = x.BookOrders.FirstOrDefault(y => y.OrderID == x.Id)?.Count
})
.OrderBy(x => x.Id);
@ -60,7 +61,7 @@ public class TableReport
.Union(
data
.Select(x => new string[] { x.Id.ToString(), x.DateOrder.ToString("dd.MM.yyyy"), x.DateReturn.ToString("dd.MM.yyyy"),
x.Book ?? string.Empty, x.Count?.ToString("N0") ?? string.Empty}))
x.Book?.ToString("N0") ?? string.Empty, x.Count?.ToString("N0") ?? string.Empty}))
.Union([["Всего", "", "", "", data.Sum(x => x.Count ?? 0).ToString("N0")]])
.ToList();
//return null;

View File

@ -119,11 +119,13 @@ namespace ProjectLibrary.Repositories.Implementations
{
builder.AddCollerction("ord.OrderDate >= @StartDate");
}
/*if (EndDate.HasValue)
{
builder.AddCollerction("ord.ReturnDate < @EndDate");
}*/
var querySelect = $@"SELECT ord.*,
bk.Name as BookName,
Obo.bookid as bookid
FROM Orders ord
INNER JOIN Book_Orders Obo ON Obo.orderId = ord.Id
Inner join book bk on bk.ID = obo.Bookid