PIbd-22. Shabunov O.A. Lab work 04 (Hard) #13

Closed
olshab wants to merge 16 commits from Lab4_Hard into Lab3_Hard
10 changed files with 682 additions and 3 deletions
Showing only changes of commit fe53deabde - Show all commits

View File

@ -18,6 +18,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,136 @@
namespace AutoWorkshopView.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()
{
Panel = new Panel();
ToPdfButton = new Button();
CreateButton = new Button();
ToDateTimePicker = new DateTimePicker();
ToLabel = new Label();
FromDateTimePicker = new DateTimePicker();
FromLabel = new Label();
Panel.SuspendLayout();
SuspendLayout();
//
// panel
//
Panel.Controls.Add(ToPdfButton);
Panel.Controls.Add(CreateButton);
Panel.Controls.Add(ToDateTimePicker);
Panel.Controls.Add(ToLabel);
Panel.Controls.Add(FromDateTimePicker);
Panel.Controls.Add(FromLabel);
Panel.Dock = DockStyle.Top;
Panel.Location = new Point(0, 0);
Panel.Margin = new Padding(3, 2, 3, 2);
Panel.Name = "Panel";
Panel.Size = new Size(838, 39);
Panel.TabIndex = 0;
//
// ToPdfButton
//
ToPdfButton.Location = new Point(683, 7);
ToPdfButton.Margin = new Padding(3, 2, 3, 2);
ToPdfButton.Name = "ToPdfButton";
ToPdfButton.Size = new Size(144, 22);
ToPdfButton.TabIndex = 5;
ToPdfButton.Text = "В PDF";
ToPdfButton.UseVisualStyleBackColor = true;
ToPdfButton.Click += ButtonToPdf_Click;
//
// CreateButton
//
CreateButton.Location = new Point(474, 8);
CreateButton.Margin = new Padding(3, 2, 3, 2);
CreateButton.Name = "CreateButton";
CreateButton.Size = new Size(144, 22);
CreateButton.TabIndex = 4;
CreateButton.Text = "Сформировать";
CreateButton.UseVisualStyleBackColor = true;
CreateButton.Click += ButtonMake_Click;
//
// ToDateTimePicker
//
ToDateTimePicker.Location = new Point(262, 7);
ToDateTimePicker.Margin = new Padding(3, 2, 3, 2);
ToDateTimePicker.Name = "ToDateTimePicker";
ToDateTimePicker.Size = new Size(175, 23);
ToDateTimePicker.TabIndex = 3;
//
// ToLabel
//
ToLabel.AutoSize = true;
ToLabel.Location = new Point(222, 10);
ToLabel.Name = "ToLabel";
ToLabel.Size = new Size(21, 15);
ToLabel.TabIndex = 2;
ToLabel.Text = "по";
//
// FromDateTimePicker
//
FromDateTimePicker.Location = new Point(32, 7);
FromDateTimePicker.Margin = new Padding(3, 2, 3, 2);
FromDateTimePicker.Name = "FromDateTimePicker";
FromDateTimePicker.Size = new Size(175, 23);
FromDateTimePicker.TabIndex = 1;
//
// FromLabel
//
FromLabel.AutoSize = true;
FromLabel.Location = new Point(10, 10);
FromLabel.Name = "FromLabel";
FromLabel.Size = new Size(15, 15);
FromLabel.TabIndex = 0;
FromLabel.Text = "C";
//
// FormReportOrders
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(838, 338);
Controls.Add(Panel);
Margin = new Padding(3, 2, 3, 2);
Name = "FormReportOrders";
Text = "Заказы";
Panel.ResumeLayout(false);
Panel.PerformLayout();
ResumeLayout(false);
}
#endregion
private Panel Panel;
private Button ToPdfButton;
private Button CreateButton;
private DateTimePicker ToDateTimePicker;
private Label ToLabel;
private DateTimePicker FromDateTimePicker;
private Label FromLabel;
}
}

View File

@ -0,0 +1,98 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using Microsoft.Reporting.WinForms;
namespace AutoWorkshopView.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
{
_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);
}
}
}
}
}

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

@ -0,0 +1,115 @@
namespace AutoWorkshopView.Forms
{
partial class FormReportRepairComponents
{
/// <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()
{
DataGridView = new DataGridView();
ColumnRepair = new DataGridViewTextBoxColumn();
ColumnComponent = new DataGridViewTextBoxColumn();
ColumnCount = new DataGridViewTextBoxColumn();
SaveToExcelButton = new Button();
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
SuspendLayout();
//
// DataGridView
//
DataGridView.AllowUserToAddRows = false;
DataGridView.AllowUserToDeleteRows = false;
DataGridView.AllowUserToOrderColumns = true;
DataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnRepair, ColumnComponent, ColumnCount });
DataGridView.Dock = DockStyle.Bottom;
DataGridView.Location = new Point(0, 36);
DataGridView.Margin = new Padding(3, 2, 3, 2);
DataGridView.Name = "DataGridView";
DataGridView.ReadOnly = true;
DataGridView.RowHeadersWidth = 51;
DataGridView.RowTemplate.Height = 29;
DataGridView.Size = new Size(494, 302);
DataGridView.TabIndex = 0;
//
// ColumnRepair
//
ColumnRepair.FillWeight = 130F;
ColumnRepair.HeaderText = "Ремонт";
ColumnRepair.MinimumWidth = 6;
ColumnRepair.Name = "ColumnRepair";
ColumnRepair.ReadOnly = true;
//
// ColumnComponent
//
ColumnComponent.FillWeight = 140F;
ColumnComponent.HeaderText = "Компонент";
ColumnComponent.MinimumWidth = 6;
ColumnComponent.Name = "ColumnComponent";
ColumnComponent.ReadOnly = true;
//
// ColumnCount
//
ColumnCount.FillWeight = 90F;
ColumnCount.HeaderText = "Количество";
ColumnCount.MinimumWidth = 6;
ColumnCount.Name = "ColumnCount";
ColumnCount.ReadOnly = true;
//
// SaveToExcelButton
//
SaveToExcelButton.Location = new Point(12, 10);
SaveToExcelButton.Margin = new Padding(3, 2, 3, 2);
SaveToExcelButton.Name = "SaveToExcelButton";
SaveToExcelButton.Size = new Size(470, 22);
SaveToExcelButton.TabIndex = 1;
SaveToExcelButton.Text = "Сохранить в Excel";
SaveToExcelButton.UseVisualStyleBackColor = true;
SaveToExcelButton.Click += ButtonSaveToExcel_Click;
//
// FormReportRepairComponents
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(494, 338);
Controls.Add(SaveToExcelButton);
Controls.Add(DataGridView);
Margin = new Padding(3, 2, 3, 2);
Name = "FormReportRepairComponents";
Text = "Ремонт с компонентами";
Load += FormReportRepairComponents_Load;
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView DataGridView;
private Button SaveToExcelButton;
private DataGridViewTextBoxColumn ColumnRepair;
private DataGridViewTextBoxColumn ColumnComponent;
private DataGridViewTextBoxColumn ColumnCount;
}
}

View File

@ -0,0 +1,75 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
namespace AutoWorkshopView.Forms
{
public partial class FormReportRepairComponents : Form
{
private readonly ILogger _logger;
private readonly IReportLogic _logic;
public FormReportRepairComponents(ILogger<FormReportRepairComponents> Logger, IReportLogic Logic)
{
InitializeComponent();
_logger = Logger;
_logic = Logic;
}
private void FormReportRepairComponents_Load(object sender, EventArgs e)
{
try
{
var Dict = _logic.GetRepairComponents();
if (Dict != null)
{
DataGridView.Rows.Clear();
foreach (var Elem in Dict)
{
DataGridView.Rows.Add(new object[] { Elem.RepairName, "", "" });
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.SaveRepairComponentToExcelFile(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);
}
}
}
}
}

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

@ -92,15 +92,15 @@
//
this.ComponentsToolStripMenuItem1.Name = "ComponentsToolStripMenuItem1";
this.ComponentsToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
this.ComponentsToolStripMenuItem1.Text = "Пиццы";
this.ComponentsToolStripMenuItem1.Text = "Ремонты";
this.ComponentsToolStripMenuItem1.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
//
// ComponentRepairToolStripMenuItem1
//
this.ComponentRepairToolStripMenuItem1.Name = "ComponentRepairToolStripMenuItem1";
this.ComponentRepairToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
this.ComponentRepairToolStripMenuItem1.Text = "Пицца с компонентами";
this.ComponentRepairToolStripMenuItem1.Click += new System.EventHandler(this.ComponentPizzaToolStripMenuItem_Click);
this.ComponentRepairToolStripMenuItem1.Text = "Ремонт с компонентами";
this.ComponentRepairToolStripMenuItem1.Click += new System.EventHandler(this.ComponentRepairToolStripMenuItem_Click);
//
// OrdersToolStripMenuItem
//

View File

@ -173,6 +173,7 @@ namespace AutoWorkshopView
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
{
using var Dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (Dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveRepairsToWordFile(new ReportBindingModel { FileName = Dialog.FileName });
@ -183,6 +184,7 @@ namespace AutoWorkshopView
private void ComponentRepairToolStripMenuItem_Click(object sender, EventArgs e)
{
var Service = Program.ServiceProvider?.GetService(typeof(FormReportRepairComponents));
if (Service is FormReportRepairComponents Form)
{
Form.ShowDialog();
@ -192,6 +194,7 @@ namespace AutoWorkshopView
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var Service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (Service is FormReportOrders Form)
{
Form.ShowDialog();

View File

@ -1,5 +1,8 @@
using AutoWorkshopBusinessLogic.BusinessLogics;
using AutoWorkshopBusinessLogic.OfficePackage.Implements;
using AutoWorkshopBusinessLogic.OfficePackage;
using AutoWorkshopContracts.BusinessLogicContracts;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopDatabaseImplement.Implements;
using AutoWorkshopView.Forms;
@ -37,9 +40,15 @@ namespace AutoWorkshopView
Services.AddTransient<IComponentStorage, ComponentStorage>();
Services.AddTransient<IOrderStorage, OrderStorage>();
Services.AddTransient<IRepairStorage, RepairStorage>();
Services.AddTransient<IComponentLogic, ComponentLogic>();
Services.AddTransient<IOrderLogic, OrderLogic>();
Services.AddTransient<IRepairLogic, RepairLogic>();
Services.AddTransient<IReportLogic, ReportLogic>();
Services.AddTransient<AbstractSaveToWord, SaveToWord>();
Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
Services.AddTransient<MainForm>();
Services.AddTransient<FormComponent>();
@ -48,6 +57,8 @@ namespace AutoWorkshopView
Services.AddTransient<FormRepair>();
Services.AddTransient<FormRepairComponent>();
Services.AddTransient<FormRepairs>();
Services.AddTransient<FormReportRepairComponents>();
Services.AddTransient<FormReportOrders>();
}
}
}