This commit is contained in:
DeerElk 2024-04-24 05:46:48 +04:00
parent 51023ab2e7
commit d62db28640
32 changed files with 1196 additions and 77 deletions

View File

@ -19,7 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfectioneryListImplement"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfectioneryFileImplement", "ConfectioneryFileImplement\ConfectioneryFileImplement.csproj", "{511A9EBD-14A4-48E9-9101-41A5FB8D3C17}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfectioneryFileImplement", "ConfectioneryFileImplement\ConfectioneryFileImplement.csproj", "{511A9EBD-14A4-48E9-9101-41A5FB8D3C17}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfectioneryDatabaseImplement", "ConfectioneryDatabaseImplement\ConfectioneryDatabaseImplement.csproj", "{E8F1F27D-0DD1-47DA-9BDF-8419D0B3EF58}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfectioneryDatabaseImplement", "ConfectioneryDatabaseImplement\ConfectioneryDatabaseImplement.csproj", "{E8F1F27D-0DD1-47DA-9BDF-8419D0B3EF58}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{181AF2FE-AE82-4767-B58B-36C0F22B56CD} = {181AF2FE-AE82-4767-B58B-36C0F22B56CD} {181AF2FE-AE82-4767-B58B-36C0F22B56CD} = {181AF2FE-AE82-4767-B58B-36C0F22B56CD}
{92EBD50D-79CE-46FC-B261-43098E98B78F} = {92EBD50D-79CE-46FC-B261-43098E98B78F} {92EBD50D-79CE-46FC-B261-43098E98B78F} = {92EBD50D-79CE-46FC-B261-43098E98B78F}

View File

@ -9,12 +9,17 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.22.0" /> <PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.22.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -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>ConfectioneryContracts.BusinessLogicsContracts.IComponentLogic, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -54,7 +54,7 @@
dataGridView.Location = new Point(0, 36); dataGridView.Location = new Point(0, 36);
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 62; dataGridView.RowHeadersWidth = 62;
dataGridView.Size = new Size(1001, 406); dataGridView.Size = new Size(1001, 408);
dataGridView.TabIndex = 1; dataGridView.TabIndex = 1;
// //
// buttonCreateOrder // buttonCreateOrder
@ -156,24 +156,27 @@
listOfComponentsToolStripMenuItem.Name = "listOfComponentsToolStripMenuItem"; listOfComponentsToolStripMenuItem.Name = "listOfComponentsToolStripMenuItem";
listOfComponentsToolStripMenuItem.Size = new Size(449, 34); listOfComponentsToolStripMenuItem.Size = new Size(449, 34);
listOfComponentsToolStripMenuItem.Text = "Список компонентов"; listOfComponentsToolStripMenuItem.Text = "Список компонентов";
listOfComponentsToolStripMenuItem.Click += ListOfComponentsToolStripMenuItem_Click;
// //
// ComponentsByPastryToolStripMenuItem // ComponentsByPastryToolStripMenuItem
// //
ComponentsByPastryToolStripMenuItem.Name = "ComponentsByPastryToolStripMenuItem"; ComponentsByPastryToolStripMenuItem.Name = "ComponentsByPastryToolStripMenuItem";
ComponentsByPastryToolStripMenuItem.Size = new Size(449, 34); ComponentsByPastryToolStripMenuItem.Size = new Size(449, 34);
ComponentsByPastryToolStripMenuItem.Text = "Компоненты по кондитерским изделиям"; ComponentsByPastryToolStripMenuItem.Text = "Компоненты по кондитерским изделиям";
ComponentsByPastryToolStripMenuItem.Click += ComponentsByPastryToolStripMenuItem_Click;
// //
// listOfOrdersToolStripMenuItem // listOfOrdersToolStripMenuItem
// //
listOfOrdersToolStripMenuItem.Name = "listOfOrdersToolStripMenuItem"; listOfOrdersToolStripMenuItem.Name = "listOfOrdersToolStripMenuItem";
listOfOrdersToolStripMenuItem.Size = new Size(449, 34); listOfOrdersToolStripMenuItem.Size = new Size(449, 34);
listOfOrdersToolStripMenuItem.Text = "Список заказов"; listOfOrdersToolStripMenuItem.Text = "Список заказов";
listOfOrdersToolStripMenuItem.Click += ListOfOrdersToolStripMenuItem_Click;
// //
// FormMain // FormMain
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1154, 442); ClientSize = new Size(1154, 444);
Controls.Add(menuStrip); Controls.Add(menuStrip);
Controls.Add(buttonRef); Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder); Controls.Add(buttonIssuedOrder);

View File

@ -1,4 +1,5 @@
using ConfectioneryContracts.BindingModels; using ConfectioneryBusinessLogic.BusinessLogics;
using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryDataModels.Enums; using ConfectioneryDataModels.Enums;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -8,11 +9,14 @@ namespace ConfectioneryView
{ {
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)
{ {
@ -60,6 +64,40 @@ namespace ConfectioneryView
form.ShowDialog(); form.ShowDialog();
} }
} }
private void ListOfComponentsToolStripMenuItem_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 ComponentsByPastryToolStripMenuItem_Click(object sender,
EventArgs e)
{
var service = Program.ServiceProvider?.GetService(
typeof(FormReportPastryComponents));
if (service is FormReportPastryComponents form)
{
form.ShowDialog();
}
}
private void ListOfOrdersToolStripMenuItem_Click(object sender,
EventArgs e)
{
var service = Program.ServiceProvider?.GetService(
typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
private void ButtonCreateOrder_Click(object sender, EventArgs e) private void ButtonCreateOrder_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService( var service = Program.ServiceProvider?.GetService(

View File

@ -0,0 +1,143 @@
namespace ConfectioneryView
{
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()
{
panelControl = new Panel();
buttonToPdf = new Button();
buttonMake = new Button();
labelFrom = new Label();
dateTimePickerFrom = new DateTimePicker();
labelTo = new Label();
dateTimePickerTo = new DateTimePicker();
panelReport = new Panel();
panelControl.SuspendLayout();
SuspendLayout();
//
// panelControl
//
panelControl.Anchor = AnchorStyles.Left | AnchorStyles.Right;
panelControl.Controls.Add(buttonToPdf);
panelControl.Controls.Add(buttonMake);
panelControl.Controls.Add(labelFrom);
panelControl.Controls.Add(dateTimePickerFrom);
panelControl.Controls.Add(labelTo);
panelControl.Controls.Add(dateTimePickerTo);
panelControl.Location = new Point(0, 0);
panelControl.Name = "panelControl";
panelControl.Size = new Size(1154, 57);
panelControl.TabIndex = 0;
//
// buttonToPdf
//
buttonToPdf.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonToPdf.Location = new Point(995, 12);
buttonToPdf.Name = "buttonToPdf";
buttonToPdf.Size = new Size(147, 34);
buttonToPdf.TabIndex = 5;
buttonToPdf.Text = "В Pdf";
buttonToPdf.UseVisualStyleBackColor = true;
buttonToPdf.Click += ButtonToPdf_Click;
//
// buttonMake
//
buttonMake.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonMake.Location = new Point(842, 12);
buttonMake.Name = "buttonMake";
buttonMake.Size = new Size(147, 34);
buttonMake.TabIndex = 4;
buttonMake.Text = "Сформировать";
buttonMake.UseVisualStyleBackColor = true;
buttonMake.Click += ButtonMake_Click;
//
// labelFrom
//
labelFrom.AutoSize = true;
labelFrom.Location = new Point(12, 17);
labelFrom.Name = "labelFrom";
labelFrom.Size = new Size(23, 25);
labelFrom.TabIndex = 2;
labelFrom.Text = "С";
//
// dateTimePickerFrom
//
dateTimePickerFrom.Location = new Point(43, 14);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(217, 31);
dateTimePickerFrom.TabIndex = 0;
//
// labelTo
//
labelTo.AutoSize = true;
labelTo.Location = new Point(266, 17);
labelTo.Name = "labelTo";
labelTo.Size = new Size(33, 25);
labelTo.TabIndex = 3;
labelTo.Text = "по";
//
// dateTimePickerTo
//
dateTimePickerTo.Location = new Point(305, 14);
dateTimePickerTo.Name = "dateTimePickerTo";
dateTimePickerTo.Size = new Size(216, 31);
dateTimePickerTo.TabIndex = 1;
//
// panelReport
//
panelReport.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
panelReport.Location = new Point(0, 57);
panelReport.Name = "panelReport";
panelReport.Size = new Size(1154, 387);
panelReport.TabIndex = 1;
//
// FormReportOrders
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1154, 444);
Controls.Add(panelReport);
Controls.Add(panelControl);
Name = "FormReportOrders";
Text = "Заказы";
panelControl.ResumeLayout(false);
panelControl.PerformLayout();
ResumeLayout(false);
}
#endregion
private Panel panelControl;
private Button buttonToPdf;
private Button buttonMake;
private Label labelTo;
private Label labelFrom;
private DateTimePicker dateTimePickerTo;
private DateTimePicker dateTimePickerFrom;
private Panel panelReport;
}
}

View File

@ -0,0 +1,106 @@
using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using Microsoft.Reporting.WinForms;
namespace ConfectioneryView
{
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("C:\\Users\\ellev\\OneDrive\\Рабочий стол\\Университет\\4 семестр\\РПП\\Confectionery\\Confectionery\\Confectionery\\ReportOrders.rdlc", FileMode.Open));
panelReport.Controls.Add(reportViewer);
}
private void ButtonMake_Click(object sender, EventArgs e)
{
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
{
MessageBox.Show(
"Дата начала должна быть меньше даты окончания",
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
var dataSource = _logic.GetOrders(new ReportBindingModel
{
DateFrom = dateTimePickerFrom.Value,
DateTo = dateTimePickerTo.Value
});
var source = new ReportDataSource("DataSetOrders", dataSource);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source);
var parameters = new[] { new ReportParameter(
"ReportParameterPeriod", $"c " +
$"{dateTimePickerFrom.Value.ToShortDateString()} по " +
$"{dateTimePickerTo.Value.ToShortDateString()}") };
reportViewer.LocalReport.SetParameters(parameters);
reportViewer.RefreshReport();
_logger.LogInformation("Загрузка списка заказов на период " +
"{From}-{ To}",
dateTimePickerFrom.Value.ToShortDateString(),
dateTimePickerTo.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 (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
{
MessageBox.Show(
"Дата начала должна быть меньше даты окончания",
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
using var dialog = new SaveFileDialog
{
Filter = "pdf|*.pdf"
};
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
_logic.SaveOrdersToPdfFile(new ReportBindingModel
{
FileName = dialog.FileName,
DateFrom = dateTimePickerFrom.Value,
DateTo = dateTimePickerTo.Value
});
_logger.LogInformation(
"Сохранение списка заказов на период { From}-{ To}",
dateTimePickerFrom.Value.ToShortDateString(),
dateTimePickerTo.Value.ToShortDateString());
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (Exception ex)
{
_logger.LogError(
ex, "Ошибка сохранения списка заказов на период");
MessageBox.Show(
ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>

View File

@ -30,13 +30,18 @@
{ {
dataGridView = new DataGridView(); dataGridView = new DataGridView();
buttonSaveToExcel = new Button(); buttonSaveToExcel = new Button();
ComponentColumn = new DataGridViewTextBoxColumn();
PastryColumn = new DataGridViewTextBoxColumn();
CountColumn = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// dataGridView // dataGridView
// //
dataGridView.BackgroundColor = SystemColors.Window;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { PastryColumn, ComponentColumn, CountColumn });
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridView.BackgroundColor = SystemColors.Window;
dataGridView.Location = new Point(0, 52); dataGridView.Location = new Point(0, 52);
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 62; dataGridView.RowHeadersWidth = 62;
@ -53,6 +58,27 @@
buttonSaveToExcel.UseVisualStyleBackColor = true; buttonSaveToExcel.UseVisualStyleBackColor = true;
buttonSaveToExcel.Click += ButtonSaveToExcel_Click; buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
// //
// PastryColumn
//
PastryColumn.HeaderText = "Кондитерское изделие";
PastryColumn.MinimumWidth = 6;
PastryColumn.Name = "PastryColumn";
PastryColumn.Width = 300;
//
// ComponentColumn
//
ComponentColumn.HeaderText = "Компонент";
ComponentColumn.MinimumWidth = 6;
ComponentColumn.Name = "ComponentColumn";
ComponentColumn.Width = 200;
//
// CountColumn
//
CountColumn.HeaderText = "Количество";
CountColumn.MinimumWidth = 6;
CountColumn.Name = "CountColumn";
CountColumn.Width = 130;
//
// FormReportPastryComponents // FormReportPastryComponents
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(10F, 25F);
@ -71,5 +97,8 @@
private DataGridView dataGridView; private DataGridView dataGridView;
private Button buttonSaveToExcel; private Button buttonSaveToExcel;
private DataGridViewTextBoxColumn ComponentColumn;
private DataGridViewTextBoxColumn PastryColumn;
private DataGridViewTextBoxColumn CountColumn;
} }
} }

View File

@ -25,8 +25,8 @@ namespace ConfectioneryView
foreach (var elem in dict) foreach (var elem in dict)
{ {
dataGridView.Rows.Add(new object[] { dataGridView.Rows.Add(new object[] {
elem.ComponentName, "", "" }); elem.PastryName, "", "" });
foreach (var listElem in elem.Pastries) foreach (var listElem in elem.Components)
{ {
dataGridView.Rows.Add(new object[] { "", dataGridView.Rows.Add(new object[] { "",
listElem.Item1, listElem.Item2 }); listElem.Item1, listElem.Item2 });
@ -37,12 +37,12 @@ namespace ConfectioneryView
} }
} }
_logger.LogInformation( _logger.LogInformation(
"Загрузка списка изделий по компонентам"); "Загрузка списка кондтерских изделий по компонентам");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, _logger.LogError(ex,
"Ошибка загрузки списка изделий по компонентам"); "Ошибка загрузки списка кондитерских изделий по компонентам");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBoxIcon.Error);
@ -58,20 +58,20 @@ namespace ConfectioneryView
{ {
try try
{ {
_logic.SavePastryComponentToExcelFile(new _logic.SavePastryComponentToExcelFile(
ReportBindingModel new ReportBindingModel
{ {
FileName = dialog.FileName FileName = dialog.FileName
}); });
_logger.LogInformation( _logger.LogInformation(
"Сохранение списка изделий по компонентам"); "Сохранение списка кондитерских изделий по компонентам");
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
MessageBoxIcon.Information); MessageBoxIcon.Information);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, _logger.LogError(ex,
"Ошибка сохранения списка изделий по компонентам"); "Ошибка сохранения списка кондитерских изделий по компонентам");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBoxIcon.Error);
} }

View File

@ -1,4 +1,6 @@
using ConfectioneryBusinessLogic.BusinessLogics; using ConfectioneryBusinessLogic.BusinessLogics;
using ConfectioneryBusinessLogic.OfficePackage.Implements;
using ConfectioneryBusinessLogic.OfficePackage;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryContracts.StoragesContracts; using ConfectioneryContracts.StoragesContracts;
using ConfectioneryDatabaseImplement.Implements; using ConfectioneryDatabaseImplement.Implements;
@ -39,6 +41,7 @@ namespace ConfectioneryView
services.AddTransient<IComponentLogic, ComponentLogic>(); services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>(); services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IPastryLogic, PastryLogic>(); services.AddTransient<IPastryLogic, PastryLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<FormMain>(); services.AddTransient<FormMain>();
services.AddTransient<FormComponent>(); services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>(); services.AddTransient<FormComponents>();
@ -46,6 +49,11 @@ namespace ConfectioneryView
services.AddTransient<FormPastry>(); services.AddTransient<FormPastry>();
services.AddTransient<FormPastryComponent>(); services.AddTransient<FormPastryComponent>();
services.AddTransient<FormPastries>(); services.AddTransient<FormPastries>();
services.AddTransient<FormReportPastryComponents>();
services.AddTransient<FormReportOrders>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
} }
} }
} }

View File

@ -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>ConfectioneryContracts.BusinessLogicsContracts.IOrderLogic, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -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="IPastryLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>ConfectioneryContracts.BusinessLogicsContracts.IPastryLogic, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -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="IReportLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>ConfectioneryContracts.BusinessLogicsContracts.IReportLogic, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -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>ConfectioneryContracts.StoragesContracts.IComponentStorage, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -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>ConfectioneryContracts.StoragesContracts.IOrderStorage, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -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="IPastryStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>ConfectioneryContracts.StoragesContracts.IPastryStorage, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,599 @@
<?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="ConfectioneryContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSetOrders">
<Query>
<DataSourceName>ConfectioneryContractsViewModels</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="PastryName">
<DataField>PastryName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>ConfectioneryDataModels.OrderStatus</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>ConfectioneryContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrderViewModel</rd:TableName>
<rd:ObjectDataSourceType>ConfectioneryContracts.ViewModels.ReportOrderViewModel, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportSections>
<ReportSection>
<Body>
<ReportItems>
<Textbox Name="ReportParameterPeriod">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!ReportParameterPeriod.Value</Value>
<Style>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
<Top>1cm</Top>
<Height>1cm</Height>
<Width>21cm</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="TextboxTitle">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Список заказов</Value>
<Style>
<FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Height>1cm</Height>
<Width>21cm</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="Tablix1">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.21438cm</Width>
</TablixColumn>
<TablixColumn>
<Width>7.08192cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.65125cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.6cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Номер</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</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="Textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Дата создания</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox1</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="Textbox3">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Кондитерское изделие</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox3</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="Textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Статус Заказа</Value>
<Style>
<FontWeight>Bold</FontWeight>
</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="Textbox7">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Сумма</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox7</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>
<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>
<Format>d</Format>
</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="PastryName">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!PastryName.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>PastryName</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="OrderStatus">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!OrderStatus.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>OrderStatus</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>2.48391cm</Top>
<Left>0.55245cm</Left>
<Height>1.2cm</Height>
<Width>18.94755cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
<Style>Double</Style>
</Border>
</Style>
</Tablix>
<Textbox Name="TextboxTotalSum">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Итого:</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>4cm</Top>
<Left>13.34875cm</Left>
<Height>0.6cm</Height>
<Width>3.65125cm</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="SumTotal">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>4cm</Top>
<Left>17cm</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>5.72875cm</Height>
<Style />
</Body>
<Width>21cm</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>5</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>1c0c12af-b9e8-41db-8d1f-26d1acbf91cc</rd:ReportID>
</Report>

View File

@ -5,7 +5,7 @@ using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryContracts.SearchModels; using ConfectioneryContracts.SearchModels;
using ConfectioneryContracts.StoragesContracts; using ConfectioneryContracts.StoragesContracts;
using ConfectioneryContracts.ViewModels; using ConfectioneryContracts.ViewModels;
namespace AbstractShopBusinessLogic.BusinessLogics namespace ConfectioneryBusinessLogic.BusinessLogics
{ {
public class ReportLogic : IReportLogic public class ReportLogic : IReportLogic
{ {
@ -16,7 +16,7 @@ namespace AbstractShopBusinessLogic.BusinessLogics
private readonly AbstractSaveToWord _saveToWord; private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf; private readonly AbstractSaveToPdf _saveToPdf;
public ReportLogic(IPastryStorage pastryStorage, IComponentStorage public ReportLogic(IPastryStorage pastryStorage, IComponentStorage
componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel
saveToExcel, AbstractSaveToWord saveToWord, saveToExcel, AbstractSaveToWord saveToWord,
AbstractSaveToPdf saveToPdf) AbstractSaveToPdf saveToPdf)
{ {
@ -28,33 +28,28 @@ namespace AbstractShopBusinessLogic.BusinessLogics
_saveToPdf = saveToPdf; _saveToPdf = saveToPdf;
} }
/// <summary> /// <summary>
/// Получение списка компонент с указанием, в каких изделиях /// Получение списка компонент с указанием, в каких кондитерских
/// используются /// изделиях используются
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<ReportPastryComponentViewModel> GetPastryComponent() public List<ReportPastryComponentViewModel> GetPastryComponent()
{ {
var components = _componentStorage.GetFullList();
var pastries = _pastryStorage.GetFullList(); var pastries = _pastryStorage.GetFullList();
var list = new List<ReportPastryComponentViewModel>(); var list = new List<ReportPastryComponentViewModel>();
foreach (var component in components) foreach (var pastry in pastries)
{ {
var record = new ReportPastryComponentViewModel var record = new ReportPastryComponentViewModel
{ {
ComponentName = component.ComponentName, PastryName = pastry.PastryName,
Pastries = new List<Tuple<string, int>>(), Components = new List<Tuple<string, int>>(),
TotalCount = 0 TotalCount = 0
}; };
foreach (var pastry in pastries) foreach (var component in pastry.PastryComponents)
{ {
if (pastry.PastryComponents.ContainsKey(component.Id)) record.Components.Add(new Tuple<string, int>(
{ component.Value.Item1.ComponentName,
record.Pastries.Add(new Tuple<string, int>( component.Value.Item2));
pastry.PastryName, record.TotalCount += component.Value.Item2;
pastry.PastryComponents[component.Id].Item2));
record.TotalCount +=
pastry.PastryComponents[component.Id].Item2;
}
} }
list.Add(record); list.Add(record);
} }
@ -77,7 +72,8 @@ namespace AbstractShopBusinessLogic.BusinessLogics
Id = x.Id, Id = x.Id,
DateCreate = x.DateCreate, DateCreate = x.DateCreate,
PastryName = x.PastryName, PastryName = x.PastryName,
Sum = x.Sum Sum = x.Sum,
OrderStatus = x.Status.ToString()
}) })
.ToList(); .ToList();
} }
@ -90,12 +86,12 @@ namespace AbstractShopBusinessLogic.BusinessLogics
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонент", Title = "Список кондитерских изделий",
Components = _componentStorage.GetFullList() Pastries = _pastryStorage.GetFullList()
}); });
} }
/// <summary> /// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel /// Сохранение компонент с указаеним кондитерских изделий в файл-Excel
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
public void SavePastryComponentToExcelFile(ReportBindingModel model) public void SavePastryComponentToExcelFile(ReportBindingModel model)
@ -103,7 +99,7 @@ namespace AbstractShopBusinessLogic.BusinessLogics
_saveToExcel.CreateReport(new ExcelInfo _saveToExcel.CreateReport(new ExcelInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонент", Title = "Список кондитерских изделий",
PastryComponents = GetPastryComponent() PastryComponents = GetPastryComponent()
}); });
} }

View File

@ -30,27 +30,25 @@ namespace ConfectioneryBusinessLogic.OfficePackage
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.ComponentName, Text = pc.PastryName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var pastry in pc.Pastries) foreach (var component in pc.Components)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pastry.Item1, Text = component.Item1,
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBroder
ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pastry.Item2.ToString(), Text = component.Item2.ToString(),
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBroder
ExcelStyleInfoType.TextWithBroder
}); });
rowIndex++; rowIndex++;
} }

View File

@ -1,7 +1,5 @@
using ConfectioneryBusinessLogic.OfficePackage.HelperEnums; using ConfectioneryBusinessLogic.OfficePackage.HelperEnums;
using ConfectioneryBusinessLogic.OfficePackage.HelperModels; using ConfectioneryBusinessLogic.OfficePackage.HelperModels;
using System.Collections.Generic;
using System.Linq;
namespace ConfectioneryBusinessLogic.OfficePackage namespace ConfectioneryBusinessLogic.OfficePackage
{ {
public abstract class AbstractSaveToPdf public abstract class AbstractSaveToPdf
@ -21,11 +19,12 @@ namespace ConfectioneryBusinessLogic.OfficePackage
$"{ info.DateTo.ToShortDateString() }", Style = "Normal", $"{ info.DateTo.ToShortDateString() }", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" }); CreateTable(new List<string> {
"2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", Texts = new List<string> { "Номер", "Дата заказа",
"Сумма" }, "Кондитерское изделие", "Сумма", "Статус" },
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
@ -35,7 +34,8 @@ namespace ConfectioneryBusinessLogic.OfficePackage
{ {
Texts = new List<string> { order.Id.ToString(), Texts = new List<string> { order.Id.ToString(),
order.DateCreate.ToShortDateString(), order.DateCreate.ToShortDateString(),
order.PastryName, order.Sum.ToString() }, order.PastryName, order.Sum.ToString(),
order.OrderStatus.ToString() },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });
@ -44,7 +44,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage
{ {
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Rigth ParagraphAlignment = PdfParagraphAlignmentType.Right
}); });
SavePdf(info); SavePdf(info);
} }

View File

@ -1,6 +1,5 @@
using ConfectioneryBusinessLogic.OfficePackage.HelperEnums; using ConfectioneryBusinessLogic.OfficePackage.HelperEnums;
using ConfectioneryBusinessLogic.OfficePackage.HelperModels; using ConfectioneryBusinessLogic.OfficePackage.HelperModels;
using System.Collections.Generic;
namespace ConfectioneryBusinessLogic.OfficePackage namespace ConfectioneryBusinessLogic.OfficePackage
{ {
public abstract class AbstractSaveToWord public abstract class AbstractSaveToWord
@ -19,13 +18,16 @@ namespace ConfectioneryBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Center JustificationType = WordJustificationType.Center
} }
}); });
foreach (var component in info.Components) foreach (var pastry in info.Pastries)
{ {
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { Texts = new List<(string, WordTextProperties)> {
(component.ComponentName, new WordTextProperties { (pastry.PastryName, new WordTextProperties {
Size = "24", }) }, Size = "24", Bold = true}), (" - цена " +
pastry.Price.ToString(), new WordTextProperties {
Size = "24"})
},
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",

View File

@ -4,6 +4,6 @@
{ {
Center, Center,
Left, Left,
Rigth Right
} }
} }

View File

@ -5,6 +5,6 @@ namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
{ {
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<ComponentViewModel> Components { get; set; } = new(); public List<PastryViewModel> Pastries { get; set; } = new();
} }
} }

View File

@ -146,7 +146,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage.Implements
BuiltinId = 0U BuiltinId = 0U
}); });
var differentialFormats = new var differentialFormats = new
DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats() { DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats() {
Count = 0U }; Count = 0U };
var tableStyles = new TableStyles() var tableStyles = new TableStyles()
{ {
@ -341,7 +341,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage.Implements
return; return;
} }
_spreadsheetDocument.WorkbookPart!.Workbook.Save(); _spreadsheetDocument.WorkbookPart!.Workbook.Save();
_spreadsheetDocument.Close(); _spreadsheetDocument.Dispose();
} }
} }
} }

View File

@ -17,7 +17,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage.Implements
{ {
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center, PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left, PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right, PdfParagraphAlignmentType.Right => ParagraphAlignment.Right,
_ => ParagraphAlignment.Justify, _ => ParagraphAlignment.Justify,
}; };
} }

View File

@ -117,7 +117,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage.Implements
} }
_docBody.AppendChild(CreateSectionProperties()); _docBody.AppendChild(CreateSectionProperties());
_wordDocument.MainDocumentPart!.Document.Save(); _wordDocument.MainDocumentPart!.Document.Save();
_wordDocument.Close(); _wordDocument.Dispose();
} }
} }
} }

View File

@ -1,13 +1,12 @@
using ConfectioneryContracts.BindingModels; using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.ViewModels; using ConfectioneryContracts.ViewModels;
using System.Collections.Generic;
namespace ConfectioneryContracts.BusinessLogicsContracts namespace ConfectioneryContracts.BusinessLogicsContracts
{ {
public interface IReportLogic public interface IReportLogic
{ {
/// <summary> /// <summary>
/// Получение списка компонент с указанием, в каких изделиях /// Получение списка компонент с указанием, в каких кондитерских
/// используются /// изделиях используются
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
List<ReportPastryComponentViewModel> GetPastryComponent(); List<ReportPastryComponentViewModel> GetPastryComponent();
@ -23,7 +22,7 @@ namespace ConfectioneryContracts.BusinessLogicsContracts
/// <param name="model"></param> /// <param name="model"></param>
void SaveComponentsToWordFile(ReportBindingModel model); void SaveComponentsToWordFile(ReportBindingModel model);
/// <summary> /// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel /// Сохранение компонент с указаеним кондитерских изделий в файл-Excel
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
void SavePastryComponentToExcelFile(ReportBindingModel model); void SavePastryComponentToExcelFile(ReportBindingModel model);

View File

@ -6,5 +6,6 @@
public DateTime DateCreate { get; set; } public DateTime DateCreate { get; set; }
public string PastryName { get; set; } = string.Empty; public string PastryName { get; set; } = string.Empty;
public double Sum { get; set; } public double Sum { get; set; }
public string OrderStatus { get; set; } = string.Empty;
} }
} }

View File

@ -2,8 +2,8 @@
{ {
public class ReportPastryComponentViewModel public class ReportPastryComponentViewModel
{ {
public string ComponentName { get; set; } = string.Empty; public string PastryName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<Tuple<string, int>> Pastries { get; set; } = new(); public List<Tuple<string, int>> Components { get; set; } = new();
} }
} }

View File

@ -13,9 +13,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

View File

@ -17,15 +17,17 @@ namespace ConfectioneryDatabaseImplement.Implements
} }
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue)
{
return new();
}
using var context = new ConfectioneryDatabase(); using var context = new ConfectioneryDatabase();
return context.Orders.Include(x => x.Pastries) return context.Orders.Include(x => x.Pastries)
.Where(x => x.Id == model.Id) .Where(x => (
.Select(x => x.GetViewModel) (!model.Id.HasValue || x.Id == model.Id) &&
.ToList(); (!model.DateFrom.HasValue || x.DateCreate >=
model.DateFrom) && (!model.DateTo.HasValue ||
x.DateCreate <= model.DateTo)
)
)
.Select(x => x.GetViewModel)
.ToList();
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)
{ {