diff --git a/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs b/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs index db25dc3..568c4fb 100644 --- a/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs +++ b/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs @@ -11,8 +11,11 @@ namespace GiftShopBusinessLogic.OfficePackage.Implements public class SaveToExcel : AbstractSaveToExcel { private SpreadsheetDocument? _spreadsheetDocument; + private SharedStringTablePart? _shareStringPart; + private Worksheet? _worksheet; + /// /// Настройка стилей для файла /// diff --git a/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs b/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs index da6a453..bada97f 100644 --- a/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs +++ b/GiftShop/GiftShopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs @@ -6,10 +6,9 @@ using MigraDoc.Rendering; namespace GiftShopBusinessLogic.OfficePackage.Implements { - public abstract class SaveToPdf : AbstractSaveToPdf + public class SaveToPdf : AbstractSaveToPdf { private Document? _document; - private Section? _section; diff --git a/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs b/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs index e3e5174..b3cf021 100644 --- a/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs +++ b/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs @@ -33,12 +33,23 @@ namespace GiftShopDatabaseImplement.Implements public List GetFilteredList(OrderSearchModel model) { + if (model is null) + return new(); + + using var context = new GiftShopDatabase(); if (!model.Id.HasValue) { - return new(); + return context.Orders + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) + .Select(x => x.GetViewModel) + .ToList(); } - using var context = new GiftShopDatabase(); - return context.Orders.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList(); + + + return context.Orders + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); } public List GetFullList() diff --git a/GiftShop/GiftShopFileImplement/Models/Order.cs b/GiftShop/GiftShopFileImplement/Models/Order.cs index dfe532d..b44f984 100644 --- a/GiftShop/GiftShopFileImplement/Models/Order.cs +++ b/GiftShop/GiftShopFileImplement/Models/Order.cs @@ -10,8 +10,6 @@ namespace GiftShopFileImplement.Models { public int GiftId { get; private set; } - public string GiftName { get; private set; } - public int Count { get; private set; } public double Sum { get; private set; } @@ -34,7 +32,6 @@ namespace GiftShopFileImplement.Models { Id = model.Id, GiftId = model.GiftId, - GiftName = model.GiftName, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -53,7 +50,6 @@ namespace GiftShopFileImplement.Models { Id = Convert.ToInt32(element.Attribute("Id")!.Value), GiftId = Convert.ToInt32(element.Element("GiftId")!.Value), - GiftName = element.Element("GiftName")!.Value, Count = Convert.ToInt32(element.Element("Count")!.Value), Sum = Convert.ToDouble(element.Element("Sum")!.Value), Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value), @@ -73,7 +69,6 @@ namespace GiftShopFileImplement.Models return; } GiftId = model.GiftId; - GiftName = model.GiftName; Count = model.Count; Sum = model.Sum; Status = model.Status; @@ -85,7 +80,6 @@ namespace GiftShopFileImplement.Models { Id = Id, GiftId = GiftId, - GiftName = GiftName, Count = Count, Sum = Sum, Status = Status, @@ -95,7 +89,6 @@ namespace GiftShopFileImplement.Models public XElement GetXElement => new("Order", new XAttribute("Id", Id), - new XElement("GiftName", GiftName), new XElement("GiftId", GiftId.ToString()), new XElement("Count", Count.ToString()), new XElement("Sum", Sum.ToString()), diff --git a/GiftShop/GiftShopView/FormMain.Designer.cs b/GiftShop/GiftShopView/FormMain.Designer.cs index f53aaee..925cc18 100644 --- a/GiftShop/GiftShopView/FormMain.Designer.cs +++ b/GiftShop/GiftShopView/FormMain.Designer.cs @@ -157,12 +157,14 @@ компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem"; компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26); компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям"; + компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.ComponentGiftsToolStripMenuItem_Click); // // списокЗаказовToolStripMenuItem // списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; списокЗаказовToolStripMenuItem.Size = new Size(276, 26); списокЗаказовToolStripMenuItem.Text = "Список заказов"; + списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click); // // FormMain // diff --git a/GiftShop/GiftShopView/FormReportGiftComponents.cs b/GiftShop/GiftShopView/FormReportGiftComponents.cs index fcdaad5..9f46b00 100644 --- a/GiftShop/GiftShopView/FormReportGiftComponents.cs +++ b/GiftShop/GiftShopView/FormReportGiftComponents.cs @@ -1,21 +1,13 @@ using GiftShopContracts.BindingModels; using GiftShopContracts.BusinessLogicsContracts; using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; namespace GiftShopView { public partial class FormReportGiftComponents : Form { private readonly ILogger _logger; + private readonly IReportLogic _logic; public FormReportGiftComponents(ILogger logger, IReportLogic logic) { diff --git a/GiftShop/GiftShopView/FormReportOrders.cs b/GiftShop/GiftShopView/FormReportOrders.cs index a72a84c..5fa8f80 100644 --- a/GiftShop/GiftShopView/FormReportOrders.cs +++ b/GiftShop/GiftShopView/FormReportOrders.cs @@ -8,7 +8,9 @@ namespace GiftShopView public partial class FormReportOrders : Form { private readonly ReportViewer reportViewer; + private readonly ILogger _logger; + private readonly IReportLogic _logic; public FormReportOrders(ILogger logger, IReportLogic logic) { @@ -19,7 +21,7 @@ namespace GiftShopView { Dock = DockStyle.Fill }; - reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportOrders.rdlc", FileMode.Open)); + reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); Controls.Clear(); Controls.Add(reportViewer); Controls.Add(panel); diff --git a/GiftShop/GiftShopView/GiftShopView.csproj b/GiftShop/GiftShopView/GiftShopView.csproj index cc679f6..e75c4c7 100644 --- a/GiftShop/GiftShopView/GiftShopView.csproj +++ b/GiftShop/GiftShopView/GiftShopView.csproj @@ -26,7 +26,6 @@ - @@ -39,4 +38,10 @@ + + + Always + + + \ No newline at end of file diff --git a/GiftShop/GiftShopView/Program.cs b/GiftShop/GiftShopView/Program.cs index dc27b33..aaeacf1 100644 --- a/GiftShop/GiftShopView/Program.cs +++ b/GiftShop/GiftShopView/Program.cs @@ -51,6 +51,8 @@ namespace GiftShopView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file