diff --git a/SoftwareInstallationBusinessLogic/SoftwareInstallationBusinessLogic.csproj b/SoftwareInstallationBusinessLogic/SoftwareInstallationBusinessLogic.csproj
index f1b438a..1d4b053 100644
--- a/SoftwareInstallationBusinessLogic/SoftwareInstallationBusinessLogic.csproj
+++ b/SoftwareInstallationBusinessLogic/SoftwareInstallationBusinessLogic.csproj
@@ -7,8 +7,10 @@
+
+
diff --git a/SoftwareInstallationBusinessLogic/obj/Debug/net6.0/SoftwareInstallationBusinessLogic.AssemblyInfo.cs b/SoftwareInstallationBusinessLogic/obj/Debug/net6.0/SoftwareInstallationBusinessLogic.AssemblyInfo.cs
index d95ee59..897cb5c 100644
--- a/SoftwareInstallationBusinessLogic/obj/Debug/net6.0/SoftwareInstallationBusinessLogic.AssemblyInfo.cs
+++ b/SoftwareInstallationBusinessLogic/obj/Debug/net6.0/SoftwareInstallationBusinessLogic.AssemblyInfo.cs
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("SoftwareInstallationBusinessLogic")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+52adfaa68743a640ed50e2eabebef13eb1571ef2")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+113919a6ac388cefa24086189e08226bdc1b3368")]
[assembly: System.Reflection.AssemblyProductAttribute("SoftwareInstallationBusinessLogic")]
[assembly: System.Reflection.AssemblyTitleAttribute("SoftwareInstallationBusinessLogic")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/SoftwareInstallationContracts/SearchModels/OrderSearchModel.cs b/SoftwareInstallationContracts/SearchModels/OrderSearchModel.cs
index 3f85c04..2bc2c33 100644
--- a/SoftwareInstallationContracts/SearchModels/OrderSearchModel.cs
+++ b/SoftwareInstallationContracts/SearchModels/OrderSearchModel.cs
@@ -3,5 +3,7 @@
public class OrderSearchModel
{
public int? Id { get; set; }
+ public DateTime? DateFrom { get; set; }
+ public DateTime? DateTo { get; set; }
}
}
diff --git a/SoftwareInstallationView/FormMain.Designer.cs b/SoftwareInstallationView/FormMain.Designer.cs
index 98a59d6..fdac6e8 100644
--- a/SoftwareInstallationView/FormMain.Designer.cs
+++ b/SoftwareInstallationView/FormMain.Designer.cs
@@ -38,13 +38,17 @@
buttonTakeOrderInWork = new Button();
buttonCreateOrder = new Button();
dataGridView = new DataGridView();
+ отчетыToolStripMenuItem = new ToolStripMenuItem();
+ списокИзделийToolStripMenuItem = new ToolStripMenuItem();
+ компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
+ списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// menuStrip1
//
- menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
+ menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(1125, 24);
@@ -137,6 +141,37 @@
dataGridView.Size = new Size(948, 402);
dataGridView.TabIndex = 7;
//
+ // отчетыToolStripMenuItem
+ //
+ this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.списокИзделийToolStripMenuItem,
+ this.компонентыПоИзделиямToolStripMenuItem,
+ this.списокЗаказовToolStripMenuItem});
+ this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
+ this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
+ this.отчетыToolStripMenuItem.Text = "Отчеты";
+ //
+ // списокИзделийToolStripMenuItem
+ //
+ this.списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem";
+ this.списокИзделийToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
+ this.списокИзделийToolStripMenuItem.Text = "Список Изделий";
+ this.списокИзделийToolStripMenuItem.Click += new System.EventHandler(this.списокИзделийToolStripMenuItem_Click);
+ //
+ // компонентыПоИзделиямToolStripMenuItem
+ //
+ this.компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
+ this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
+ this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по Изделиям";
+ this.компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.компонентыПоИзделиямToolStripMenuItem_Click);
+ //
+ // списокЗаказовToolStripMenuItem
+ //
+ this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
+ this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
+ this.списокЗаказовToolStripMenuItem.Text = "Список Заказов";
+ this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click);
+ //
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -171,5 +206,9 @@
private Button buttonTakeOrderInWork;
private Button buttonCreateOrder;
private DataGridView dataGridView;
+ private ToolStripMenuItem отчетыToolStripMenuItem;
+ private ToolStripMenuItem списокИзделийToolStripMenuItem;
+ private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
+ private ToolStripMenuItem списокЗаказовToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/SoftwareInstallationView/FormMain.cs b/SoftwareInstallationView/FormMain.cs
index f70389b..742b392 100644
--- a/SoftwareInstallationView/FormMain.cs
+++ b/SoftwareInstallationView/FormMain.cs
@@ -2,6 +2,8 @@
using SoftwareInstallationContracts.BusinessLogicContracts;
using Microsoft.Extensions.Logging;
using SoftwareInstallationDataModel.Enums;
+using SofrwareInstallationContracts.BindingModels;
+using SoftwareInstallationBusinessLogic.BusinessLogic;
namespace SoftwareInstallationView
{
@@ -9,11 +11,14 @@ namespace SoftwareInstallationView
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
- public FormMain(ILogger logger, IOrderLogic orderLogic)
+ private readonly IReportLogic _reportLogic;
+
+ public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
+ _reportLogic = reportLogic;
}
private void FormMain_Load(object sender, EventArgs e)
{
@@ -169,5 +174,37 @@ namespace SoftwareInstallationView
{
LoadData();
}
+ private void списокИзделийToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SavePackagesToWordFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+
+ }
+
+ private void компонентыПоИзделиямToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportPackageComponents));
+ if (service is FormReportPackageComponents form)
+ {
+ form.ShowDialog();
+ }
+
+ }
+
+ private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
+ if (service is FormReportOrders form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/SoftwareInstallationView/FormReportOrders.Designer.cs b/SoftwareInstallationView/FormReportOrders.Designer.cs
new file mode 100644
index 0000000..df3bd29
--- /dev/null
+++ b/SoftwareInstallationView/FormReportOrders.Designer.cs
@@ -0,0 +1,131 @@
+namespace SoftwareInstallationView
+{
+ partial class FormReportOrders
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
+ this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.MakeButton = new System.Windows.Forms.Button();
+ this.ToPdfButton = new System.Windows.Forms.Button();
+ this.panel = new System.Windows.Forms.Panel();
+ this.panel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // dateTimePickerFrom
+ //
+ this.dateTimePickerFrom.Location = new System.Drawing.Point(43, 12);
+ this.dateTimePickerFrom.Name = "dateTimePickerFrom";
+ this.dateTimePickerFrom.Size = new System.Drawing.Size(200, 23);
+ this.dateTimePickerFrom.TabIndex = 0;
+ //
+ // dateTimePickerTo
+ //
+ this.dateTimePickerTo.Location = new System.Drawing.Point(276, 12);
+ this.dateTimePickerTo.Name = "dateTimePickerTo";
+ this.dateTimePickerTo.Size = new System.Drawing.Size(200, 23);
+ this.dateTimePickerTo.TabIndex = 1;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(22, 18);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(15, 15);
+ this.label1.TabIndex = 2;
+ this.label1.Text = "С";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(249, 18);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(21, 15);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "по";
+ //
+ // MakeButton
+ //
+ this.MakeButton.Location = new System.Drawing.Point(517, 12);
+ this.MakeButton.Name = "MakeButton";
+ this.MakeButton.Size = new System.Drawing.Size(105, 23);
+ this.MakeButton.TabIndex = 4;
+ this.MakeButton.Text = "Сформировать";
+ this.MakeButton.UseVisualStyleBackColor = true;
+ this.MakeButton.Click += new System.EventHandler(this.MakeButton_Click);
+ //
+ // ToPdfButton
+ //
+ this.ToPdfButton.Location = new System.Drawing.Point(684, 12);
+ this.ToPdfButton.Name = "ToPdfButton";
+ this.ToPdfButton.Size = new System.Drawing.Size(75, 23);
+ this.ToPdfButton.TabIndex = 5;
+ this.ToPdfButton.Text = "В Pdf";
+ this.ToPdfButton.UseVisualStyleBackColor = true;
+ this.ToPdfButton.Click += new System.EventHandler(this.ToPdfButton_Click);
+ //
+ // panel
+ //
+ this.panel.Controls.Add(this.label2);
+ this.panel.Controls.Add(this.ToPdfButton);
+ this.panel.Controls.Add(this.label1);
+ this.panel.Controls.Add(this.MakeButton);
+ this.panel.Controls.Add(this.dateTimePickerFrom);
+ this.panel.Controls.Add(this.dateTimePickerTo);
+ 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(800, 52);
+ this.panel.TabIndex = 6;
+ //
+ // FormReportOrders
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.panel);
+ this.Name = "FormReportOrders";
+ this.Text = "Заказы";
+ this.panel.ResumeLayout(false);
+ this.panel.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DateTimePicker dateTimePickerFrom;
+ private DateTimePicker dateTimePickerTo;
+ private Label label1;
+ private Label label2;
+ private Button MakeButton;
+ private Button ToPdfButton;
+ private Panel panel;
+ }
+}
\ No newline at end of file
diff --git a/SoftwareInstallationView/FormReportOrders.cs b/SoftwareInstallationView/FormReportOrders.cs
new file mode 100644
index 0000000..a4bb74e
--- /dev/null
+++ b/SoftwareInstallationView/FormReportOrders.cs
@@ -0,0 +1,90 @@
+using Microsoft.Extensions.Logging;
+using SoftwareInstallationContracts.BusinessLogicContracts;
+using SofrwareInstallationContracts.BindingModels;
+using Microsoft.Reporting.WinForms;
+
+namespace SoftwareInstallationView
+{
+ public partial class FormReportOrders : Form
+ {
+ private readonly ReportViewer reportViewer;
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+ public FormReportOrders(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
+ Controls.Clear();
+ Controls.Add(reportViewer);
+ Controls.Add(panel);
+ }
+
+ private void MakeButton_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 ToPdfButton_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);
+ }
+ }
+ }
+ }
+}
diff --git a/SoftwareInstallationView/FormReportOrders.resx b/SoftwareInstallationView/FormReportOrders.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/SoftwareInstallationView/FormReportOrders.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/SoftwareInstallationView/FormReportPackageComponents.Designer.cs b/SoftwareInstallationView/FormReportPackageComponents.Designer.cs
new file mode 100644
index 0000000..ae778f4
--- /dev/null
+++ b/SoftwareInstallationView/FormReportPackageComponents.Designer.cs
@@ -0,0 +1,102 @@
+namespace SoftwareInstallationView
+{
+ partial class FormReportPackageComponents
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.SaveToExcelButton = new System.Windows.Forms.Button();
+ this.ComponentColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.PackageColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.CountColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ComponentColumn,
+ this.PackageColumn,
+ this.CountColumn});
+ this.dataGridView.Location = new System.Drawing.Point(12, 38);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(607, 400);
+ this.dataGridView.TabIndex = 0;
+ //
+ // SaveToExcelButton
+ //
+ this.SaveToExcelButton.Location = new System.Drawing.Point(12, 9);
+ this.SaveToExcelButton.Name = "SaveToExcelButton";
+ this.SaveToExcelButton.Size = new System.Drawing.Size(119, 23);
+ this.SaveToExcelButton.TabIndex = 1;
+ this.SaveToExcelButton.Text = "Сохранить в Excel";
+ this.SaveToExcelButton.UseVisualStyleBackColor = true;
+ this.SaveToExcelButton.Click += new System.EventHandler(this.SaveToExcelButton_Click);
+ //
+ // ComponentColumn
+ //
+ this.ComponentColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.ComponentColumn.HeaderText = "Компонент";
+ this.ComponentColumn.Name = "ComponentColumn";
+ //
+ // PackageColumn
+ //
+ this.PackageColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.PackageColumn.HeaderText = "Изделие";
+ this.PackageColumn.Name = "PackageColumn";
+ //
+ // CountColumn
+ //
+ this.CountColumn.HeaderText = "Количество";
+ this.CountColumn.Name = "CountColumn";
+ //
+ // FormReportPackageComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(631, 450);
+ this.Controls.Add(this.SaveToExcelButton);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormReportPackageComponents";
+ this.Text = "Компоненты по Изделиям";
+ this.Load += new System.EventHandler(this.FormReportPackageComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn ComponentColumn;
+ private DataGridViewTextBoxColumn PackageColumn;
+ private DataGridViewTextBoxColumn CountColumn;
+ private Button SaveToExcelButton;
+ }
+}
\ No newline at end of file
diff --git a/SoftwareInstallationView/FormReportPackageComponents.cs b/SoftwareInstallationView/FormReportPackageComponents.cs
new file mode 100644
index 0000000..d35a307
--- /dev/null
+++ b/SoftwareInstallationView/FormReportPackageComponents.cs
@@ -0,0 +1,71 @@
+using Microsoft.Extensions.Logging;
+using SofrwareInstallationContracts.BindingModels;
+using SoftwareInstallationContracts.BusinessLogicContracts;
+
+namespace SoftwareInstallationView
+{
+ public partial class FormReportPackageComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+ public FormReportPackageComponents(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void SaveToExcelButton_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog
+ {
+ Filter = "xlsx|*.xlsx"
+ };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SavePackageComponentToExcelFile(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 FormReportPackageComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetPackageComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.PackageName,"", "" });
+ 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
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -26,6 +27,7 @@
+
diff --git a/SoftwareInstallationView/SoftwareInstallationView.csproj.user b/SoftwareInstallationView/SoftwareInstallationView.csproj.user
index 0295687..1f76152 100644
--- a/SoftwareInstallationView/SoftwareInstallationView.csproj.user
+++ b/SoftwareInstallationView/SoftwareInstallationView.csproj.user
@@ -1,4 +1,11 @@
-
+
+
+ Form
+
+
+ Form
+
+
\ No newline at end of file