diff --git a/FlowerShop/FlowerShop/FlowerShop.csproj b/FlowerShop/FlowerShop/FlowerShop.csproj
index ad47413..2e0a216 100644
--- a/FlowerShop/FlowerShop/FlowerShop.csproj
+++ b/FlowerShop/FlowerShop/FlowerShop.csproj
@@ -15,6 +15,7 @@
+
@@ -26,4 +27,10 @@
+
+
+ Always
+
+
+
\ No newline at end of file
diff --git a/FlowerShop/FlowerShop/FormMain.Designer.cs b/FlowerShop/FlowerShop/FormMain.Designer.cs
index 1a4a0ea..1de98e2 100644
--- a/FlowerShop/FlowerShop/FormMain.Designer.cs
+++ b/FlowerShop/FlowerShop/FormMain.Designer.cs
@@ -39,6 +39,13 @@
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.bouquetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shopsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.listOfBouquetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.componentsByBouquetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.listOfOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.shopListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.bouquetsInShopsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.ordersByDateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonSupplyShop = new System.Windows.Forms.Button();
this.buttonSellBouquets = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
@@ -115,7 +122,8 @@
//
this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.guidesToolStripMenuItem});
+ this.guidesToolStripMenuItem,
+ this.reportsToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1);
@@ -154,6 +162,61 @@
this.shopsToolStripMenuItem.Text = "Магазины";
this.shopsToolStripMenuItem.Click += new System.EventHandler(this.shopsToolStripMenuItem_Click);
//
+ // reportsToolStripMenuItem
+ //
+ this.reportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.listOfBouquetsToolStripMenuItem,
+ this.componentsByBouquetsToolStripMenuItem,
+ this.listOfOrdersToolStripMenuItem,
+ this.shopListToolStripMenuItem,
+ this.bouquetsInShopsToolStripMenuItem,
+ this.ordersByDateToolStripMenuItem});
+ this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
+ this.reportsToolStripMenuItem.Size = new System.Drawing.Size(60, 22);
+ this.reportsToolStripMenuItem.Text = "Отчёты";
+ //
+ // listOfBouquetsToolStripMenuItem
+ //
+ this.listOfBouquetsToolStripMenuItem.Name = "listOfBouquetsToolStripMenuItem";
+ this.listOfBouquetsToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+ this.listOfBouquetsToolStripMenuItem.Text = "Список букетов";
+ this.listOfBouquetsToolStripMenuItem.Click += new System.EventHandler(this.listOfBouquetsToolStripMenuItem_Click);
+ //
+ // componentsByBouquetsToolStripMenuItem
+ //
+ this.componentsByBouquetsToolStripMenuItem.Name = "componentsByBouquetsToolStripMenuItem";
+ this.componentsByBouquetsToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+ this.componentsByBouquetsToolStripMenuItem.Text = "Компоненты по букетам";
+ this.componentsByBouquetsToolStripMenuItem.Click += new System.EventHandler(this.componentsByBouquetsToolStripMenuItem_Click);
+ //
+ // listOfOrdersToolStripMenuItem
+ //
+ this.listOfOrdersToolStripMenuItem.Name = "listOfOrdersToolStripMenuItem";
+ this.listOfOrdersToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+ this.listOfOrdersToolStripMenuItem.Text = "Список заказов";
+ this.listOfOrdersToolStripMenuItem.Click += new System.EventHandler(this.listOfOrdersToolStripMenuItem_Click);
+ //
+ // shopListToolStripMenuItem
+ //
+ this.shopListToolStripMenuItem.Name = "shopListToolStripMenuItem";
+ this.shopListToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+ this.shopListToolStripMenuItem.Text = "Список магазинов";
+ this.shopListToolStripMenuItem.Click += new System.EventHandler(this.shopListToolStripMenuItem_Click);
+ //
+ // bouquetsInShopsToolStripMenuItem
+ //
+ this.bouquetsInShopsToolStripMenuItem.Name = "bouquetsInShopsToolStripMenuItem";
+ this.bouquetsInShopsToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+ this.bouquetsInShopsToolStripMenuItem.Text = "Букеты в магазинах";
+ this.bouquetsInShopsToolStripMenuItem.Click += new System.EventHandler(this.bouquetsInShopsToolStripMenuItem_Click);
+ //
+ // ordersByDateToolStripMenuItem
+ //
+ this.ordersByDateToolStripMenuItem.Name = "ordersByDateToolStripMenuItem";
+ this.ordersByDateToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+ this.ordersByDateToolStripMenuItem.Text = "Список заказов по дате";
+ this.ordersByDateToolStripMenuItem.Click += new System.EventHandler(this.ordersByDateToolStripMenuItem_Click);
+ //
// buttonSupplyShop
//
this.buttonSupplyShop.Location = new System.Drawing.Point(891, 202);
@@ -213,8 +276,15 @@
private ToolStripMenuItem componentsToolStripMenuItem;
private ToolStripMenuItem bouquetsToolStripMenuItem;
private Button buttonReady;
+ private ToolStripMenuItem reportsToolStripMenuItem;
+ private ToolStripMenuItem listOfBouquetsToolStripMenuItem;
+ private ToolStripMenuItem componentsByBouquetsToolStripMenuItem;
+ private ToolStripMenuItem listOfOrdersToolStripMenuItem;
private ToolStripMenuItem shopsToolStripMenuItem;
private Button buttonSupplyShop;
private Button buttonSellBouquets;
+ private ToolStripMenuItem shopListToolStripMenuItem;
+ private ToolStripMenuItem bouquetsInShopsToolStripMenuItem;
+ private ToolStripMenuItem ordersByDateToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/FlowerShop/FlowerShop/FormMain.cs b/FlowerShop/FlowerShop/FormMain.cs
index c3f2db8..42b26ab 100644
--- a/FlowerShop/FlowerShop/FormMain.cs
+++ b/FlowerShop/FlowerShop/FormMain.cs
@@ -1,4 +1,5 @@
-using FlowerShopContracts.BindingModels;
+using FlowerShopBusinessLogic.BusinessLogics;
+using FlowerShopContracts.BindingModels;
using FlowerShopContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
@@ -8,12 +9,14 @@ namespace FlowerShop
{
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 MainForm_Load(object sender, EventArgs e)
@@ -154,6 +157,34 @@ namespace FlowerShop
LoadData();
}
+ private void listOfBouquetsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveBouquetsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ private void componentsByBouquetsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportBouquetComponents));
+ if (service is FormReportBouquetComponents form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void listOfOrdersToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportOrder));
+ if (service is FormReportOrder form)
+ {
+ form.ShowDialog();
+ }
+ }
+
private void shopsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
@@ -180,5 +211,36 @@ namespace FlowerShop
form.ShowDialog();
}
}
+
+ private void shopListToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveShopsToWordFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ private void bouquetsInShopsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportShopBouquets));
+ if (service is FormReportShopBouquets form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void ordersByDateToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportDateOrders));
+ if (service is FormReportDateOrders form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
diff --git a/FlowerShop/FlowerShop/FormReportBouquetComponents.Designer.cs b/FlowerShop/FlowerShop/FormReportBouquetComponents.Designer.cs
new file mode 100644
index 0000000..60aa2f5
--- /dev/null
+++ b/FlowerShop/FlowerShop/FormReportBouquetComponents.Designer.cs
@@ -0,0 +1,113 @@
+namespace FlowerShop
+{
+ partial class FormReportBouquetComponents
+ {
+ ///
+ /// 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.buttonSaveToExcel = new System.Windows.Forms.Button();
+ this.Bouquet = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Component = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.Bouquet,
+ this.Component,
+ this.Count});
+ this.dataGridView.Location = new System.Drawing.Point(10, 11);
+ this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersWidth = 51;
+ this.dataGridView.RowTemplate.Height = 29;
+ this.dataGridView.Size = new System.Drawing.Size(679, 283);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonSaveToExcel
+ //
+ this.buttonSaveToExcel.Location = new System.Drawing.Point(251, 298);
+ this.buttonSaveToExcel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.buttonSaveToExcel.Name = "buttonSaveToExcel";
+ this.buttonSaveToExcel.Size = new System.Drawing.Size(192, 29);
+ this.buttonSaveToExcel.TabIndex = 1;
+ this.buttonSaveToExcel.Text = "Сохранить в Excel";
+ this.buttonSaveToExcel.UseVisualStyleBackColor = true;
+ this.buttonSaveToExcel.Click += new System.EventHandler(this.buttonSaveToExcel_Click);
+ //
+ // Bouquet
+ //
+ this.Bouquet.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.Bouquet.HeaderText = "Букет";
+ this.Bouquet.MinimumWidth = 6;
+ this.Bouquet.Name = "Bouquet";
+ //
+ // Component
+ //
+ this.Component.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.Component.HeaderText = "Компонент";
+ this.Component.MinimumWidth = 6;
+ this.Component.Name = "Component";
+ //
+ // Count
+ //
+ this.Count.HeaderText = "Количество";
+ this.Count.MinimumWidth = 6;
+ this.Count.Name = "Count";
+ this.Count.Width = 125;
+ //
+ // FormReportBouquetComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(700, 338);
+ this.Controls.Add(this.buttonSaveToExcel);
+ this.Controls.Add(this.dataGridView);
+ this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Name = "FormReportBouquetComponents";
+ this.Text = "Компоненты по букетам";
+ this.Load += new System.EventHandler(this.FormReportBouquetComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonSaveToExcel;
+ private DataGridViewTextBoxColumn Bouquet;
+ private DataGridViewTextBoxColumn Component;
+ private DataGridViewTextBoxColumn Count;
+ }
+}
\ No newline at end of file
diff --git a/FlowerShop/FlowerShop/FormReportBouquetComponents.cs b/FlowerShop/FlowerShop/FormReportBouquetComponents.cs
new file mode 100644
index 0000000..778e4ad
--- /dev/null
+++ b/FlowerShop/FlowerShop/FormReportBouquetComponents.cs
@@ -0,0 +1,79 @@
+using FlowerShopContracts.BindingModels;
+using FlowerShopContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+
+namespace FlowerShop
+{
+ public partial class FormReportBouquetComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+
+ public FormReportBouquetComponents(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportBouquetComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetBouquetComponents();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.BouquetName, "", "" });
+
+ 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