diff --git a/JewelryStore/JewelryStore/DataSources/JewelryStoreContracts.BusinessLogicsContracts.IComponentLogic.datasource b/JewelryStore/JewelryStore/DataSources/JewelryStoreContracts.BusinessLogicsContracts.IComponentLogic.datasource
new file mode 100644
index 0000000..55435b4
--- /dev/null
+++ b/JewelryStore/JewelryStore/DataSources/JewelryStoreContracts.BusinessLogicsContracts.IComponentLogic.datasource
@@ -0,0 +1,10 @@
+
+
+
+ JewelryStoreContracts.BusinessLogicsContracts.IComponentLogic, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/JewelryStore/JewelryStore/FormMain.Designer.cs b/JewelryStore/JewelryStore/FormMain.Designer.cs
index 5deb703..0795cd8 100644
--- a/JewelryStore/JewelryStore/FormMain.Designer.cs
+++ b/JewelryStore/JewelryStore/FormMain.Designer.cs
@@ -32,6 +32,10 @@
this.СправочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.КомпонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ИзделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.списокИзделийToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
@@ -46,7 +50,8 @@
//
this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.СправочникиToolStripMenuItem});
+ this.СправочникиToolStripMenuItem,
+ this.отчетыToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1121, 33);
@@ -76,6 +81,37 @@
this.ИзделияToolStripMenuItem.Text = "Изделия";
this.ИзделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
//
+ // отчеты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(88, 29);
+ this.отчетыToolStripMenuItem.Text = "Отчеты";
+ //
+ // списокИзделийToolStripMenuItem
+ //
+ this.списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem";
+ this.списокИзделийToolStripMenuItem.Size = new System.Drawing.Size(327, 34);
+ this.списокИзделийToolStripMenuItem.Text = "Список изделий";
+ this.списокИзделийToolStripMenuItem.Click += new System.EventHandler(this.СписокИзделийToolStripMenuItem_Click);
+ //
+ // компонентыПоИзделиямToolStripMenuItem
+ //
+ this.компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
+ this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(327, 34);
+ this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
+ this.компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыПоИзделиямToolStripMenuItem_Click);
+ //
+ // списокЗаказовToolStripMenuItem
+ //
+ this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
+ this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(327, 34);
+ this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
+ this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.СписокЗаказовToolStripMenuItem_Click);
+ //
// dataGridView
//
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -177,5 +213,9 @@
private Button buttonOrderReady;
private Button buttonIssuedOrder;
private Button buttonRefresh;
+ private ToolStripMenuItem отчетыToolStripMenuItem;
+ private ToolStripMenuItem списокИзделийToolStripMenuItem;
+ private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
+ private ToolStripMenuItem списокЗаказовToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/JewelryStore/JewelryStore/FormMain.cs b/JewelryStore/JewelryStore/FormMain.cs
index d35464d..69bd788 100644
--- a/JewelryStore/JewelryStore/FormMain.cs
+++ b/JewelryStore/JewelryStore/FormMain.cs
@@ -1,4 +1,5 @@
-using JewelryStoreContracts.BindingModels;
+using JewelryStoreBusinessLogic.BusinessLogics;
+using JewelryStoreContracts.BindingModels;
using JewelryStoreContracts.BusinessLogicsContracts;
using JewelryStoreDataModels.Enums;
using Microsoft.Extensions.Logging;
@@ -10,12 +11,15 @@ namespace JewelryStore
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
+ private readonly IReportLogic _reportLogic;
- public FormMain(ILogger logger, IOrderLogic orderLogic)
+
+ public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
+ _reportLogic = reportLogic;
}
private void FormMain_Load(object sender, EventArgs e)
@@ -145,5 +149,36 @@ namespace JewelryStore
{
LoadData();
}
+
+
+ private void СписокИзделийToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveJewelsToWordFile(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(FormReportJewelComponents));
+ if (service is FormReportJewelComponents 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/JewelryStore/JewelryStore/FormReportJewelComponents.Designer.cs b/JewelryStore/JewelryStore/FormReportJewelComponents.Designer.cs
new file mode 100644
index 0000000..a49c5d6
--- /dev/null
+++ b/JewelryStore/JewelryStore/FormReportJewelComponents.Designer.cs
@@ -0,0 +1,108 @@
+namespace JewelryStore
+{
+ partial class FormReportJewelComponents
+ {
+ ///
+ /// 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.buttonSaveToExcel = new System.Windows.Forms.Button();
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.ColumnComponent = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnJewel = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // buttonSaveToExcel
+ //
+ this.buttonSaveToExcel.Location = new System.Drawing.Point(22, 21);
+ this.buttonSaveToExcel.Name = "buttonSaveToExcel";
+ this.buttonSaveToExcel.Size = new System.Drawing.Size(193, 34);
+ this.buttonSaveToExcel.TabIndex = 0;
+ this.buttonSaveToExcel.Text = "Сохранить в Excel";
+ this.buttonSaveToExcel.UseVisualStyleBackColor = true;
+ this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
+ //
+ // dataGridView
+ //
+ this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ColumnComponent,
+ this.ColumnJewel,
+ this.ColumnCount});
+ this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.dataGridView.Location = new System.Drawing.Point(0, 77);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersVisible = false;
+ this.dataGridView.RowHeadersWidth = 62;
+ this.dataGridView.RowTemplate.Height = 33;
+ this.dataGridView.Size = new System.Drawing.Size(800, 373);
+ this.dataGridView.TabIndex = 1;
+ //
+ // ColumnComponent
+ //
+ this.ColumnComponent.HeaderText = "Компонент";
+ this.ColumnComponent.MinimumWidth = 8;
+ this.ColumnComponent.Name = "ColumnComponent";
+ //
+ // ColumnJewel
+ //
+ this.ColumnJewel.HeaderText = "Изделие";
+ this.ColumnJewel.MinimumWidth = 8;
+ this.ColumnJewel.Name = "ColumnJewel";
+ //
+ // ColumnCount
+ //
+ this.ColumnCount.HeaderText = "Количество";
+ this.ColumnCount.MinimumWidth = 8;
+ this.ColumnCount.Name = "ColumnCount";
+ //
+ // FormReportJewelComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.dataGridView);
+ this.Controls.Add(this.buttonSaveToExcel);
+ this.Name = "FormReportJewelComponents";
+ this.Text = "Компоненты по изделиям";
+ this.Load += new System.EventHandler(this.FormReportJewelComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Button buttonSaveToExcel;
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn ColumnComponent;
+ private DataGridViewTextBoxColumn ColumnJewel;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/JewelryStore/JewelryStore/FormReportJewelComponents.cs b/JewelryStore/JewelryStore/FormReportJewelComponents.cs
new file mode 100644
index 0000000..4227e2f
--- /dev/null
+++ b/JewelryStore/JewelryStore/FormReportJewelComponents.cs
@@ -0,0 +1,77 @@
+using JewelryStoreContracts.BindingModels;
+using JewelryStoreContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+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;
+
+namespace JewelryStore
+{
+ public partial class FormReportJewelComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+ public FormReportJewelComponents(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+ private void FormReportJewelComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetJewelComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.JewelName, "", "" });
+ 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