Всё, кроме pdf

This commit is contained in:
maxnes3 2023-03-14 00:57:05 +04:00
parent d21e7de890
commit a8cd32adeb
4 changed files with 88 additions and 129 deletions

View File

@ -87,14 +87,15 @@
//
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
списокКомпонентовToolStripMenuItem.Size = new Size(242, 22);
списокКомпонентовToolStripMenuItem.Text = "список компонентов";
списокКомпонентовToolStripMenuItem.Click += ComputerComponentsToolStripMenuItem_Click;
списокКомпонентовToolStripMenuItem.Text = "список компьютеров";
списокКомпонентовToolStripMenuItem.Click += ComponentsDocxToolStripMenuItem_Click;
//
// компонентыПоКомпьютерамToolStripMenuItem
//
компонентыПоКомпьютерамToolStripMenuItem.Name = омпонентыПоКомпьютерамToolStripMenuItem";
компонентыПоКомпьютерамToolStripMenuItem.Size = new Size(242, 22);
компонентыПоКомпьютерамToolStripMenuItem.Text = "компоненты по компьютерам";
компонентыПоКомпьютерамToolStripMenuItem.Click += ComputerComponentsToolStripMenuItem_Click;
//
// списокЗаказовToolStripMenuItem
//

View File

@ -1,4 +1,5 @@
using ComputersShopContracts.BindingModels;
using ComputersShopBusinessLogic.BusinessLogics;
using ComputersShopContracts.BindingModels;
using ComputersShopContracts.BusinessLogicContracts;
using ComputersShopDataModels.Enums;
using Microsoft.Extensions.Logging;
@ -18,12 +19,14 @@ namespace ComputersShopView
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportlogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportlogic;
}
private void FormMain_Load(object sender, EventArgs e)
@ -166,6 +169,16 @@ namespace ComputersShopView
}
}
private void ComponentsDocxToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveComputersToWordFile(new ReportBindingModel { FileName = dialog.FileName });
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void ComputerComponentsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportComputerComponents));

View File

@ -28,94 +28,99 @@
/// </summary>
private void InitializeComponent()
{
this.panel = new System.Windows.Forms.Panel();
this.buttonToPdf = new System.Windows.Forms.Button();
this.buttonMake = new System.Windows.Forms.Button();
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
this.labelTo = new System.Windows.Forms.Label();
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
this.labelFrom = new System.Windows.Forms.Label();
this.panel.SuspendLayout();
this.SuspendLayout();
panel = new Panel();
buttonToPdf = new Button();
buttonMake = new Button();
dateTimePickerTo = new DateTimePicker();
labelTo = new Label();
dateTimePickerFrom = new DateTimePicker();
labelFrom = new Label();
panel.SuspendLayout();
SuspendLayout();
//
// panel
//
this.panel.Controls.Add(this.buttonToPdf);
this.panel.Controls.Add(this.buttonMake);
this.panel.Controls.Add(this.dateTimePickerTo);
this.panel.Controls.Add(this.labelTo);
this.panel.Controls.Add(this.dateTimePickerFrom);
this.panel.Controls.Add(this.labelFrom);
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(926, 47);
this.panel.TabIndex = 0;
panel.Controls.Add(buttonToPdf);
panel.Controls.Add(buttonMake);
panel.Controls.Add(dateTimePickerTo);
panel.Controls.Add(labelTo);
panel.Controls.Add(dateTimePickerFrom);
panel.Controls.Add(labelFrom);
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(810, 35);
panel.TabIndex = 0;
//
// buttonToPdf
//
this.buttonToPdf.Location = new System.Drawing.Point(825, 7);
this.buttonToPdf.Name = "buttonToPdf";
this.buttonToPdf.Size = new System.Drawing.Size(94, 29);
this.buttonToPdf.TabIndex = 5;
this.buttonToPdf.Text = "в Pdf";
this.buttonToPdf.UseVisualStyleBackColor = true;
this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
buttonToPdf.Location = new Point(722, 5);
buttonToPdf.Margin = new Padding(3, 2, 3, 2);
buttonToPdf.Name = "buttonToPdf";
buttonToPdf.Size = new Size(82, 22);
buttonToPdf.TabIndex = 5;
buttonToPdf.Text = "в Pdf";
buttonToPdf.UseVisualStyleBackColor = true;
buttonToPdf.Click += ButtonToPdf_Click;
//
// buttonMake
//
this.buttonMake.Location = new System.Drawing.Point(643, 7);
this.buttonMake.Name = "buttonMake";
this.buttonMake.Size = new System.Drawing.Size(149, 29);
this.buttonMake.TabIndex = 4;
this.buttonMake.Text = "Сформировать";
this.buttonMake.UseVisualStyleBackColor = true;
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
buttonMake.Location = new Point(563, 5);
buttonMake.Margin = new Padding(3, 2, 3, 2);
buttonMake.Name = "buttonMake";
buttonMake.Size = new Size(130, 22);
buttonMake.TabIndex = 4;
buttonMake.Text = "Сформировать";
buttonMake.UseVisualStyleBackColor = true;
buttonMake.Click += ButtonMake_Click;
//
// dateTimePickerTo
//
this.dateTimePickerTo.Location = new System.Drawing.Point(348, 9);
this.dateTimePickerTo.Name = "dateTimePickerTo";
this.dateTimePickerTo.Size = new System.Drawing.Size(250, 27);
this.dateTimePickerTo.TabIndex = 3;
dateTimePickerTo.Location = new Point(304, 7);
dateTimePickerTo.Margin = new Padding(3, 2, 3, 2);
dateTimePickerTo.Name = "dateTimePickerTo";
dateTimePickerTo.Size = new Size(219, 23);
dateTimePickerTo.TabIndex = 3;
//
// labelTo
//
this.labelTo.AutoSize = true;
this.labelTo.Location = new System.Drawing.Point(292, 14);
this.labelTo.Name = "labelTo";
this.labelTo.Size = new System.Drawing.Size(50, 20);
this.labelTo.TabIndex = 2;
this.labelTo.Text = "label1";
labelTo.AutoSize = true;
labelTo.Location = new Point(256, 10);
labelTo.Name = "labelTo";
labelTo.Size = new Size(38, 15);
labelTo.TabIndex = 2;
labelTo.Text = "label1";
//
// dateTimePickerFrom
//
this.dateTimePickerFrom.Location = new System.Drawing.Point(36, 9);
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
this.dateTimePickerFrom.Size = new System.Drawing.Size(250, 27);
this.dateTimePickerFrom.TabIndex = 1;
dateTimePickerFrom.Location = new Point(32, 7);
dateTimePickerFrom.Margin = new Padding(3, 2, 3, 2);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(219, 23);
dateTimePickerFrom.TabIndex = 1;
//
// labelFrom
//
this.labelFrom.AutoSize = true;
this.labelFrom.Location = new System.Drawing.Point(12, 14);
this.labelFrom.Name = "labelFrom";
this.labelFrom.Size = new System.Drawing.Size(18, 20);
this.labelFrom.TabIndex = 0;
this.labelFrom.Text = "C";
labelFrom.AutoSize = true;
labelFrom.Location = new Point(10, 10);
labelFrom.Name = "labelFrom";
labelFrom.Size = new Size(15, 15);
labelFrom.TabIndex = 0;
labelFrom.Text = "C";
//
// FormReportOrders
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(926, 450);
this.Controls.Add(this.panel);
this.Name = "FormReportOrders";
this.Text = "Заказы";
this.panel.ResumeLayout(false);
this.panel.PerformLayout();
this.ResumeLayout(false);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(810, 582);
Controls.Add(panel);
Margin = new Padding(3, 2, 3, 2);
Name = "FormReportOrders";
Text = "Заказы";
panel.ResumeLayout(false);
panel.PerformLayout();
ResumeLayout(false);
}
#endregion

View File

@ -1,64 +1,4 @@
<?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.
-->
<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">