Лабораторная 4
This commit is contained in:
parent
529c1f19e4
commit
700e2efbde
BIN
Bar/1.docx
Normal file
BIN
Bar/1.docx
Normal file
Binary file not shown.
BIN
Bar/1.xlsx
Normal file
BIN
Bar/1.xlsx
Normal file
Binary file not shown.
@ -11,14 +11,21 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="NLog" Version="5.3.2" />
|
<PackageReference Include="NLog" Version="5.3.2" />
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.10" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\BarBusinessLogic\BarBusinessLogic\BarBusinessLogic.csproj" />
|
<ProjectReference Include="..\BarBusinessLogic\BarBusinessLogic\BarBusinessLogic.csproj" />
|
||||||
|
<ProjectReference Include="..\BarContracts\BarContracts\BarContracts.csproj" />
|
||||||
<ProjectReference Include="..\BarDatabaseImplement\BarDatabaseImplement\BarDatabaseImplement.csproj" />
|
<ProjectReference Include="..\BarDatabaseImplement\BarDatabaseImplement\BarDatabaseImplement.csproj" />
|
||||||
<ProjectReference Include="..\BarFileImplement\BarFileImplement\BarFileImplement.csproj" />
|
<ProjectReference Include="..\BarFileImplement\BarFileImplement\BarFileImplement.csproj" />
|
||||||
<ProjectReference Include="..\BarListImplement\BarListImplement\BarListImplement.csproj" />
|
<ProjectReference Include="..\BarListImplement\BarListImplement\BarListImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="ReportOrder.rdlc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is automatically generated by Visual Studio .Net. It is
|
||||||
|
used to store generic object data source configuration information.
|
||||||
|
Renaming the file extension or editing the content of this file may
|
||||||
|
cause the file to be unrecognizable by the program.
|
||||||
|
-->
|
||||||
|
<GenericObjectDataSource DisplayName="ICocktailLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||||
|
<TypeInfo>BarContracts.BusinessLogicContracts.ICocktailLogic, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||||
|
</GenericObjectDataSource>
|
42
Bar/Bar/FormMain.Designer.cs
generated
42
Bar/Bar/FormMain.Designer.cs
generated
@ -38,6 +38,10 @@
|
|||||||
this.ToolStripMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.ToolStripMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ComponentsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ComponentsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.CocktailStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.CocktailStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -106,7 +110,8 @@
|
|||||||
//
|
//
|
||||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.ToolStripMenu});
|
this.ToolStripMenu,
|
||||||
|
this.отчётыToolStripMenuItem});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1279, 28);
|
this.menuStrip1.Size = new System.Drawing.Size(1279, 28);
|
||||||
@ -136,6 +141,37 @@
|
|||||||
this.CocktailStripMenuItem.Text = "Коктейль";
|
this.CocktailStripMenuItem.Text = "Коктейль";
|
||||||
this.CocktailStripMenuItem.Click += new System.EventHandler(this.CocktailsStripMenuItem_Click);
|
this.CocktailStripMenuItem.Click += new System.EventHandler(this.CocktailsStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// отчётыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.списокКомпонентовToolStripMenuItem,
|
||||||
|
this.компонентыПоИзделиямToolStripMenuItem,
|
||||||
|
this.списокЗаказовToolStripMenuItem});
|
||||||
|
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||||
|
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
|
||||||
|
this.отчётыToolStripMenuItem.Text = "Отчёты";
|
||||||
|
//
|
||||||
|
// списокКомпонентовToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
||||||
|
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
|
||||||
|
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
||||||
|
this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// компонентыПоИзделиямToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
||||||
|
this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
|
||||||
|
this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по коктейлям";
|
||||||
|
this.компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.ComponentCocktailToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// списокЗаказовToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||||
|
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
|
||||||
|
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||||
|
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
@ -171,5 +207,9 @@
|
|||||||
private ToolStripMenuItem ToolStripMenu;
|
private ToolStripMenuItem ToolStripMenu;
|
||||||
private ToolStripMenuItem ComponentsStripMenuItem;
|
private ToolStripMenuItem ComponentsStripMenuItem;
|
||||||
private ToolStripMenuItem CocktailStripMenuItem;
|
private ToolStripMenuItem CocktailStripMenuItem;
|
||||||
|
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,12 +9,14 @@ namespace BarView
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
public FormMain(ILogger<FormMain> Logger, IOrderLogic OrderLogic)
|
private readonly IReportLogic _reportLogic;
|
||||||
|
public FormMain(ILogger<FormMain> Logger, IOrderLogic OrderLogic, IReportLogic ReportLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_logger = Logger;
|
_logger = Logger;
|
||||||
_orderLogic = OrderLogic;
|
_orderLogic = OrderLogic;
|
||||||
|
_reportLogic = ReportLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -164,5 +166,35 @@ namespace BarView
|
|||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var Dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
|
|
||||||
|
if (Dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel { FileName = Dialog.FileName });
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ComponentCocktailToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var Service = Program.ServiceProvider?.GetService(typeof(FormReportCocktailComponents));
|
||||||
|
|
||||||
|
if (Service is FormReportCocktailComponents Form)
|
||||||
|
{
|
||||||
|
Form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var Service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||||
|
|
||||||
|
if (Service is FormReportOrders Form)
|
||||||
|
{
|
||||||
|
Form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
107
Bar/Bar/Forms/FormReportCocktailComponents.Designer.cs
generated
Normal file
107
Bar/Bar/Forms/FormReportCocktailComponents.Designer.cs
generated
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
namespace BarView.Forms
|
||||||
|
{
|
||||||
|
partial class FormReportCocktailComponents
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.ButtonSaveToExcel = new System.Windows.Forms.Button();
|
||||||
|
this.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ButtonSaveToExcel
|
||||||
|
//
|
||||||
|
this.ButtonSaveToExcel.Location = new System.Drawing.Point(31, 12);
|
||||||
|
this.ButtonSaveToExcel.Name = "ButtonSaveToExcel";
|
||||||
|
this.ButtonSaveToExcel.Size = new System.Drawing.Size(162, 26);
|
||||||
|
this.ButtonSaveToExcel.TabIndex = 0;
|
||||||
|
this.ButtonSaveToExcel.Text = "Сохранить в Excel";
|
||||||
|
this.ButtonSaveToExcel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
|
this.Column1,
|
||||||
|
this.Column2,
|
||||||
|
this.Column3});
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(12, 56);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 29;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(581, 368);
|
||||||
|
this.DataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// Column1
|
||||||
|
//
|
||||||
|
this.Column1.HeaderText = "Коктейль";
|
||||||
|
this.Column1.MinimumWidth = 6;
|
||||||
|
this.Column1.Name = "Column1";
|
||||||
|
this.Column1.Width = 125;
|
||||||
|
//
|
||||||
|
// Column2
|
||||||
|
//
|
||||||
|
this.Column2.HeaderText = "Компонент";
|
||||||
|
this.Column2.MinimumWidth = 6;
|
||||||
|
this.Column2.Name = "Column2";
|
||||||
|
this.Column2.Width = 125;
|
||||||
|
//
|
||||||
|
// Column3
|
||||||
|
//
|
||||||
|
this.Column3.HeaderText = "Количество";
|
||||||
|
this.Column3.MinimumWidth = 6;
|
||||||
|
this.Column3.Name = "Column3";
|
||||||
|
this.Column3.Width = 125;
|
||||||
|
//
|
||||||
|
// FormReportCocktailComponents
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Controls.Add(this.ButtonSaveToExcel);
|
||||||
|
this.Name = "FormReportCocktailComponents";
|
||||||
|
this.Text = "FormReportCoctailComponents";
|
||||||
|
this.Load += new System.EventHandler(this.FormReportCoctailComponents_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button ButtonSaveToExcel;
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private DataGridViewTextBoxColumn Column1;
|
||||||
|
private DataGridViewTextBoxColumn Column2;
|
||||||
|
private DataGridViewTextBoxColumn Column3;
|
||||||
|
}
|
||||||
|
}
|
75
Bar/Bar/Forms/FormReportCocktailComponents.cs
Normal file
75
Bar/Bar/Forms/FormReportCocktailComponents.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using BarContracts.BindingModels;
|
||||||
|
using BarContracts.BusinessLogicContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace BarView.Forms
|
||||||
|
{
|
||||||
|
public partial class FormReportCocktailComponents : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IReportLogic _logic;
|
||||||
|
|
||||||
|
public FormReportCocktailComponents(ILogger<FormReportCocktailComponents> Logger, IReportLogic Logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_logger = Logger;
|
||||||
|
_logic = Logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormReportCoctailComponents_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var Dict = _logic.GetCocktailComponents();
|
||||||
|
|
||||||
|
if (Dict != null)
|
||||||
|
{
|
||||||
|
DataGridView.Rows.Clear();
|
||||||
|
|
||||||
|
foreach (var Elem in Dict)
|
||||||
|
{
|
||||||
|
DataGridView.Rows.Add(new object[] { Elem.CocktailName, "", "" });
|
||||||
|
|
||||||
|
foreach (var ListElem in Elem.Components)
|
||||||
|
DataGridView.Rows.Add(new object[] { "", ListElem.Item1, ListElem.Item2 });
|
||||||
|
|
||||||
|
DataGridView.Rows.Add(new object[] { "Итого", "", Elem.TotalCount });
|
||||||
|
DataGridView.Rows.Add(Array.Empty<object>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка списка Коктейльов по компонентам");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка Коктейльов по компонентам");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var Dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||||
|
|
||||||
|
if (Dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logic.SaveCocktailComponentToExcelFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = Dialog.FileName
|
||||||
|
});
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение списка Коктейльов по компонентам");
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения списка Коктейльов по компонентам");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
69
Bar/Bar/Forms/FormReportCocktailComponents.resx
Normal file
69
Bar/Bar/Forms/FormReportCocktailComponents.resx
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
131
Bar/Bar/Forms/FormReportOrders.Designer.cs
generated
Normal file
131
Bar/Bar/Forms/FormReportOrders.Designer.cs
generated
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
namespace BarView.Forms
|
||||||
|
{
|
||||||
|
partial class FormReportOrders
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.Panel = new System.Windows.Forms.Panel();
|
||||||
|
this.ToPdfButton = new System.Windows.Forms.Button();
|
||||||
|
this.CreateButton = new System.Windows.Forms.Button();
|
||||||
|
this.ToDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.ToLabel = new System.Windows.Forms.Label();
|
||||||
|
this.FromDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.FromLabel = new System.Windows.Forms.Label();
|
||||||
|
this.Panel.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// Panel
|
||||||
|
//
|
||||||
|
this.Panel.Controls.Add(this.ToPdfButton);
|
||||||
|
this.Panel.Controls.Add(this.CreateButton);
|
||||||
|
this.Panel.Controls.Add(this.ToDateTimePicker);
|
||||||
|
this.Panel.Controls.Add(this.ToLabel);
|
||||||
|
this.Panel.Controls.Add(this.FromDateTimePicker);
|
||||||
|
this.Panel.Controls.Add(this.FromLabel);
|
||||||
|
this.Panel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.Panel.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.Panel.Name = "Panel";
|
||||||
|
this.Panel.Size = new System.Drawing.Size(1105, 52);
|
||||||
|
this.Panel.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ToPdfButton
|
||||||
|
//
|
||||||
|
this.ToPdfButton.Location = new System.Drawing.Point(781, 9);
|
||||||
|
this.ToPdfButton.Name = "ToPdfButton";
|
||||||
|
this.ToPdfButton.Size = new System.Drawing.Size(165, 29);
|
||||||
|
this.ToPdfButton.TabIndex = 5;
|
||||||
|
this.ToPdfButton.Text = "В PDF";
|
||||||
|
this.ToPdfButton.UseVisualStyleBackColor = true;
|
||||||
|
this.ToPdfButton.Click += new System.EventHandler(this.ButtonToPdf_Click);
|
||||||
|
//
|
||||||
|
// CreateButton
|
||||||
|
//
|
||||||
|
this.CreateButton.Location = new System.Drawing.Point(542, 11);
|
||||||
|
this.CreateButton.Name = "CreateButton";
|
||||||
|
this.CreateButton.Size = new System.Drawing.Size(165, 29);
|
||||||
|
this.CreateButton.TabIndex = 4;
|
||||||
|
this.CreateButton.Text = "Сформировать";
|
||||||
|
this.CreateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.CreateButton.Click += new System.EventHandler(this.ButtonMake_Click);
|
||||||
|
//
|
||||||
|
// ToDateTimePicker
|
||||||
|
//
|
||||||
|
this.ToDateTimePicker.Location = new System.Drawing.Point(299, 9);
|
||||||
|
this.ToDateTimePicker.Name = "ToDateTimePicker";
|
||||||
|
this.ToDateTimePicker.Size = new System.Drawing.Size(199, 27);
|
||||||
|
this.ToDateTimePicker.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// ToLabel
|
||||||
|
//
|
||||||
|
this.ToLabel.AutoSize = true;
|
||||||
|
this.ToLabel.Location = new System.Drawing.Point(254, 13);
|
||||||
|
this.ToLabel.Name = "ToLabel";
|
||||||
|
this.ToLabel.Size = new System.Drawing.Size(27, 20);
|
||||||
|
this.ToLabel.TabIndex = 2;
|
||||||
|
this.ToLabel.Text = "по";
|
||||||
|
//
|
||||||
|
// FromDateTimePicker
|
||||||
|
//
|
||||||
|
this.FromDateTimePicker.Location = new System.Drawing.Point(37, 9);
|
||||||
|
this.FromDateTimePicker.Name = "FromDateTimePicker";
|
||||||
|
this.FromDateTimePicker.Size = new System.Drawing.Size(199, 27);
|
||||||
|
this.FromDateTimePicker.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FromLabel
|
||||||
|
//
|
||||||
|
this.FromLabel.AutoSize = true;
|
||||||
|
this.FromLabel.Location = new System.Drawing.Point(11, 13);
|
||||||
|
this.FromLabel.Name = "FromLabel";
|
||||||
|
this.FromLabel.Size = new System.Drawing.Size(18, 20);
|
||||||
|
this.FromLabel.TabIndex = 0;
|
||||||
|
this.FromLabel.Text = "C";
|
||||||
|
//
|
||||||
|
// FormReportOrders
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1105, 451);
|
||||||
|
this.Controls.Add(this.Panel);
|
||||||
|
this.Name = "FormReportOrders";
|
||||||
|
this.Text = "Заказы";
|
||||||
|
this.Panel.ResumeLayout(false);
|
||||||
|
this.Panel.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel Panel;
|
||||||
|
private Button ToPdfButton;
|
||||||
|
private Button CreateButton;
|
||||||
|
private DateTimePicker ToDateTimePicker;
|
||||||
|
private Label ToLabel;
|
||||||
|
private DateTimePicker FromDateTimePicker;
|
||||||
|
private Label FromLabel;
|
||||||
|
}
|
||||||
|
}
|
100
Bar/Bar/Forms/FormReportOrders.cs
Normal file
100
Bar/Bar/Forms/FormReportOrders.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
using BarContracts.BindingModels;
|
||||||
|
using BarContracts.BusinessLogicContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Reporting.WinForms;
|
||||||
|
|
||||||
|
namespace BarView.Forms
|
||||||
|
{
|
||||||
|
public partial class FormReportOrders : Form
|
||||||
|
{
|
||||||
|
private readonly ReportViewer _reportViewer;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IReportLogic _logic;
|
||||||
|
|
||||||
|
public FormReportOrders(ILogger<FormReportOrders> Logger, IReportLogic Logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = Logger;
|
||||||
|
_logic = Logic;
|
||||||
|
|
||||||
|
_reportViewer = new ReportViewer
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Fill
|
||||||
|
};
|
||||||
|
_reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrder.rdlc", FileMode.Open));
|
||||||
|
|
||||||
|
Controls.Clear();
|
||||||
|
Controls.Add(_reportViewer);
|
||||||
|
Controls.Add(Panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonMake_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (FromDateTimePicker.Value.Date >= ToDateTimePicker.Value.Date)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var DataSource = _logic.GetOrders(new ReportBindingModel
|
||||||
|
{
|
||||||
|
DateFrom = FromDateTimePicker.Value,
|
||||||
|
DateTo = ToDateTimePicker.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
var Source = new ReportDataSource("DataSetOrders", DataSource);
|
||||||
|
|
||||||
|
_reportViewer.LocalReport.DataSources.Clear();
|
||||||
|
_reportViewer.LocalReport.DataSources.Add(Source);
|
||||||
|
|
||||||
|
var Parameters = new[] {
|
||||||
|
new ReportParameter("ReportParameterPeriod", $"c {FromDateTimePicker.Value.ToShortDateString()} по {ToDateTimePicker.Value.ToShortDateString()}")
|
||||||
|
};
|
||||||
|
_reportViewer.LocalReport.SetParameters(Parameters);
|
||||||
|
|
||||||
|
_reportViewer.RefreshReport();
|
||||||
|
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", FromDateTimePicker.Value.ToShortDateString(), ToDateTimePicker.Value.ToShortDateString());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка заказов на период");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonToPdf_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (FromDateTimePicker.Value.Date >= ToDateTimePicker.Value.Date)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var Dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||||
|
|
||||||
|
if (Dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||||
|
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = Dialog.FileName,
|
||||||
|
DateFrom = FromDateTimePicker.Value,
|
||||||
|
DateTo = ToDateTimePicker.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", FromDateTimePicker.Value.ToShortDateString(), ToDateTimePicker.Value.ToShortDateString());
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Bar/Bar/Forms/FormReportOrders.resx
Normal file
60
Bar/Bar/Forms/FormReportOrders.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,4 +1,6 @@
|
|||||||
using BarBusinessLogic.BusinessLogics;
|
using BarBusinessLogic.BusinessLogics;
|
||||||
|
using BarBusinessLogic.OfficePackage.Implements;
|
||||||
|
using BarBusinessLogic.OfficePackage;
|
||||||
using BarContracts.BusinessLogicContracts;
|
using BarContracts.BusinessLogicContracts;
|
||||||
using BarContracts.StoragesContracts;
|
using BarContracts.StoragesContracts;
|
||||||
using BarDatabaseImplement.Implements;
|
using BarDatabaseImplement.Implements;
|
||||||
@ -38,9 +40,15 @@ namespace BarView
|
|||||||
Services.AddTransient<IComponentStorage, ComponentStorage>();
|
Services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||||
Services.AddTransient<IOrderStorage, OrderStorage>();
|
Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
Services.AddTransient<ICocktailStorage, CocktailStorage>();
|
Services.AddTransient<ICocktailStorage, CocktailStorage>();
|
||||||
|
|
||||||
Services.AddTransient<IComponentLogic, ComponentLogic>();
|
Services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
Services.AddTransient<IOrderLogic, OrderLogic>();
|
Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
Services.AddTransient<ICocktailLogic, CocktailLogic>();
|
Services.AddTransient<ICocktailLogic, CocktailLogic>();
|
||||||
|
Services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
|
||||||
|
Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
|
Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
|
Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
|
|
||||||
Services.AddTransient<FormMain>();
|
Services.AddTransient<FormMain>();
|
||||||
Services.AddTransient<FormComponent>();
|
Services.AddTransient<FormComponent>();
|
||||||
@ -49,6 +57,8 @@ namespace BarView
|
|||||||
Services.AddTransient<FormCocktail>();
|
Services.AddTransient<FormCocktail>();
|
||||||
Services.AddTransient<FormCocktailComponent>();
|
Services.AddTransient<FormCocktailComponent>();
|
||||||
Services.AddTransient<FormCocktails>();
|
Services.AddTransient<FormCocktails>();
|
||||||
|
Services.AddTransient<FormReportCocktailComponents>();
|
||||||
|
Services.AddTransient<FormReportOrders>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is automatically generated by Visual Studio .Net. It is
|
||||||
|
used to store generic object data source configuration information.
|
||||||
|
Renaming the file extension or editing the content of this file may
|
||||||
|
cause the file to be unrecognizable by the program.
|
||||||
|
-->
|
||||||
|
<GenericObjectDataSource DisplayName="IComponentLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||||
|
<TypeInfo>BarContracts.BusinessLogicContracts.IComponentLogic, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||||
|
</GenericObjectDataSource>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is automatically generated by Visual Studio .Net. It is
|
||||||
|
used to store generic object data source configuration information.
|
||||||
|
Renaming the file extension or editing the content of this file may
|
||||||
|
cause the file to be unrecognizable by the program.
|
||||||
|
-->
|
||||||
|
<GenericObjectDataSource DisplayName="IOrderLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||||
|
<TypeInfo>BarContracts.BusinessLogicContracts.IOrderLogic, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||||
|
</GenericObjectDataSource>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is automatically generated by Visual Studio .Net. It is
|
||||||
|
used to store generic object data source configuration information.
|
||||||
|
Renaming the file extension or editing the content of this file may
|
||||||
|
cause the file to be unrecognizable by the program.
|
||||||
|
-->
|
||||||
|
<GenericObjectDataSource DisplayName="ICocktailStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||||
|
<TypeInfo>BarContracts.StoragesContracts.ICocktailStorage, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||||
|
</GenericObjectDataSource>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is automatically generated by Visual Studio .Net. It is
|
||||||
|
used to store generic object data source configuration information.
|
||||||
|
Renaming the file extension or editing the content of this file may
|
||||||
|
cause the file to be unrecognizable by the program.
|
||||||
|
-->
|
||||||
|
<GenericObjectDataSource DisplayName="IComponentStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||||
|
<TypeInfo>BarContracts.StoragesContracts.IComponentStorage, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||||
|
</GenericObjectDataSource>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is automatically generated by Visual Studio .Net. It is
|
||||||
|
used to store generic object data source configuration information.
|
||||||
|
Renaming the file extension or editing the content of this file may
|
||||||
|
cause the file to be unrecognizable by the program.
|
||||||
|
-->
|
||||||
|
<GenericObjectDataSource DisplayName="IOrderStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||||
|
<TypeInfo>BarContracts.StoragesContracts.IOrderStorage, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||||
|
</GenericObjectDataSource>
|
572
Bar/Bar/ReportOrder.rdlc
Normal file
572
Bar/Bar/ReportOrder.rdlc
Normal file
@ -0,0 +1,572 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
||||||
|
<AutoRefresh>0</AutoRefresh>
|
||||||
|
<DataSources>
|
||||||
|
<DataSource Name="BarContractsViewModels">
|
||||||
|
<ConnectionProperties>
|
||||||
|
<DataProvider>System.Data.DataSet</DataProvider>
|
||||||
|
<ConnectString>/* Local Connection */</ConnectString>
|
||||||
|
</ConnectionProperties>
|
||||||
|
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
||||||
|
</DataSource>
|
||||||
|
</DataSources>
|
||||||
|
<DataSets>
|
||||||
|
<DataSet Name="DataSetOrders">
|
||||||
|
<Query>
|
||||||
|
<DataSourceName>BarContractsViewModels</DataSourceName>
|
||||||
|
<CommandText>/* Local Query */</CommandText>
|
||||||
|
</Query>
|
||||||
|
<Fields>
|
||||||
|
<Field Name="Id">
|
||||||
|
<DataField>Id</DataField>
|
||||||
|
<rd:TypeName>System.Int32</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="DateCreate">
|
||||||
|
<DataField>DateCreate</DataField>
|
||||||
|
<rd:TypeName>System.DateTime</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="CocktailName">
|
||||||
|
<DataField>CocktailName</DataField>
|
||||||
|
<rd:TypeName>System.String</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Sum">
|
||||||
|
<DataField>Sum</DataField>
|
||||||
|
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Status">
|
||||||
|
<DataField>Status</DataField>
|
||||||
|
<rd:TypeName>System.String</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
</Fields>
|
||||||
|
<rd:DataSetInfo>
|
||||||
|
<rd:DataSetName>BarContracts.ViewModels</rd:DataSetName>
|
||||||
|
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
||||||
|
<rd:ObjectDataSourceType>BarContracts.ViewModels.ReportOrdersViewModel, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||||
|
</rd:DataSetInfo>
|
||||||
|
</DataSet>
|
||||||
|
</DataSets>
|
||||||
|
<ReportSections>
|
||||||
|
<ReportSection>
|
||||||
|
<Body>
|
||||||
|
<ReportItems>
|
||||||
|
<Textbox Name="TextboxTitle">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Заказы</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Center</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>22.058cm</Width>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<VerticalAlign>Middle</VerticalAlign>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Textbox Name="ReportParameterPeriod">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Center</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
||||||
|
<Top>0.6cm</Top>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>22.058cm</Width>
|
||||||
|
<ZIndex>1</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<VerticalAlign>Middle</VerticalAlign>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Tablix Name="Tablix">
|
||||||
|
<TablixBody>
|
||||||
|
<TablixColumns>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>2.60583cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>5.27517cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>6.1195cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>4.76483cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
</TablixColumns>
|
||||||
|
<TablixRows>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="TextboxId">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Номер</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="TextboxDateCreate">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Дата создания</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="TextboxCocktailName">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Коктейль</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox2">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Статус</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox2</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="TextboxSum">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Сумма</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Id">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Id.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Id</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="DateCreate">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!DateCreate.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>DateCreate</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="CocktailName">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!CocktailName.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>CocktailName</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Status1">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Status.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Status1</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Sum">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Sum.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Sum</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
</TablixRows>
|
||||||
|
</TablixBody>
|
||||||
|
<TablixColumnHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixColumnHierarchy>
|
||||||
|
<TablixRowHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember>
|
||||||
|
<KeepWithGroup>After</KeepWithGroup>
|
||||||
|
</TablixMember>
|
||||||
|
<TablixMember>
|
||||||
|
<Group Name="Подробности" />
|
||||||
|
</TablixMember>
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixRowHierarchy>
|
||||||
|
<DataSetName>DataSetOrders</DataSetName>
|
||||||
|
<Top>1.9177cm</Top>
|
||||||
|
<Left>0.79267cm</Left>
|
||||||
|
<Height>1.2cm</Height>
|
||||||
|
<Width>21.26533cm</Width>
|
||||||
|
<ZIndex>2</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
</Style>
|
||||||
|
</Tablix>
|
||||||
|
<Textbox Name="TextboxResout">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Итого:</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Right</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Top>3.46287cm</Top>
|
||||||
|
<Left>16.61349cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>3</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Textbox Name="Textbox10">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox10</rd:DefaultName>
|
||||||
|
<Top>3.46287cm</Top>
|
||||||
|
<Left>19.11349cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>4</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</ReportItems>
|
||||||
|
<Height>2in</Height>
|
||||||
|
<Style />
|
||||||
|
</Body>
|
||||||
|
<Width>8.68425in</Width>
|
||||||
|
<Page>
|
||||||
|
<PageHeight>29.7cm</PageHeight>
|
||||||
|
<PageWidth>21cm</PageWidth>
|
||||||
|
<LeftMargin>2cm</LeftMargin>
|
||||||
|
<RightMargin>2cm</RightMargin>
|
||||||
|
<TopMargin>2cm</TopMargin>
|
||||||
|
<BottomMargin>2cm</BottomMargin>
|
||||||
|
<ColumnSpacing>0.13cm</ColumnSpacing>
|
||||||
|
<Style />
|
||||||
|
</Page>
|
||||||
|
</ReportSection>
|
||||||
|
</ReportSections>
|
||||||
|
<ReportParameters>
|
||||||
|
<ReportParameter Name="ReportParameterPeriod">
|
||||||
|
<DataType>String</DataType>
|
||||||
|
<Nullable>true</Nullable>
|
||||||
|
<Prompt>ReportParameter1</Prompt>
|
||||||
|
</ReportParameter>
|
||||||
|
</ReportParameters>
|
||||||
|
<ReportParametersLayout>
|
||||||
|
<GridLayoutDefinition>
|
||||||
|
<NumberOfColumns>4</NumberOfColumns>
|
||||||
|
<NumberOfRows>2</NumberOfRows>
|
||||||
|
<CellDefinitions>
|
||||||
|
<CellDefinition>
|
||||||
|
<ColumnIndex>0</ColumnIndex>
|
||||||
|
<RowIndex>0</RowIndex>
|
||||||
|
<ParameterName>ReportParameterPeriod</ParameterName>
|
||||||
|
</CellDefinition>
|
||||||
|
</CellDefinitions>
|
||||||
|
</GridLayoutDefinition>
|
||||||
|
</ReportParametersLayout>
|
||||||
|
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
||||||
|
<rd:ReportID>0c9e94bc-df40-42bd-a526-01713dd3057f</rd:ReportID>
|
||||||
|
</Report>
|
@ -6,12 +6,28 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
|
||||||
|
<PackageReference Include="NLog" Version="5.3.2" />
|
||||||
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" />
|
||||||
|
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||||
|
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\BarContracts\BarContracts\BarContracts.csproj" />
|
<ProjectReference Include="..\..\BarContracts\BarContracts\BarContracts.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="OfficePackage\HelperModels\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="foldername\**" CopyToPublishDirectory="Always" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -0,0 +1,90 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage;
|
||||||
|
using BarBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using BarContracts.BindingModels;
|
||||||
|
using BarContracts.BusinessLogicContracts;
|
||||||
|
using BarContracts.SearchModels;
|
||||||
|
using BarContracts.StoragesContracts;
|
||||||
|
using BarContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class ReportLogic : IReportLogic
|
||||||
|
{
|
||||||
|
private readonly IComponentStorage _componentStorage;
|
||||||
|
private readonly ICocktailStorage _CocktailStorage;
|
||||||
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
private readonly AbstractSaveToExcel _saveToExcel;
|
||||||
|
private readonly AbstractSaveToWord _saveToWord;
|
||||||
|
private readonly AbstractSaveToPdf _saveToPdf;
|
||||||
|
|
||||||
|
public ReportLogic(ICocktailStorage CocktailStorage, IComponentStorage ComponentStorage, IOrderStorage OrderStorage,
|
||||||
|
AbstractSaveToExcel SaveToExcel, AbstractSaveToWord SaveToWord, AbstractSaveToPdf SaveToPdf)
|
||||||
|
{
|
||||||
|
_CocktailStorage = CocktailStorage;
|
||||||
|
_componentStorage = ComponentStorage;
|
||||||
|
_orderStorage = OrderStorage;
|
||||||
|
|
||||||
|
_saveToExcel = SaveToExcel;
|
||||||
|
_saveToWord = SaveToWord;
|
||||||
|
_saveToPdf = SaveToPdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportCocktailComponentViewModel> GetCocktailComponents()
|
||||||
|
{
|
||||||
|
return _CocktailStorage.GetFullList().
|
||||||
|
Select(x => new ReportCocktailComponentViewModel
|
||||||
|
{
|
||||||
|
CocktailName = x.CocktailName,
|
||||||
|
Components = x.CocktailComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
|
||||||
|
TotalCount = x.CocktailComponents.Select(x => x.Value.Item2).Sum()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel Model)
|
||||||
|
{
|
||||||
|
return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = Model.DateFrom, DateTo = Model.DateTo })
|
||||||
|
.Select(x => new ReportOrdersViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
DateCreate = x.DateCreate,
|
||||||
|
CocktailName = x.CocktailName,
|
||||||
|
Sum = x.Sum,
|
||||||
|
Status = x.Status.ToString()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveComponentsToWordFile(ReportBindingModel Model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
|
{
|
||||||
|
FileName = Model.FileName,
|
||||||
|
Title = "Список Коктейлей",
|
||||||
|
Cocktails = _CocktailStorage.GetFullList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveCocktailComponentToExcelFile(ReportBindingModel Model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
|
{
|
||||||
|
FileName = Model.FileName,
|
||||||
|
Title = "Список компонентов",
|
||||||
|
CocktailComponents = GetCocktailComponents()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveOrdersToPdfFile(ReportBindingModel Model)
|
||||||
|
{
|
||||||
|
_saveToPdf.CreateDoc(new PdfInfo
|
||||||
|
{
|
||||||
|
FileName = Model.FileName,
|
||||||
|
Title = "Список заказов",
|
||||||
|
DateFrom = Model.DateFrom!.Value,
|
||||||
|
DateTo = Model.DateTo!.Value,
|
||||||
|
Orders = GetOrders(Model)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using BarBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToExcel
|
||||||
|
{
|
||||||
|
public void CreateReport(ExcelInfo Info)
|
||||||
|
{
|
||||||
|
CreateExcel(Info);
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = 1,
|
||||||
|
Text = Info.Title,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
|
});
|
||||||
|
|
||||||
|
MergeCells(new ExcelMergeParameters
|
||||||
|
{
|
||||||
|
CellFromName = "A1",
|
||||||
|
CellToName = "C1"
|
||||||
|
});
|
||||||
|
|
||||||
|
uint RowIndex = 2;
|
||||||
|
|
||||||
|
foreach (var RepComp in Info.CocktailComponents)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = RowIndex,
|
||||||
|
Text = RepComp.CocktailName,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
|
||||||
|
RowIndex++;
|
||||||
|
|
||||||
|
foreach (var (Component, Count) in RepComp.Components)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "B",
|
||||||
|
RowIndex = RowIndex,
|
||||||
|
Text = Component,
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
|
});
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = RowIndex,
|
||||||
|
Text = Count.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
|
});
|
||||||
|
|
||||||
|
RowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = RowIndex,
|
||||||
|
Text = "Итого",
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = RowIndex,
|
||||||
|
Text = RepComp.TotalCount.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
RowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveExcel(Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void CreateExcel(ExcelInfo Info);
|
||||||
|
|
||||||
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters ExcelParams);
|
||||||
|
|
||||||
|
protected abstract void MergeCells(ExcelMergeParameters ExcelParams);
|
||||||
|
|
||||||
|
protected abstract void SaveExcel(ExcelInfo Info);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using BarBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToPdf
|
||||||
|
{
|
||||||
|
public void CreateDoc(PdfInfo Info)
|
||||||
|
{
|
||||||
|
CreatePdf(Info);
|
||||||
|
CreateParagraph(new PdfParagraph { Text = Info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||||
|
CreateParagraph(new PdfParagraph { Text = $"с {Info.DateFrom.ToShortDateString()} по {Info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||||
|
|
||||||
|
CreateTable(new List<string> { "2cm", "3cm", "3cm", "4cm", "3cm" });
|
||||||
|
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Номер", "Дата заказа", "Коктейль", "Статус", "Сумма" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var order in Info.Orders)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.CocktailName, order.Status.ToString(), order.Sum.ToString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
}
|
||||||
|
CreateParagraph(new PdfParagraph { Text = $"Итого: {Info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth });
|
||||||
|
|
||||||
|
SavePdf(Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void CreatePdf(PdfInfo Info);
|
||||||
|
|
||||||
|
protected abstract void CreateParagraph(PdfParagraph Paragraph);
|
||||||
|
|
||||||
|
protected abstract void CreateTable(List<string> Columns);
|
||||||
|
|
||||||
|
protected abstract void CreateRow(PdfRowParameters RowParameters);
|
||||||
|
|
||||||
|
protected abstract void SavePdf(PdfInfo Info);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using BarBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToWord
|
||||||
|
{
|
||||||
|
public void CreateDoc(WordInfo Info)
|
||||||
|
{
|
||||||
|
CreateWord(Info);
|
||||||
|
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)> { (Info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Center
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var Cocktails in Info.Cocktails)
|
||||||
|
{
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)> {
|
||||||
|
(Cocktails.CocktailName, new WordTextProperties { Size = "24", Bold = true}),
|
||||||
|
("\t"+Cocktails.Price.ToString(), new WordTextProperties{Size = "24"})
|
||||||
|
|
||||||
|
},
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveWord(Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void CreateWord(WordInfo Info);
|
||||||
|
|
||||||
|
protected abstract void CreateParagraph(WordParagraph Paragraph);
|
||||||
|
|
||||||
|
protected abstract void SaveWord(WordInfo Info);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace BarBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum ExcelStyleInfoType
|
||||||
|
{
|
||||||
|
Title,
|
||||||
|
Text,
|
||||||
|
TextWithBroder
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace BarBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum PdfParagraphAlignmentType
|
||||||
|
{
|
||||||
|
Center,
|
||||||
|
Left,
|
||||||
|
Rigth
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace BarBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum WordJustificationType
|
||||||
|
{
|
||||||
|
Center,
|
||||||
|
Both
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class ExcelCellParameters
|
||||||
|
{
|
||||||
|
public string ColumnName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public uint RowIndex { get; set; }
|
||||||
|
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string CellReference => $"{ColumnName}{RowIndex}";
|
||||||
|
|
||||||
|
public ExcelStyleInfoType StyleInfo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using BarContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class ExcelInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public List<ReportCocktailComponentViewModel> CocktailComponents { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class ExcelMergeParameters
|
||||||
|
{
|
||||||
|
public string CellFromName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string CellToName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Merge => $"{CellFromName}:{CellToName}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using BarContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class PdfInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateFrom { get; set; }
|
||||||
|
|
||||||
|
public DateTime DateTo { get; set; }
|
||||||
|
|
||||||
|
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class PdfParagraph
|
||||||
|
{
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Style { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class PdfRowParameters
|
||||||
|
{
|
||||||
|
public List<string> Texts { get; set; } = new();
|
||||||
|
|
||||||
|
public string Style { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using BarContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public List<CocktailViewModel> Cocktails { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordParagraph
|
||||||
|
{
|
||||||
|
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||||
|
|
||||||
|
public WordTextProperties? TextProperties { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordTextProperties
|
||||||
|
{
|
||||||
|
public string Size { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public bool Bold { get; set; }
|
||||||
|
|
||||||
|
public WordJustificationType JustificationType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,281 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using BarBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using DocumentFormat.OpenXml;
|
||||||
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToExcel : AbstractSaveToExcel
|
||||||
|
{
|
||||||
|
private SpreadsheetDocument? _spreadsheetDocument;
|
||||||
|
private SharedStringTablePart? _shareStringPart;
|
||||||
|
private Worksheet? _worksheet;
|
||||||
|
|
||||||
|
private static void CreateStyles(WorkbookPart WorkbookPart)
|
||||||
|
{
|
||||||
|
var sp = WorkbookPart.AddNewPart<WorkbookStylesPart>();
|
||||||
|
sp.Stylesheet = new Stylesheet();
|
||||||
|
|
||||||
|
var Fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||||
|
|
||||||
|
var FontUsual = new Font();
|
||||||
|
FontUsual.Append(new FontSize() { Val = 12D });
|
||||||
|
FontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||||
|
FontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||||
|
FontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||||
|
FontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||||
|
|
||||||
|
var FontTitle = new Font();
|
||||||
|
FontTitle.Append(new Bold());
|
||||||
|
FontTitle.Append(new FontSize() { Val = 14D });
|
||||||
|
FontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||||
|
FontTitle.Append(new FontName() { Val = "Times New Roman" });
|
||||||
|
FontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
||||||
|
FontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||||
|
|
||||||
|
Fonts.Append(FontUsual);
|
||||||
|
Fonts.Append(FontTitle);
|
||||||
|
|
||||||
|
var Fills = new Fills() { Count = 2U };
|
||||||
|
|
||||||
|
var Fill1 = new Fill();
|
||||||
|
Fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
||||||
|
|
||||||
|
var Fill2 = new Fill();
|
||||||
|
Fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 });
|
||||||
|
|
||||||
|
Fills.Append(Fill1);
|
||||||
|
Fills.Append(Fill2);
|
||||||
|
|
||||||
|
var Borders = new Borders() { Count = 2U };
|
||||||
|
|
||||||
|
var BorderNoBorder = new Border();
|
||||||
|
BorderNoBorder.Append(new LeftBorder());
|
||||||
|
BorderNoBorder.Append(new RightBorder());
|
||||||
|
BorderNoBorder.Append(new TopBorder());
|
||||||
|
BorderNoBorder.Append(new BottomBorder());
|
||||||
|
BorderNoBorder.Append(new DiagonalBorder());
|
||||||
|
|
||||||
|
var BorderThin = new Border();
|
||||||
|
|
||||||
|
var LeftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
LeftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||||
|
|
||||||
|
var RightBorder = new RightBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
RightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||||
|
|
||||||
|
var TopBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
TopBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||||
|
|
||||||
|
var BottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
BottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||||
|
|
||||||
|
BorderThin.Append(LeftBorder);
|
||||||
|
BorderThin.Append(RightBorder);
|
||||||
|
BorderThin.Append(TopBorder);
|
||||||
|
BorderThin.Append(BottomBorder);
|
||||||
|
BorderThin.Append(new DiagonalBorder());
|
||||||
|
|
||||||
|
Borders.Append(BorderNoBorder);
|
||||||
|
Borders.Append(BorderThin);
|
||||||
|
|
||||||
|
var CellStyleFormats = new CellStyleFormats() { Count = 1U };
|
||||||
|
var CellFormatStyle = new CellFormat() { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U };
|
||||||
|
|
||||||
|
CellStyleFormats.Append(CellFormatStyle);
|
||||||
|
|
||||||
|
var CellFormats = new CellFormats() { Count = 3U };
|
||||||
|
var CellFormatFont = new CellFormat() { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyFont = true };
|
||||||
|
var CellFormatFontAndBorder = new CellFormat() { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 1U, FormatId = 0U, ApplyFont = true, ApplyBorder = true };
|
||||||
|
var CellFormatTitle = new CellFormat() { NumberFormatId = 0U, FontId = 1U, FillId = 0U, BorderId = 0U, FormatId = 0U, Alignment = new Alignment() { Vertical = VerticalAlignmentValues.Center, WrapText = true, Horizontal = HorizontalAlignmentValues.Center }, ApplyFont = true };
|
||||||
|
|
||||||
|
CellFormats.Append(CellFormatFont);
|
||||||
|
CellFormats.Append(CellFormatFontAndBorder);
|
||||||
|
CellFormats.Append(CellFormatTitle);
|
||||||
|
|
||||||
|
var CellStyles = new CellStyles() { Count = 1U };
|
||||||
|
|
||||||
|
CellStyles.Append(new CellStyle() { Name = "Normal", FormatId = 0U, BuiltinId = 0U });
|
||||||
|
|
||||||
|
var DifferentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats() { Count = 0U };
|
||||||
|
|
||||||
|
var TableStyles = new TableStyles() { Count = 0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" };
|
||||||
|
|
||||||
|
var StylesheetExtensionList = new StylesheetExtensionList();
|
||||||
|
|
||||||
|
var StylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" };
|
||||||
|
StylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||||
|
StylesheetExtension1.Append(new SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" });
|
||||||
|
|
||||||
|
var StylesheetExtension2 = new StylesheetExtension() { Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" };
|
||||||
|
StylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
||||||
|
StylesheetExtension2.Append(new TimelineStyles() { DefaultTimelineStyle = "TimeSlicerStyleLight1" });
|
||||||
|
|
||||||
|
StylesheetExtensionList.Append(StylesheetExtension1);
|
||||||
|
StylesheetExtensionList.Append(StylesheetExtension2);
|
||||||
|
|
||||||
|
sp.Stylesheet.Append(Fonts);
|
||||||
|
sp.Stylesheet.Append(Fills);
|
||||||
|
sp.Stylesheet.Append(Borders);
|
||||||
|
sp.Stylesheet.Append(CellStyleFormats);
|
||||||
|
sp.Stylesheet.Append(CellFormats);
|
||||||
|
sp.Stylesheet.Append(CellStyles);
|
||||||
|
sp.Stylesheet.Append(DifferentialFormats);
|
||||||
|
sp.Stylesheet.Append(TableStyles);
|
||||||
|
sp.Stylesheet.Append(StylesheetExtensionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static uint GetStyleValue(ExcelStyleInfoType StyleInfo)
|
||||||
|
{
|
||||||
|
return StyleInfo switch
|
||||||
|
{
|
||||||
|
ExcelStyleInfoType.Title => 2U,
|
||||||
|
ExcelStyleInfoType.TextWithBroder => 1U,
|
||||||
|
ExcelStyleInfoType.Text => 0U,
|
||||||
|
_ => 0U,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateExcel(ExcelInfo Info)
|
||||||
|
{
|
||||||
|
_spreadsheetDocument = SpreadsheetDocument.Create(Info.FileName, SpreadsheetDocumentType.Workbook);
|
||||||
|
|
||||||
|
var WorkbookPart = _spreadsheetDocument.AddWorkbookPart();
|
||||||
|
WorkbookPart.Workbook = new Workbook();
|
||||||
|
|
||||||
|
CreateStyles(WorkbookPart);
|
||||||
|
|
||||||
|
_shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
|
||||||
|
? _spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First()
|
||||||
|
: _spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
||||||
|
|
||||||
|
// Создаем SharedStringTable, если его нет
|
||||||
|
if (_shareStringPart.SharedStringTable == null)
|
||||||
|
{
|
||||||
|
_shareStringPart.SharedStringTable = new SharedStringTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создаем лист в книгу
|
||||||
|
var WorksheetPart = WorkbookPart.AddNewPart<WorksheetPart>();
|
||||||
|
WorksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||||
|
|
||||||
|
// Добавляем лист в книгу
|
||||||
|
var Sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||||
|
var Sheet = new Sheet()
|
||||||
|
{
|
||||||
|
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(WorksheetPart),
|
||||||
|
SheetId = 1,
|
||||||
|
Name = "Лист"
|
||||||
|
};
|
||||||
|
|
||||||
|
Sheets.Append(Sheet);
|
||||||
|
|
||||||
|
_worksheet = WorksheetPart.Worksheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void InsertCellInWorksheet(ExcelCellParameters ExcelParams)
|
||||||
|
{
|
||||||
|
if (_worksheet == null || _shareStringPart == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var SheetData = _worksheet.GetFirstChild<SheetData>();
|
||||||
|
if (SheetData == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ищем строку, либо добавляем ее
|
||||||
|
Row row;
|
||||||
|
if (SheetData.Elements<Row>().Where(r => r.RowIndex! == ExcelParams.RowIndex).Any())
|
||||||
|
{
|
||||||
|
row = SheetData.Elements<Row>().Where(r => r.RowIndex! == ExcelParams.RowIndex).First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row = new Row() { RowIndex = ExcelParams.RowIndex };
|
||||||
|
SheetData.Append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ищем нужную ячейку
|
||||||
|
Cell cell;
|
||||||
|
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == ExcelParams.CellReference).Any())
|
||||||
|
{
|
||||||
|
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == ExcelParams.CellReference).First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Все ячейки должны быть последовательно друг за другом расположены
|
||||||
|
// нужно определить, после какой вставлять
|
||||||
|
Cell? refCell = null;
|
||||||
|
foreach (Cell rowCell in row.Elements<Cell>())
|
||||||
|
{
|
||||||
|
if (string.Compare(rowCell.CellReference!.Value, ExcelParams.CellReference, true) > 0)
|
||||||
|
{
|
||||||
|
refCell = rowCell;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var NewCell = new Cell() { CellReference = ExcelParams.CellReference };
|
||||||
|
row.InsertBefore(NewCell, refCell);
|
||||||
|
|
||||||
|
cell = NewCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
// вставляем новый текст
|
||||||
|
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(ExcelParams.Text)));
|
||||||
|
_shareStringPart.SharedStringTable.Save();
|
||||||
|
|
||||||
|
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||||
|
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||||
|
cell.StyleIndex = GetStyleValue(ExcelParams.StyleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void MergeCells(ExcelMergeParameters ExcelParams)
|
||||||
|
{
|
||||||
|
if (_worksheet == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MergeCells MergeCells;
|
||||||
|
|
||||||
|
if (_worksheet.Elements<MergeCells>().Any())
|
||||||
|
{
|
||||||
|
MergeCells = _worksheet.Elements<MergeCells>().First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MergeCells = new MergeCells();
|
||||||
|
|
||||||
|
if (_worksheet.Elements<CustomSheetView>().Any())
|
||||||
|
{
|
||||||
|
_worksheet.InsertAfter(MergeCells, _worksheet.Elements<CustomSheetView>().First());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_worksheet.InsertAfter(MergeCells, _worksheet.Elements<SheetData>().First());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var MergeCell = new MergeCell()
|
||||||
|
{
|
||||||
|
Reference = new StringValue(ExcelParams.Merge)
|
||||||
|
};
|
||||||
|
|
||||||
|
MergeCells.Append(MergeCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SaveExcel(ExcelInfo Info)
|
||||||
|
{
|
||||||
|
if (_spreadsheetDocument == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||||
|
_spreadsheetDocument.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using BarBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
using MigraDoc.DocumentObjectModel.Tables;
|
||||||
|
using MigraDoc.Rendering;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToPdf : AbstractSaveToPdf
|
||||||
|
{
|
||||||
|
private Document? _document;
|
||||||
|
private Section? _section;
|
||||||
|
private Table? _table;
|
||||||
|
|
||||||
|
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType Type)
|
||||||
|
{
|
||||||
|
return Type switch
|
||||||
|
{
|
||||||
|
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||||
|
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||||
|
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
||||||
|
_ => ParagraphAlignment.Justify,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void DefineStyles(Document Document)
|
||||||
|
{
|
||||||
|
var Style = Document.Styles["Normal"];
|
||||||
|
Style.Font.Name = "Times New Roman";
|
||||||
|
Style.Font.Size = 14;
|
||||||
|
|
||||||
|
Style = Document.Styles.AddStyle("NormalTitle", "Normal");
|
||||||
|
Style.Font.Bold = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreatePdf(PdfInfo Info)
|
||||||
|
{
|
||||||
|
_document = new Document();
|
||||||
|
DefineStyles(_document);
|
||||||
|
|
||||||
|
_section = _document.AddSection();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateParagraph(PdfParagraph PdfParagraph)
|
||||||
|
{
|
||||||
|
if (_section == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var Paragraph = _section.AddParagraph(PdfParagraph.Text);
|
||||||
|
|
||||||
|
Paragraph.Format.SpaceAfter = "1cm";
|
||||||
|
Paragraph.Format.Alignment = GetParagraphAlignment(PdfParagraph.ParagraphAlignment);
|
||||||
|
Paragraph.Style = PdfParagraph.Style;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateTable(List<string> Columns)
|
||||||
|
{
|
||||||
|
if (_document == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_table = _document.LastSection.AddTable();
|
||||||
|
|
||||||
|
foreach (var Elem in Columns)
|
||||||
|
{
|
||||||
|
_table.AddColumn(Elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateRow(PdfRowParameters RowParameters)
|
||||||
|
{
|
||||||
|
if (_table == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var Row = _table.AddRow();
|
||||||
|
|
||||||
|
for (int i = 0; i < RowParameters.Texts.Count; ++i)
|
||||||
|
{
|
||||||
|
Row.Cells[i].AddParagraph(RowParameters.Texts[i]);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(RowParameters.Style))
|
||||||
|
{
|
||||||
|
Row.Cells[i].Style = RowParameters.Style;
|
||||||
|
}
|
||||||
|
|
||||||
|
Unit borderWidth = 0.5;
|
||||||
|
|
||||||
|
Row.Cells[i].Borders.Left.Width = borderWidth;
|
||||||
|
Row.Cells[i].Borders.Right.Width = borderWidth;
|
||||||
|
Row.Cells[i].Borders.Top.Width = borderWidth;
|
||||||
|
Row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||||
|
|
||||||
|
Row.Cells[i].Format.Alignment = GetParagraphAlignment(RowParameters.ParagraphAlignment);
|
||||||
|
Row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SavePdf(PdfInfo Info)
|
||||||
|
{
|
||||||
|
var Renderer = new PdfDocumentRenderer(true)
|
||||||
|
{
|
||||||
|
Document = _document
|
||||||
|
};
|
||||||
|
|
||||||
|
Renderer.RenderDocument();
|
||||||
|
Renderer.PdfDocument.Save(Info.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
using BarBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using BarBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using DocumentFormat.OpenXml;
|
||||||
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
|
||||||
|
namespace BarBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToWord : AbstractSaveToWord
|
||||||
|
{
|
||||||
|
private WordprocessingDocument? _wordDocument;
|
||||||
|
private Body? _docBody;
|
||||||
|
|
||||||
|
private static JustificationValues GetJustificationValues(WordJustificationType Type)
|
||||||
|
{
|
||||||
|
return Type switch
|
||||||
|
{
|
||||||
|
WordJustificationType.Both => JustificationValues.Both,
|
||||||
|
WordJustificationType.Center => JustificationValues.Center,
|
||||||
|
_ => JustificationValues.Left,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SectionProperties CreateSectionProperties()
|
||||||
|
{
|
||||||
|
var Properties = new SectionProperties();
|
||||||
|
|
||||||
|
var PageSize = new PageSize
|
||||||
|
{
|
||||||
|
Orient = PageOrientationValues.Portrait
|
||||||
|
};
|
||||||
|
|
||||||
|
Properties.AppendChild(PageSize);
|
||||||
|
return Properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? ParagraphProperties)
|
||||||
|
{
|
||||||
|
if (ParagraphProperties == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
var Properties = new ParagraphProperties();
|
||||||
|
|
||||||
|
Properties.AppendChild(new Justification()
|
||||||
|
{
|
||||||
|
Val = GetJustificationValues(ParagraphProperties.JustificationType)
|
||||||
|
});
|
||||||
|
|
||||||
|
Properties.AppendChild(new SpacingBetweenLines
|
||||||
|
{
|
||||||
|
LineRule = LineSpacingRuleValues.Auto
|
||||||
|
});
|
||||||
|
|
||||||
|
Properties.AppendChild(new Indentation());
|
||||||
|
|
||||||
|
var ParagraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||||
|
if (!string.IsNullOrEmpty(ParagraphProperties.Size))
|
||||||
|
{
|
||||||
|
ParagraphMarkRunProperties.AppendChild(new FontSize { Val = ParagraphProperties.Size });
|
||||||
|
}
|
||||||
|
|
||||||
|
Properties.AppendChild(ParagraphMarkRunProperties);
|
||||||
|
return Properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateWord(WordInfo Info)
|
||||||
|
{
|
||||||
|
_wordDocument = WordprocessingDocument.Create(Info.FileName, WordprocessingDocumentType.Document);
|
||||||
|
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||||
|
|
||||||
|
mainPart.Document = new Document();
|
||||||
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateParagraph(WordParagraph Paragraph)
|
||||||
|
{
|
||||||
|
if (_docBody == null || Paragraph == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var DocParagraph = new Paragraph();
|
||||||
|
DocParagraph.AppendChild(CreateParagraphProperties(Paragraph.TextProperties));
|
||||||
|
|
||||||
|
foreach (var Run in Paragraph.Texts)
|
||||||
|
{
|
||||||
|
var DocRun = new Run();
|
||||||
|
|
||||||
|
var Properties = new RunProperties();
|
||||||
|
Properties.AppendChild(new FontSize { Val = Run.Item2.Size });
|
||||||
|
|
||||||
|
if (Run.Item2.Bold)
|
||||||
|
{
|
||||||
|
Properties.AppendChild(new Bold());
|
||||||
|
}
|
||||||
|
|
||||||
|
DocRun.AppendChild(Properties);
|
||||||
|
DocRun.AppendChild(new Text { Text = Run.Item1, Space = SpaceProcessingModeValues.Preserve });
|
||||||
|
DocParagraph.AppendChild(DocRun);
|
||||||
|
}
|
||||||
|
|
||||||
|
_docBody.AppendChild(DocParagraph);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SaveWord(WordInfo Info)
|
||||||
|
{
|
||||||
|
if (_docBody == null || _wordDocument == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_docBody.AppendChild(CreateSectionProperties());
|
||||||
|
_wordDocument.MainDocumentPart!.Document.Save();
|
||||||
|
_wordDocument.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace BarContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class ReportBindingModel
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using BarContracts.BindingModels;
|
||||||
|
using BarContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BarContracts.BusinessLogicContracts
|
||||||
|
{
|
||||||
|
public interface IReportLogic
|
||||||
|
{
|
||||||
|
List<ReportCocktailComponentViewModel> GetCocktailComponents();
|
||||||
|
|
||||||
|
List<ReportOrdersViewModel> GetOrders(ReportBindingModel Model);
|
||||||
|
|
||||||
|
void SaveComponentsToWordFile(ReportBindingModel Model);
|
||||||
|
|
||||||
|
void SaveCocktailComponentToExcelFile(ReportBindingModel Model);
|
||||||
|
|
||||||
|
void SaveOrdersToPdfFile(ReportBindingModel Model);
|
||||||
|
}
|
||||||
|
}
|
@ -3,5 +3,9 @@
|
|||||||
public class OrderSearchModel
|
public class OrderSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
namespace BarContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportOrdersViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public DateTime DateCreate { get; set; }
|
||||||
|
|
||||||
|
public string CocktailName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public double Sum { get; set; }
|
||||||
|
|
||||||
|
public string Status { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace BarContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportCocktailComponentViewModel
|
||||||
|
{
|
||||||
|
public string CocktailName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int TotalCount { get; set; }
|
||||||
|
|
||||||
|
public List<(string Component, int Count)> Components { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -21,11 +21,20 @@ namespace BarDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel Model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel Model)
|
||||||
{
|
{
|
||||||
if (!Model.Id.HasValue)
|
if (!Model.Id.HasValue && (!Model.DateFrom.HasValue || !Model.DateTo.HasValue))
|
||||||
return new();
|
return new();
|
||||||
|
|
||||||
using var Context = new BarDatabase();
|
using var Context = new BarDatabase();
|
||||||
|
|
||||||
|
if (Model.DateFrom.HasValue)
|
||||||
|
{
|
||||||
|
return Context.Orders
|
||||||
|
.Include(x => x.Cocktail)
|
||||||
|
.Where(x => x.DateCreate >= Model.DateFrom && x.DateCreate <= Model.DateTo)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
return Context.Orders
|
return Context.Orders
|
||||||
.Include(x => x.Cocktail)
|
.Include(x => x.Cocktail)
|
||||||
.Where(x => x.Id == Model.Id)
|
.Where(x => x.Id == Model.Id)
|
||||||
|
@ -22,10 +22,13 @@ namespace BarFileImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel Model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel Model)
|
||||||
{
|
{
|
||||||
if (!Model.Id.HasValue)
|
if (!Model.Id.HasValue && (!Model.DateFrom.HasValue || !Model.DateTo.HasValue))
|
||||||
return new();
|
return new();
|
||||||
|
|
||||||
return _source.Orders.Where(x => x.Id == Model.Id).Select(x => AddCocktailName(x.GetViewModel)).ToList();
|
return _source.Orders
|
||||||
|
.Where(x => x.DateCreate >= Model.DateFrom && x.DateCreate <= Model.DateTo)
|
||||||
|
.Select(x => AddCocktailName(x.GetViewModel))
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Delete(OrderBindingModel Model)
|
public OrderViewModel? Delete(OrderBindingModel Model)
|
||||||
|
@ -31,12 +31,12 @@ namespace BarListImplement.Implements
|
|||||||
{
|
{
|
||||||
var Result = new List<OrderViewModel>();
|
var Result = new List<OrderViewModel>();
|
||||||
|
|
||||||
if (!Model.Id.HasValue)
|
if (!Model.Id.HasValue && (!Model.DateFrom.HasValue || !Model.DateTo.HasValue))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
foreach (var Order in _source.Orders)
|
foreach (var Order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (Order.Id == Model.Id)
|
if (Order.DateCreate >= Model.DateFrom && Order.DateCreate <= Model.DateTo)
|
||||||
{
|
{
|
||||||
Result.Add(JoinCocktailName(Order.GetViewModel));
|
Result.Add(JoinCocktailName(Order.GetViewModel));
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user