diff --git a/ProjectLibrary/Entites/Book.cs b/ProjectLibrary/Entites/Book.cs index 7204483..bc146db 100644 --- a/ProjectLibrary/Entites/Book.cs +++ b/ProjectLibrary/Entites/Book.cs @@ -1,12 +1,19 @@ namespace ProjectLibrary.Entities { using ProjectLibrary.Entities.Enums; + using System.ComponentModel; public class Book { public int Id { get; private set; } + + [DisplayName("Автор")] public string Author { get; private set; } = string.Empty; + + [DisplayName("Назвние книги")] public string Name { get; private set; } = string.Empty; + + [DisplayName("Тип книги")] public BookType TypeBookID { get; set; } = BookType.None; public static Book CreateEntity(int id, string author, string name, BookType typeBookID = BookType.None) diff --git a/ProjectLibrary/Entites/Book_Orders.cs b/ProjectLibrary/Entites/Book_Orders.cs index 9b6f030..49274da 100644 --- a/ProjectLibrary/Entites/Book_Orders.cs +++ b/ProjectLibrary/Entites/Book_Orders.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,8 +9,13 @@ namespace ProjectLibrary.Entites { public class Book_Orders { + [Browsable(false)] public int BookID { get; private set; } + + [Browsable(false)] public int OrderID { get; private set; } + + [DisplayName("Количество")] public int Count { get; private set; } public static Book_Orders CreateEntity(int orderID,int bookID, int count ) diff --git a/ProjectLibrary/Entites/Book_library.cs b/ProjectLibrary/Entites/Book_library.cs index 5c08041..f79ca6c 100644 --- a/ProjectLibrary/Entites/Book_library.cs +++ b/ProjectLibrary/Entites/Book_library.cs @@ -1,9 +1,15 @@ -namespace ProjectLibrary.Entites +using System.ComponentModel; + +namespace ProjectLibrary.Entites { public class Book_Library { + [Browsable(false)] public int BookID { get; private set; } + + [Browsable(false)] public int LibraryID { get; private set; } + [DisplayName("Количество")] public int Count { get; private set; } public static Book_Library CreateEntity(int libraryID, int bookID, int count) diff --git a/ProjectLibrary/Entites/Library.cs b/ProjectLibrary/Entites/Library.cs index 07c629c..843757a 100644 --- a/ProjectLibrary/Entites/Library.cs +++ b/ProjectLibrary/Entites/Library.cs @@ -1,6 +1,7 @@ using ProjectLibrary.Forms; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,7 +11,11 @@ namespace ProjectLibrary.Entites public class Library { public int Id { get; private set; } + + [DisplayName("Название")] public string Name { get; private set; } = string.Empty; + + [DisplayName("Адрес")] public string Address { get; private set; } = string.Empty; public IEnumerable BookLibrary { diff --git a/ProjectLibrary/Entites/Orders.cs b/ProjectLibrary/Entites/Orders.cs index 03f05db..53f338f 100644 --- a/ProjectLibrary/Entites/Orders.cs +++ b/ProjectLibrary/Entites/Orders.cs @@ -3,6 +3,7 @@ using Microsoft.VisualBasic; using ProjectLibrary.Entities; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -12,8 +13,14 @@ namespace ProjectLibrary.Entites public class Orders { public int Id { get; private set; } + + [DisplayName("Дата с")] public DateTime OrderDate { get; private set; } + + [DisplayName("Дата по")] public DateTime ReturnDate { get; private set; } + + [Browsable(false)] public int ReaderID { get; private set; } public IEnumerable BookOrders { diff --git a/ProjectLibrary/Entites/Reader.cs b/ProjectLibrary/Entites/Reader.cs index c46b5af..6ffa6d7 100644 --- a/ProjectLibrary/Entites/Reader.cs +++ b/ProjectLibrary/Entites/Reader.cs @@ -1,10 +1,18 @@ -namespace ProjectLibrary.Entities +using System.ComponentModel; + +namespace ProjectLibrary.Entities { public class Reader { public int Id { get; private set; } + + [DisplayName("Имя")] public string Name { get; private set; } = string.Empty; + + [DisplayName("Читательский билет")] public int ReaderTicket { get; private set; } + + [DisplayName("Дата регистрации")] public DateTime RegistrationDateRT { get; private set; } // Изменение на DateTime public static Reader CreateEntity(int id, string name, int readerTicket) diff --git a/ProjectLibrary/Entites/TempBookOrders.cs b/ProjectLibrary/Entites/TempBookOrders.cs index 3597cd2..a41c941 100644 --- a/ProjectLibrary/Entites/TempBookOrders.cs +++ b/ProjectLibrary/Entites/TempBookOrders.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,10 +10,20 @@ namespace ProjectLibrary.Entites; public class TempBookOrders { public int Id { get; set; } + + [DisplayName("Дата заказа???")] public DateTime OrderDate { get; set; } + + [DisplayName("Дата исполнения???")] public DateTime ReturnDate { get; set; } + + [Browsable(false)] public int ReaderID { get; set; } + + [Browsable(false)] public int BookID { get; set; } + + [DisplayName("Количество")] public int Count { get; set; } diff --git a/ProjectLibrary/Entites/Ticket_Extension.cs b/ProjectLibrary/Entites/Ticket_Extension.cs index 331ace5..ae4c789 100644 --- a/ProjectLibrary/Entites/Ticket_Extension.cs +++ b/ProjectLibrary/Entites/Ticket_Extension.cs @@ -1,10 +1,18 @@ -namespace ProjectLibrary.Entites +using System.ComponentModel; + +namespace ProjectLibrary.Entites { public class TicketExtensions { public int Id { get; private set; } + + [Browsable(false)] public int ReaderID { 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) diff --git a/ProjectLibrary/Reports/ChartReport.cs b/ProjectLibrary/Reports/ChartReport.cs index 1e0e893..54f58e7 100644 --- a/ProjectLibrary/Reports/ChartReport.cs +++ b/ProjectLibrary/Reports/ChartReport.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +using DocumentFormat.OpenXml.Wordprocessing; +using Microsoft.Extensions.Logging; using ProjectLibrary.Repositories; using System; using System.Collections.Generic; @@ -37,8 +38,7 @@ public class ChartReport private List<(string Caption, double Value)> GetData(DateTime dateTime) { return _orderRepository - .ReadOrders() - .Where(x => x.OrderDate.Date == dateTime.Date) + .ReadOrders(StartDate: startDate, EndDate: endDate) .GroupBy(x => x.BookOrders.First(y => y.OrderID == x.Id).BookID , (key, group) => new { ID = key, Count = group.Sum(y => y.BookOrders.First(z => z.OrderID == y.Id).Count) }) .Select(x => (x.ID.ToString(), (double)x.Count)) .ToList(); diff --git a/ProjectLibrary/Reports/TableReport.cs b/ProjectLibrary/Reports/TableReport.cs index 78e94eb..6e9d19b 100644 --- a/ProjectLibrary/Reports/TableReport.cs +++ b/ProjectLibrary/Reports/TableReport.cs @@ -13,7 +13,7 @@ public class TableReport { private readonly IOrderRepository _orderRepository; private readonly ILogger _logger; - internal static readonly string[] item = ["Id заказа","Дата заказа", "Дата возврата", "Книга", "Количество"]; + internal static readonly string[] item = ["Id заказа", "Книга", "Дата заказа", "Дата возврата", "Количество"]; public TableReport(IOrderRepository orderRepository, ILogger logger) @@ -28,7 +28,7 @@ public class TableReport { new ExcelBuilder(filePath) .AddHeader("Сводка по движению книг", 0, 5) - .AddParagraph("за период", 0) + .AddParagraph($"За период с {startDate:dd.MM.yyyy} по {endDate:dd.MM.yyyy}",0) .AddTable([10, 10, 10, 15, 15], GetData(startDate, endDate)) .Build(); return true; @@ -43,24 +43,24 @@ public class TableReport private List GetData(DateTime startDate, DateTime endDate) { var data = _orderRepository - .ReadOrders() - .Where(x => x.OrderDate >= startDate && x.OrderDate <= endDate && x.BookOrders.Any(y => y.OrderID == x.Id)) + .ReadOrders(StartDate: startDate, EndDate: endDate) .Select(x => new - { - x.Id, - DateOrder = x.OrderDate, - DateReturn = x.ReturnDate, - Book = (int?)x.BookOrders.First(y => y.OrderID == x.Id).BookID, - Count = (int?)x.BookOrders.First(y => y.OrderID == x.Id).Count - }) + { + x.Id, + DateOrder = x.OrderDate, + DateReturn = x.ReturnDate, + Book = (int?)x.BookOrders.First(y => y.OrderID == x.Id).BookID, + Count = (int?)x.BookOrders.First(y => y.OrderID == x.Id).Count + }) .OrderBy(x => x.DateOrder); return new List() { item } .Union( data - .Select(x => new string[] { x.Id.ToString(), x.DateOrder.ToString(), x.DateReturn.ToString(), - x.Book?.ToString() ?? string.Empty, x.Count?.ToString() ?? string.Empty})) - .Union([["Всего", "", "", "", data.Sum(x => x.Count ?? 0).ToString()]]) + .Select(x => new string[] { x.Id.ToString(), x.DateOrder.ToString("dd.MM.yyyy"), x.DateReturn.ToString("dd.MM.yyyy"), + x.Book?.ToString("N0") ?? string.Empty, x.Count?.ToString("N0") ?? string.Empty})) + .Union([["Всего", "", "", "", data.Sum(x => x.Count ?? 0).ToString("N0")]]) .ToList(); + //return null; } }