ю
This commit is contained in:
parent
11dab0e4ab
commit
c6f09e166c
@ -5,7 +5,7 @@ using PlumbingRepairContracts.StoragesContracts;
|
||||
using PlumbingRepairContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.BusinesLogics
|
||||
namespace PlumbingRepairBusinesLogic.BusinesLogics
|
||||
{
|
||||
public class ComponentLogic : IComponentLogic
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToExcel
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToPdf
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWord
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperEnums
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum ExcelStyleInfoType
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperEnums
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum PdfParagraphAlignmentType
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperEnums
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum WordJustificationType
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using PlumbingRepairContracts.ViewModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfo
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelCellParameters
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelMergeParameters
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using PlumbingRepairContracts.ViewModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfInfo
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfParagraph
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfRowParameters
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using PlumbingRepairContracts.ViewModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordInfo
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordParagraph
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.HelperModels
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTextProperties
|
||||
{
|
||||
|
@ -3,10 +3,10 @@ using DocumentFormat.OpenXml.Office2013.Excel;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.Implements
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToExcel : AbstractSaveToExcel
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperModels;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.Implements
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToPdf : AbstractSaveToPdf
|
||||
{
|
||||
|
@ -1,11 +1,11 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperEnums;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperModels;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.OfficePackage.Implements
|
||||
namespace PlumbingRepairBusinesLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToWord : AbstractSaveToWord
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ using PlumbingRepairContracts.ViewModels;
|
||||
using PlumbingRepairDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.BusinesLogics
|
||||
namespace PlumbingRepairBusinesLogic.BusinesLogics
|
||||
{
|
||||
public class OrderLogic: IOrderLogic
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinessLogic.OfficePackage;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage.HelperModels;
|
||||
using PlumbingRepairBusinesLogic.OfficePackage;
|
||||
using PlumbingRepairContracts.BindingModels;
|
||||
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||
using PlumbingRepairContracts.BusinesLogicsContracts;
|
||||
using PlumbingRepairContracts.SearchModels;
|
||||
using PlumbingRepairContracts.StoragesContracts;
|
||||
using PlumbingRepairContracts.ViewModels;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.BusinessLogic
|
||||
namespace PlumbingRepairBusinesLogic.BusinessLogic
|
||||
{
|
||||
public class ReportLogic : IReportLogic
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ using PlumbingRepairContracts.StoragesContracts;
|
||||
using PlumbingRepairContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace PlumbingRepairBusinessLogic.BusinesLogics
|
||||
namespace PlumbingRepairBusinesLogic.BusinesLogics
|
||||
{
|
||||
public class WorkLogic: IWorkLogic
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using PlumbingRepairContracts.BindingModels;
|
||||
using PlumbingRepairContracts.ViewModels;
|
||||
|
||||
namespace PlumbingRepairContracts.BusinessLogicsContracts
|
||||
namespace PlumbingRepairContracts.BusinesLogicsContracts
|
||||
{
|
||||
public interface IReportLogic
|
||||
{
|
||||
|
@ -143,19 +143,22 @@
|
||||
//
|
||||
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
||||
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(268, 26);
|
||||
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
||||
this.списокКомпонентовToolStripMenuItem.Text = "Список работ";
|
||||
this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.WorksToolStripMenuItem_Click);
|
||||
//
|
||||
// компонентыПоРаботамToolStripMenuItem
|
||||
//
|
||||
this.компонентыПоРаботамToolStripMenuItem.Name = "компонентыПоРаботамToolStripMenuItem";
|
||||
this.компонентыПоРаботамToolStripMenuItem.Size = new System.Drawing.Size(268, 26);
|
||||
this.компонентыПоРаботамToolStripMenuItem.Text = "Компоненты по работам";
|
||||
this.компонентыПоРаботамToolStripMenuItem.Click += new System.EventHandler(this.WorkComponentToolStripMenuItem_Click);
|
||||
//
|
||||
// списокЗаказовToolStripMenuItem
|
||||
//
|
||||
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(268, 26);
|
||||
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PlumbingRepairContracts.BindingModels;
|
||||
using PlumbingRepairBusinesLogic.BusinessLogic;
|
||||
using PlumbingRepairContracts.BusinesLogicsContracts;
|
||||
using PlumbingRepairDataModels.Enums;
|
||||
|
||||
@ -9,12 +10,13 @@ namespace PlumbingRepairView
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
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();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
_reportLogic = reportLogic;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
@ -186,5 +188,36 @@ namespace PlumbingRepairView
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void WorksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveWorksToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private void WorkComponentToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportWorkComponents));
|
||||
if (service is FormReportWorkComponents form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||
if (service is FormReportOrders form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "FormReportWorkComponents";
|
||||
this.Text = "FormReportOrders";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?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">
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace PlumbingRepair
|
||||
namespace PlumbingRepairView
|
||||
{
|
||||
partial class FormReportWorkComponents
|
||||
{
|
||||
@ -28,7 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.SaveButton = new System.Windows.Forms.Button();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.Component = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Work = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@ -36,14 +36,15 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
// SaveButton
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(12, 12);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(94, 29);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.SaveButton.Location = new System.Drawing.Point(16, 17);
|
||||
this.SaveButton.Name = "SaveButton";
|
||||
this.SaveButton.Size = new System.Drawing.Size(189, 29);
|
||||
this.SaveButton.TabIndex = 0;
|
||||
this.SaveButton.Text = "Сохранить в Excel";
|
||||
this.SaveButton.UseVisualStyleBackColor = true;
|
||||
this.SaveButton.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
@ -52,43 +53,47 @@
|
||||
this.Component,
|
||||
this.Work,
|
||||
this.Count});
|
||||
this.dataGridView.Location = new System.Drawing.Point(-3, 58);
|
||||
this.dataGridView.Location = new System.Drawing.Point(1, 61);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(644, 378);
|
||||
this.dataGridView.Size = new System.Drawing.Size(654, 489);
|
||||
this.dataGridView.TabIndex = 1;
|
||||
//
|
||||
// Component
|
||||
//
|
||||
this.Component.FillWeight = 200F;
|
||||
this.Component.HeaderText = "Компонент";
|
||||
this.Component.MinimumWidth = 6;
|
||||
this.Component.Name = "Component";
|
||||
this.Component.Width = 195;
|
||||
this.Component.Width = 200;
|
||||
//
|
||||
// Work
|
||||
//
|
||||
this.Work.HeaderText = "Изделие";
|
||||
this.Work.FillWeight = 200F;
|
||||
this.Work.HeaderText = "Работа";
|
||||
this.Work.MinimumWidth = 6;
|
||||
this.Work.Name = "Work";
|
||||
this.Work.Width = 195;
|
||||
this.Work.Width = 200;
|
||||
//
|
||||
// Count
|
||||
//
|
||||
this.Count.FillWeight = 200F;
|
||||
this.Count.HeaderText = "Количество";
|
||||
this.Count.MinimumWidth = 6;
|
||||
this.Count.Name = "Count";
|
||||
this.Count.Width = 195;
|
||||
this.Count.Width = 200;
|
||||
//
|
||||
// FormReportWorkComponents
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(639, 538);
|
||||
this.ClientSize = new System.Drawing.Size(656, 551);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.SaveButton);
|
||||
this.Name = "FormReportWorkComponents";
|
||||
this.Text = "FormReportOrders";
|
||||
this.Text = "Компоненты по работам";
|
||||
this.Load += new System.EventHandler(this.FormReportWorkComponents_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@ -96,7 +101,7 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private Button button1;
|
||||
private Button SaveButton;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn Component;
|
||||
private DataGridViewTextBoxColumn Work;
|
||||
|
@ -1,20 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PlumbingRepairContracts.BindingModels;
|
||||
using PlumbingRepairContracts.BusinesLogicsContracts;
|
||||
|
||||
namespace PlumbingRepairView
|
||||
{
|
||||
public partial class FormReportOrders : Form
|
||||
public partial class FormReportWorkComponents : Form
|
||||
{
|
||||
public FormReportOrders()
|
||||
private readonly ILogger _logger;
|
||||
private readonly IReportLogic _logic;
|
||||
public FormReportWorkComponents(ILogger<FormReportWorkComponents> logger, IReportLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog
|
||||
{
|
||||
Filter = "xlsx|*.xlsx"
|
||||
};
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.SaveWorkComponentToExcelFile(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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FormReportWorkComponents_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dict = _logic.GetWork();
|
||||
if (dict != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.WorkName, "", "" });
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
|
||||
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -4,7 +4,7 @@ using PlumbingRepairDatabaseImplements.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
using PlumbingRepairBusinessLogic.BusinesLogics;
|
||||
using PlumbingRepairBusinesLogic.BusinesLogics;
|
||||
|
||||
|
||||
namespace PlumbingRepairView
|
||||
|
10
PlumbingRepair/PlumbingRepairView/ReportOrders.rdlc
Normal file
10
PlumbingRepair/PlumbingRepairView/ReportOrders.rdlc
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
||||
<Width>6.5in</Width>
|
||||
<Body>
|
||||
<Height>2in</Height>
|
||||
</Body>
|
||||
<rd:ReportTemplate>true</rd:ReportTemplate>
|
||||
<Page>
|
||||
</Page>
|
||||
</Report>
|
Loading…
x
Reference in New Issue
Block a user