diff --git a/ProjectLibrary/Entites/Orders.cs b/ProjectLibrary/Entites/Orders.cs index c085586..180998a 100644 --- a/ProjectLibrary/Entites/Orders.cs +++ b/ProjectLibrary/Entites/Orders.cs @@ -20,9 +20,12 @@ namespace ProjectLibrary.Entites [DisplayName("Дата зврата книги")] public DateTime ReturnDate { get; private set; } - [DisplayName("Идентификационный номер читателя")] + [Browsable(false)] public int ReaderID { get; private set; } + [DisplayName("ФИО читателя")] + public string ReaderName { get; private set; } + public string BookName { get; set; } [Browsable(false)] diff --git a/ProjectLibrary/Entites/Ticket_Extension.cs b/ProjectLibrary/Entites/Ticket_Extension.cs index 21149f5..5808f47 100644 --- a/ProjectLibrary/Entites/Ticket_Extension.cs +++ b/ProjectLibrary/Entites/Ticket_Extension.cs @@ -6,15 +6,20 @@ namespace ProjectLibrary.Entites { public int Id { get; private set; } - [DisplayName("Идентификационный номер читателя")] + [Browsable(false)] public int ReaderID { get; private set; } + [DisplayName("ФИО читателя")] + public string ReaderName { get; private set; } + [DisplayName("Последняя дата обновления")] public DateTime LastUpdateDate { get; private set; } [DisplayName("Следущая дата обновления")] public DateTime NextUpdateDate { get; private set; } + + public static TicketExtensions CreateEntity(int id, int readerID, DateTime lastUpdateDate, DateTime nextUpdateDate) { return new TicketExtensions diff --git a/ProjectLibrary/Forms/FTiclet_Extensions.cs b/ProjectLibrary/Forms/FTiclet_Extensions.cs index 76f6be6..e72b83e 100644 --- a/ProjectLibrary/Forms/FTiclet_Extensions.cs +++ b/ProjectLibrary/Forms/FTiclet_Extensions.cs @@ -62,9 +62,11 @@ namespace ProjectLibrary.Forms private void LoadList() { dataGridView.DataSource = _ticketRepository.ReadTicketExtensions(); + dataGridView.Columns["Id"].Visible = false; dataGridView.Columns["LastUpdateDate"].DefaultCellStyle.Format = "dd MMMM yyyy"; dataGridView.Columns["NextUpdateDate"].DefaultCellStyle.Format = "dd MMMM yyyy"; + } private bool TryGetIdentifierFromSelectedRow(out int id) { diff --git a/ProjectLibrary/Reports/ChartReport.cs b/ProjectLibrary/Reports/ChartReport.cs index aa8ea92..85aaf25 100644 --- a/ProjectLibrary/Reports/ChartReport.cs +++ b/ProjectLibrary/Reports/ChartReport.cs @@ -24,7 +24,7 @@ public class ChartReport { new PdfBuilder(filePath) .AddHeader("Количество книг в библиотеках") - .AddPieChart("Библиотеки", GetData(dateTime)) + .AddPieChart($"Библиотеки на {dateTime: dd MMMM yyyy}", GetData(dateTime)) .Build(); return true; } diff --git a/ProjectLibrary/Repositores/Implementations/OrderRepository.cs b/ProjectLibrary/Repositores/Implementations/OrderRepository.cs index 860fb8e..896004b 100644 --- a/ProjectLibrary/Repositores/Implementations/OrderRepository.cs +++ b/ProjectLibrary/Repositores/Implementations/OrderRepository.cs @@ -123,12 +123,14 @@ namespace ProjectLibrary.Repositories.Implementations { builder.AddCollerction("ord.ReturnDate < @EndDate"); }*/ - var querySelect = $@"SELECT ord.*, bk.Name as BookName, + var querySelect = $@"SELECT ord.*,re.name as ReaderName, + bk.Name as BookName, Obo.bookid as bookid, - Obo.Orderid, obo.count + Obo.Orderid, obo.count FROM Orders ord INNER JOIN Book_Orders Obo ON Obo.orderId = ord.Id Inner join book bk on bk.ID = obo.Bookid + inner join reader re on re.id = ord.readerid {builder.Build()}"; var OrderBookDict = new Dictionary>(); @@ -141,6 +143,7 @@ namespace ProjectLibrary.Repositories.Implementations OrderBookDict.Add(orders.Id, Book_Orders); } books_orders.BookName = orders.BookName; + Book_Orders.Add(books_orders); return orders; }, diff --git a/ProjectLibrary/Repositores/Implementations/TicketExtensionsRepository.cs b/ProjectLibrary/Repositores/Implementations/TicketExtensionsRepository.cs index 0faaff3..b219f27 100644 --- a/ProjectLibrary/Repositores/Implementations/TicketExtensionsRepository.cs +++ b/ProjectLibrary/Repositores/Implementations/TicketExtensionsRepository.cs @@ -112,7 +112,9 @@ namespace ProjectLibrary.Repositories.Implementations try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var querySelect = "SELECT * FROM Ticket_Extensions"; + var querySelect = @"SELECT te.*, r.Name as ReaderName + FROM Ticket_Extensions te + INNER JOIN Reader r ON r.Id = te.ReaderId"; var ticketExtensions = connection.Query(querySelect).ToList(); _logger.LogDebug("Полученные продления билетов: {json}", JsonConvert.SerializeObject(ticketExtensions));