начало переноса
This commit is contained in:
parent
cbc908a73f
commit
d878a6a73f
@ -1,12 +1,19 @@
|
|||||||
namespace ProjectLibrary.Entities
|
namespace ProjectLibrary.Entities
|
||||||
{
|
{
|
||||||
using ProjectLibrary.Entities.Enums;
|
using ProjectLibrary.Entities.Enums;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
public class Book
|
public class Book
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Автор")]
|
||||||
public string Author { get; private set; } = string.Empty;
|
public string Author { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Назвние книги")]
|
||||||
public string Name { get; private set; } = string.Empty;
|
public string Name { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Тип книги")]
|
||||||
public BookType TypeBookID { get; set; } = BookType.None;
|
public BookType TypeBookID { get; set; } = BookType.None;
|
||||||
|
|
||||||
public static Book CreateEntity(int id, string author, string name, BookType typeBookID = BookType.None)
|
public static Book CreateEntity(int id, string author, string name, BookType typeBookID = BookType.None)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -8,8 +9,13 @@ namespace ProjectLibrary.Entites
|
|||||||
{
|
{
|
||||||
public class Book_Orders
|
public class Book_Orders
|
||||||
{
|
{
|
||||||
|
[Browsable(false)]
|
||||||
public int BookID { get; private set; }
|
public int BookID { get; private set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
public int OrderID { get; private set; }
|
public int OrderID { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Количество")]
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public static Book_Orders CreateEntity(int orderID,int bookID, int count )
|
public static Book_Orders CreateEntity(int orderID,int bookID, int count )
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
namespace ProjectLibrary.Entites
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace ProjectLibrary.Entites
|
||||||
{
|
{
|
||||||
public class Book_Library
|
public class Book_Library
|
||||||
{
|
{
|
||||||
|
[Browsable(false)]
|
||||||
public int BookID { get; private set; }
|
public int BookID { get; private set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
public int LibraryID { get; private set; }
|
public int LibraryID { get; private set; }
|
||||||
|
[DisplayName("Количество")]
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public static Book_Library CreateEntity(int libraryID, int bookID, int count)
|
public static Book_Library CreateEntity(int libraryID, int bookID, int count)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using ProjectLibrary.Forms;
|
using ProjectLibrary.Forms;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -10,7 +11,11 @@ namespace ProjectLibrary.Entites
|
|||||||
public class Library
|
public class Library
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Название")]
|
||||||
public string Name { get; private set; } = string.Empty;
|
public string Name { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Адрес")]
|
||||||
public string Address { get; private set; } = string.Empty;
|
public string Address { get; private set; } = string.Empty;
|
||||||
public IEnumerable<Book_Library> BookLibrary
|
public IEnumerable<Book_Library> BookLibrary
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.VisualBasic;
|
|||||||
using ProjectLibrary.Entities;
|
using ProjectLibrary.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -12,8 +13,14 @@ namespace ProjectLibrary.Entites
|
|||||||
public class Orders
|
public class Orders
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Дата с")]
|
||||||
public DateTime OrderDate { get; private set; }
|
public DateTime OrderDate { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Дата по")]
|
||||||
public DateTime ReturnDate { get; private set; }
|
public DateTime ReturnDate { get; private set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
public int ReaderID { get; private set; }
|
public int ReaderID { get; private set; }
|
||||||
public IEnumerable<Book_Orders> BookOrders
|
public IEnumerable<Book_Orders> BookOrders
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
namespace ProjectLibrary.Entities
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace ProjectLibrary.Entities
|
||||||
{
|
{
|
||||||
public class Reader
|
public class Reader
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Имя")]
|
||||||
public string Name { get; private set; } = string.Empty;
|
public string Name { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Читательский билет")]
|
||||||
public int ReaderTicket { get; private set; }
|
public int ReaderTicket { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Дата регистрации")]
|
||||||
public DateTime RegistrationDateRT { get; private set; } // Изменение на DateTime
|
public DateTime RegistrationDateRT { get; private set; } // Изменение на DateTime
|
||||||
|
|
||||||
public static Reader CreateEntity(int id, string name, int readerTicket)
|
public static Reader CreateEntity(int id, string name, int readerTicket)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -9,10 +10,20 @@ namespace ProjectLibrary.Entites;
|
|||||||
public class TempBookOrders
|
public class TempBookOrders
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Дата заказа???")]
|
||||||
public DateTime OrderDate { get; set; }
|
public DateTime OrderDate { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Дата исполнения???")]
|
||||||
public DateTime ReturnDate { get; set; }
|
public DateTime ReturnDate { get; set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
public int ReaderID { get; set; }
|
public int ReaderID { get; set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
public int BookID { get; set; }
|
public int BookID { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Количество")]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
namespace ProjectLibrary.Entites
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace ProjectLibrary.Entites
|
||||||
{
|
{
|
||||||
public class TicketExtensions
|
public class TicketExtensions
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
public int ReaderID { get; private set; }
|
public int ReaderID { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Последняя дата обновления")]
|
||||||
public DateTime LastUpdateDate { get; private set; }
|
public DateTime LastUpdateDate { get; private set; }
|
||||||
|
|
||||||
|
[DisplayName("Следущая дата обновления")]
|
||||||
public DateTime NextUpdateDate { get; private set; }
|
public DateTime NextUpdateDate { get; private set; }
|
||||||
|
|
||||||
public static TicketExtensions CreateEntity(int id, int readerID, DateTime lastUpdateDate, DateTime nextUpdateDate)
|
public static TicketExtensions CreateEntity(int id, int readerID, DateTime lastUpdateDate, DateTime nextUpdateDate)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using ProjectLibrary.Repositories;
|
using ProjectLibrary.Repositories;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -37,8 +38,7 @@ public class ChartReport
|
|||||||
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
||||||
{
|
{
|
||||||
return _orderRepository
|
return _orderRepository
|
||||||
.ReadOrders()
|
.ReadOrders(StartDate: startDate, EndDate: endDate)
|
||||||
.Where(x => x.OrderDate.Date == dateTime.Date)
|
|
||||||
.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) })
|
.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))
|
.Select(x => (x.ID.ToString(), (double)x.Count))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -13,7 +13,7 @@ public class TableReport
|
|||||||
{
|
{
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly ILogger<TableReport> _logger;
|
private readonly ILogger<TableReport> _logger;
|
||||||
internal static readonly string[] item = ["Id заказа","Дата заказа", "Дата возврата", "Книга", "Количество"];
|
internal static readonly string[] item = ["Id заказа", "Книга", "Дата заказа", "Дата возврата", "Количество"];
|
||||||
|
|
||||||
|
|
||||||
public TableReport(IOrderRepository orderRepository, ILogger<TableReport> logger)
|
public TableReport(IOrderRepository orderRepository, ILogger<TableReport> logger)
|
||||||
@ -28,7 +28,7 @@ public class TableReport
|
|||||||
{
|
{
|
||||||
new ExcelBuilder(filePath)
|
new ExcelBuilder(filePath)
|
||||||
.AddHeader("Сводка по движению книг", 0, 5)
|
.AddHeader("Сводка по движению книг", 0, 5)
|
||||||
.AddParagraph("за период", 0)
|
.AddParagraph($"За период с {startDate:dd.MM.yyyy} по {endDate:dd.MM.yyyy}",0)
|
||||||
.AddTable([10, 10, 10, 15, 15], GetData(startDate, endDate))
|
.AddTable([10, 10, 10, 15, 15], GetData(startDate, endDate))
|
||||||
.Build();
|
.Build();
|
||||||
return true;
|
return true;
|
||||||
@ -43,8 +43,7 @@ public class TableReport
|
|||||||
private List<string[]> GetData(DateTime startDate, DateTime endDate)
|
private List<string[]> GetData(DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
var data = _orderRepository
|
var data = _orderRepository
|
||||||
.ReadOrders()
|
.ReadOrders(StartDate: startDate, EndDate: endDate)
|
||||||
.Where(x => x.OrderDate >= startDate && x.OrderDate <= endDate && x.BookOrders.Any(y => y.OrderID == x.Id))
|
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
x.Id,
|
x.Id,
|
||||||
@ -58,9 +57,10 @@ public class TableReport
|
|||||||
new List<string[]>() { item }
|
new List<string[]>() { item }
|
||||||
.Union(
|
.Union(
|
||||||
data
|
data
|
||||||
.Select(x => new string[] { x.Id.ToString(), x.DateOrder.ToString(), x.DateReturn.ToString(),
|
.Select(x => new string[] { x.Id.ToString(), x.DateOrder.ToString("dd.MM.yyyy"), x.DateReturn.ToString("dd.MM.yyyy"),
|
||||||
x.Book?.ToString() ?? string.Empty, x.Count?.ToString() ?? string.Empty}))
|
x.Book?.ToString("N0") ?? string.Empty, x.Count?.ToString("N0") ?? string.Empty}))
|
||||||
.Union([["Всего", "", "", "", data.Sum(x => x.Count ?? 0).ToString()]])
|
.Union([["Всего", "", "", "", data.Sum(x => x.Count ?? 0).ToString("N0")]])
|
||||||
.ToList();
|
.ToList();
|
||||||
|
//return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user