Reports
This commit is contained in:
parent
1dbc0f52ee
commit
9e2069a647
@ -11,8 +11,11 @@ namespace GiftShopBusinessLogic.OfficePackage.Implements
|
|||||||
public class SaveToExcel : AbstractSaveToExcel
|
public class SaveToExcel : AbstractSaveToExcel
|
||||||
{
|
{
|
||||||
private SpreadsheetDocument? _spreadsheetDocument;
|
private SpreadsheetDocument? _spreadsheetDocument;
|
||||||
|
|
||||||
private SharedStringTablePart? _shareStringPart;
|
private SharedStringTablePart? _shareStringPart;
|
||||||
|
|
||||||
private Worksheet? _worksheet;
|
private Worksheet? _worksheet;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Настройка стилей для файла
|
/// Настройка стилей для файла
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -6,11 +6,10 @@ using MigraDoc.Rendering;
|
|||||||
|
|
||||||
namespace GiftShopBusinessLogic.OfficePackage.Implements
|
namespace GiftShopBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
public abstract class SaveToPdf : AbstractSaveToPdf
|
public class SaveToPdf : AbstractSaveToPdf
|
||||||
{
|
{
|
||||||
private Document? _document;
|
private Document? _document;
|
||||||
|
|
||||||
|
|
||||||
private Section? _section;
|
private Section? _section;
|
||||||
|
|
||||||
private Table? _table;
|
private Table? _table;
|
||||||
|
@ -33,12 +33,23 @@ namespace GiftShopDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
if (model is null)
|
||||||
|
return new();
|
||||||
|
|
||||||
|
using var context = new GiftShopDatabase();
|
||||||
if (!model.Id.HasValue)
|
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()
|
public List<OrderViewModel> GetFullList()
|
||||||
|
@ -10,8 +10,6 @@ namespace GiftShopFileImplement.Models
|
|||||||
{
|
{
|
||||||
public int GiftId { get; private set; }
|
public int GiftId { get; private set; }
|
||||||
|
|
||||||
public string GiftName { get; private set; }
|
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
@ -34,7 +32,6 @@ namespace GiftShopFileImplement.Models
|
|||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
GiftId = model.GiftId,
|
GiftId = model.GiftId,
|
||||||
GiftName = model.GiftName,
|
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -53,7 +50,6 @@ namespace GiftShopFileImplement.Models
|
|||||||
{
|
{
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
GiftId = Convert.ToInt32(element.Element("GiftId")!.Value),
|
GiftId = Convert.ToInt32(element.Element("GiftId")!.Value),
|
||||||
GiftName = element.Element("GiftName")!.Value,
|
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
|
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
|
||||||
@ -73,7 +69,6 @@ namespace GiftShopFileImplement.Models
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GiftId = model.GiftId;
|
GiftId = model.GiftId;
|
||||||
GiftName = model.GiftName;
|
|
||||||
Count = model.Count;
|
Count = model.Count;
|
||||||
Sum = model.Sum;
|
Sum = model.Sum;
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
@ -85,7 +80,6 @@ namespace GiftShopFileImplement.Models
|
|||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
GiftId = GiftId,
|
GiftId = GiftId,
|
||||||
GiftName = GiftName,
|
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
@ -95,7 +89,6 @@ namespace GiftShopFileImplement.Models
|
|||||||
|
|
||||||
public XElement GetXElement => new("Order",
|
public XElement GetXElement => new("Order",
|
||||||
new XAttribute("Id", Id),
|
new XAttribute("Id", Id),
|
||||||
new XElement("GiftName", GiftName),
|
|
||||||
new XElement("GiftId", GiftId.ToString()),
|
new XElement("GiftId", GiftId.ToString()),
|
||||||
new XElement("Count", Count.ToString()),
|
new XElement("Count", Count.ToString()),
|
||||||
new XElement("Sum", Sum.ToString()),
|
new XElement("Sum", Sum.ToString()),
|
||||||
|
2
GiftShop/GiftShopView/FormMain.Designer.cs
generated
2
GiftShop/GiftShopView/FormMain.Designer.cs
generated
@ -157,12 +157,14 @@
|
|||||||
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
||||||
компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26);
|
компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26);
|
||||||
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
||||||
|
компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.ComponentGiftsToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// списокЗаказовToolStripMenuItem
|
// списокЗаказовToolStripMenuItem
|
||||||
//
|
//
|
||||||
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||||
списокЗаказовToolStripMenuItem.Size = new Size(276, 26);
|
списокЗаказовToolStripMenuItem.Size = new Size(276, 26);
|
||||||
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||||
|
списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
|
@ -1,21 +1,13 @@
|
|||||||
using GiftShopContracts.BindingModels;
|
using GiftShopContracts.BindingModels;
|
||||||
using GiftShopContracts.BusinessLogicsContracts;
|
using GiftShopContracts.BusinessLogicsContracts;
|
||||||
using Microsoft.Extensions.Logging;
|
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
|
namespace GiftShopView
|
||||||
{
|
{
|
||||||
public partial class FormReportGiftComponents : Form
|
public partial class FormReportGiftComponents : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IReportLogic _logic;
|
private readonly IReportLogic _logic;
|
||||||
public FormReportGiftComponents(ILogger<FormReportGiftComponents> logger, IReportLogic logic)
|
public FormReportGiftComponents(ILogger<FormReportGiftComponents> logger, IReportLogic logic)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,9 @@ namespace GiftShopView
|
|||||||
public partial class FormReportOrders : Form
|
public partial class FormReportOrders : Form
|
||||||
{
|
{
|
||||||
private readonly ReportViewer reportViewer;
|
private readonly ReportViewer reportViewer;
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IReportLogic _logic;
|
private readonly IReportLogic _logic;
|
||||||
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
||||||
{
|
{
|
||||||
@ -19,7 +21,7 @@ namespace GiftShopView
|
|||||||
{
|
{
|
||||||
Dock = DockStyle.Fill
|
Dock = DockStyle.Fill
|
||||||
};
|
};
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportOrders.rdlc", FileMode.Open));
|
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
Controls.Add(reportViewer);
|
Controls.Add(reportViewer);
|
||||||
Controls.Add(panel);
|
Controls.Add(panel);
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" 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.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="NLog.Extensions.Logging" Version="5.2.2" />
|
||||||
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -39,4 +38,10 @@
|
|||||||
<ProjectReference Include="..\GiftShopListImplement\GiftShopListImplement.csproj" />
|
<ProjectReference Include="..\GiftShopListImplement\GiftShopListImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="ReportOrders.rdlc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -51,6 +51,8 @@ namespace GiftShopView
|
|||||||
services.AddTransient<FormGift>();
|
services.AddTransient<FormGift>();
|
||||||
services.AddTransient<FormGiftComponent>();
|
services.AddTransient<FormGiftComponent>();
|
||||||
services.AddTransient<FormGifts>();
|
services.AddTransient<FormGifts>();
|
||||||
|
services.AddTransient<FormReportOrders>();
|
||||||
|
services.AddTransient<FormReportGiftComponents>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user