diff --git a/IceCreamShop/IceCreamShop/IceCreamShop.csproj b/IceCreamShop/IceCreamShop/IceCreamShop.csproj
index 0ca01d7..b675aab 100644
--- a/IceCreamShop/IceCreamShop/IceCreamShop.csproj
+++ b/IceCreamShop/IceCreamShop/IceCreamShop.csproj
@@ -2,20 +2,26 @@
WinExe
- net8.0-windows
+ net6.0-windows7.0
enable
true
enable
-
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
@@ -25,4 +31,23 @@
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs
index a42cf5e..36b4d91 100644
--- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs
+++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs
@@ -32,6 +32,10 @@
ToolStripMenu = new ToolStripMenuItem();
КомпонентыStripMenuItem = new ToolStripMenuItem();
МороженноеStripMenuItem = new ToolStripMenuItem();
+ отчетыToolStripMenuItem = new ToolStripMenuItem();
+ списокМороженногоToolStripMenuItem = new ToolStripMenuItem();
+ компонентыПоМороженнымToolStripMenuItem = new ToolStripMenuItem();
+ списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
DataGridView = new DataGridView();
CreateOrderButton = new Button();
TakeInWorkButton = new Button();
@@ -45,10 +49,11 @@
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
- menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu });
+ menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu, отчетыToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
- menuStrip1.Size = new Size(1296, 28);
+ menuStrip1.Padding = new Padding(6, 3, 0, 3);
+ menuStrip1.Size = new Size(1296, 30);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
@@ -73,10 +78,38 @@
МороженноеStripMenuItem.Text = "Мороженное";
МороженноеStripMenuItem.Click += МороженноеStripMenuItem_Click;
//
+ // отчетыToolStripMenuItem
+ //
+ отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокМороженногоToolStripMenuItem, компонентыПоМороженнымToolStripMenuItem, списокЗаказовToolStripMenuItem });
+ отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
+ отчетыToolStripMenuItem.Size = new Size(73, 24);
+ отчетыToolStripMenuItem.Text = "Отчеты";
+ //
+ // списокМороженногоToolStripMenuItem
+ //
+ списокМороженногоToolStripMenuItem.Name = "списокМороженногоToolStripMenuItem";
+ списокМороженногоToolStripMenuItem.Size = new Size(305, 26);
+ списокМороженногоToolStripMenuItem.Text = "Список мороженного";
+ списокМороженногоToolStripMenuItem.Click += списокМороженногоToolStripMenuItem_Click;
+ //
+ // компонентыПоМороженнымToolStripMenuItem
+ //
+ компонентыПоМороженнымToolStripMenuItem.Name = "компонентыПоМороженнымToolStripMenuItem";
+ компонентыПоМороженнымToolStripMenuItem.Size = new Size(305, 26);
+ компонентыПоМороженнымToolStripMenuItem.Text = "Компоненты по мороженным";
+ компонентыПоМороженнымToolStripMenuItem.Click += компонентыПоМороженнымToolStripMenuItem_Click;
+ //
+ // списокЗаказовToolStripMenuItem
+ //
+ списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
+ списокЗаказовToolStripMenuItem.Size = new Size(305, 26);
+ списокЗаказовToolStripMenuItem.Text = "Список заказов";
+ списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
+ //
// DataGridView
//
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- DataGridView.Location = new Point(12, 31);
+ DataGridView.Location = new Point(11, 31);
DataGridView.Name = "DataGridView";
DataGridView.RowHeadersWidth = 51;
DataGridView.Size = new Size(1007, 407);
@@ -94,7 +127,7 @@
//
// TakeInWorkButton
//
- TakeInWorkButton.Location = new Point(1025, 66);
+ TakeInWorkButton.Location = new Point(1025, 67);
TakeInWorkButton.Name = "TakeInWorkButton";
TakeInWorkButton.Size = new Size(259, 29);
TakeInWorkButton.TabIndex = 3;
@@ -136,7 +169,7 @@
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1296, 450);
+ ClientSize = new Size(1296, 451);
Controls.Add(RefreshButton);
Controls.Add(IssuedButton);
Controls.Add(ReadyButton);
@@ -167,5 +200,9 @@
private Button ReadyButton;
private Button IssuedButton;
private Button RefreshButton;
+ private ToolStripMenuItem отчетыToolStripMenuItem;
+ private ToolStripMenuItem списокМороженногоToolStripMenuItem;
+ private ToolStripMenuItem компонентыПоМороженнымToolStripMenuItem;
+ private ToolStripMenuItem списокЗаказовToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/IceCreamShop/IceCreamShop/MainForm.cs b/IceCreamShop/IceCreamShop/MainForm.cs
index 600e794..3512117 100644
--- a/IceCreamShop/IceCreamShop/MainForm.cs
+++ b/IceCreamShop/IceCreamShop/MainForm.cs
@@ -1,4 +1,5 @@
-using IceCreamShopContracts.BindingModels;
+using IceCreamShopBusinessLogic.BusinessLogic;
+using IceCreamShopContracts.BindingModels;
using IceCreamShopContracts.BusinessLogicsContracts;
using IceCreamShopDataModels;
using IceCreamShopDataModels.Enums;
@@ -19,11 +20,13 @@ namespace IceCreamShop
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
- public MainForm(ILogger logger, IOrderLogic orderLogic)
+ private readonly IReportLogic _reportLogic;
+ public MainForm(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
+ _reportLogic = reportLogic;
}
private void КомпонентыStripMenuItem_Click(object sender, EventArgs e)
@@ -180,5 +183,42 @@ Program.ServiceProvider?.GetService(typeof(OrderForm));
{
LoadData();
}
+
+ private void списокМороженногоToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveIceCreamToWordFile(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(ReportIceCreamComponentForm));
+ if (service is ReportIceCreamComponentForm form)
+ {
+ form.ShowDialog();
+ }
+
+ }
+
+ private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service =
+Program.ServiceProvider?.GetService(typeof(ReportOrdersForm));
+ if (service is ReportOrdersForm form)
+ {
+ form.ShowDialog();
+ }
+
+ }
}
}
diff --git a/IceCreamShop/IceCreamShop/Program.cs b/IceCreamShop/IceCreamShop/Program.cs
index 5469e49..f98c936 100644
--- a/IceCreamShop/IceCreamShop/Program.cs
+++ b/IceCreamShop/IceCreamShop/Program.cs
@@ -1,4 +1,6 @@
using IceCreamShopBusinessLogic.BusinessLogic;
+using IceCreamShopBusinessLogic.OfficePackage.Implements;
+using IceCreamShopBusinessLogic.OfficePackage;
using IceCreamShopContracts.BusinessLogicsContracts;
using IceCreamShopContracts.StoragesContracts;
using IceCreamShopDatabaseImplement.Implements;
@@ -38,6 +40,7 @@ namespace IceCreamShop
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -46,6 +49,11 @@ namespace IceCreamShop
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
diff --git a/IceCreamShop/IceCreamShop/Properties/Resources.Designer.cs b/IceCreamShop/IceCreamShop/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..5ca0a7b
--- /dev/null
+++ b/IceCreamShop/IceCreamShop/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace IceCreamShop.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IceCreamShop.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/IceCreamShop/IceCreamShop/Properties/Resources.resx b/IceCreamShop/IceCreamShop/Properties/Resources.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/IceCreamShop/IceCreamShop/Properties/Resources.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/IceCreamShop/IceCreamShop/ReportIceCreamComponentForm.Designer.cs b/IceCreamShop/IceCreamShop/ReportIceCreamComponentForm.Designer.cs
new file mode 100644
index 0000000..b4bfb7f
--- /dev/null
+++ b/IceCreamShop/IceCreamShop/ReportIceCreamComponentForm.Designer.cs
@@ -0,0 +1,99 @@
+namespace IceCreamShop
+{
+ partial class ReportIceCreamComponentForm
+ {
+ ///
+ /// 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()
+ {
+ dataGridView = new DataGridView();
+ SaveButton = new Button();
+ IceCreamColumn = new DataGridViewTextBoxColumn();
+ ComponentColumn = new DataGridViewTextBoxColumn();
+ CountColumn = new DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { IceCreamColumn, ComponentColumn, CountColumn });
+ dataGridView.Location = new Point(12, 46);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowTemplate.Height = 25;
+ dataGridView.Size = new Size(570, 392);
+ dataGridView.TabIndex = 0;
+ //
+ // SaveButton
+ //
+ SaveButton.Location = new Point(12, 17);
+ SaveButton.Name = "SaveButton";
+ SaveButton.Size = new Size(114, 23);
+ SaveButton.TabIndex = 1;
+ SaveButton.Text = "Сохранить в Excel";
+ SaveButton.UseVisualStyleBackColor = true;
+ SaveButton.Click += SaveButton_Click;
+ //
+ // IceCreamColumn
+ //
+ IceCreamColumn.HeaderText = "Мороженное";
+ IceCreamColumn.Name = "IceCreamColumn";
+ IceCreamColumn.Width = 200;
+ //
+ // ComponentColumn
+ //
+ ComponentColumn.HeaderText = "Компоненты";
+ ComponentColumn.Name = "ComponentColumn";
+ ComponentColumn.Width = 200;
+ //
+ // CountColumn
+ //
+ CountColumn.HeaderText = "Количество";
+ CountColumn.Name = "CountColumn";
+ CountColumn.Width = 130;
+ //
+ // ReportIceCreamComponentForm
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(594, 450);
+ Controls.Add(SaveButton);
+ Controls.Add(dataGridView);
+ Name = "ReportIceCreamComponentForm";
+ Text = "Компоненты по мороженным";
+ Load += ReportIceCreamComponentForm_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button SaveButton;
+ private DataGridViewTextBoxColumn IceCreamColumn;
+ private DataGridViewTextBoxColumn ComponentColumn;
+ private DataGridViewTextBoxColumn CountColumn;
+ }
+}
\ No newline at end of file
diff --git a/IceCreamShop/IceCreamShop/ReportIceCreamComponentForm.cs b/IceCreamShop/IceCreamShop/ReportIceCreamComponentForm.cs
new file mode 100644
index 0000000..d6b6e59
--- /dev/null
+++ b/IceCreamShop/IceCreamShop/ReportIceCreamComponentForm.cs
@@ -0,0 +1,95 @@
+using IceCreamShopContracts.BindingModels;
+using IceCreamShopContracts.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 IceCreamShop
+{
+ public partial class ReportIceCreamComponentForm : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+
+ public ReportIceCreamComponentForm(ILogger
+logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+
+ }
+
+ private void ReportIceCreamComponentForm_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetIceCreamComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.IceCreamName,
+"", "" });
+ 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