This commit is contained in:
Максим Сергунов 2023-04-27 23:28:33 +04:00
parent 1dbc0f52ee
commit 9e2069a647
9 changed files with 32 additions and 23 deletions

View File

@ -11,8 +11,11 @@ namespace GiftShopBusinessLogic.OfficePackage.Implements
public class SaveToExcel : AbstractSaveToExcel
{
private SpreadsheetDocument? _spreadsheetDocument;
private SharedStringTablePart? _shareStringPart;
private Worksheet? _worksheet;
/// <summary>
/// Настройка стилей для файла
/// </summary>

View File

@ -6,11 +6,10 @@ using MigraDoc.Rendering;
namespace GiftShopBusinessLogic.OfficePackage.Implements
{
public abstract class SaveToPdf : AbstractSaveToPdf
public class SaveToPdf : AbstractSaveToPdf
{
private Document? _document;
private Section? _section;
private Table? _table;

View File

@ -33,12 +33,23 @@ namespace GiftShopDatabaseImplement.Implements
public List<OrderViewModel> 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<OrderViewModel> GetFullList()

View File

@ -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()),

View File

@ -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
//

View File

@ -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<FormReportGiftComponents> logger, IReportLogic logic)
{

View File

@ -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<FormReportOrders> 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);

View File

@ -26,7 +26,6 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.ReportingServices.ReportViewerControl.WebForms" Version="150.1537.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.2" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
</ItemGroup>
@ -39,4 +38,10 @@
<ProjectReference Include="..\GiftShopListImplement\GiftShopListImplement.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ReportOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -51,6 +51,8 @@ namespace GiftShopView
services.AddTransient<FormGift>();
services.AddTransient<FormGiftComponent>();
services.AddTransient<FormGifts>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportGiftComponents>();
}
}
}