diff --git a/SushiBar/SushiBar/FormMain.Designer.cs b/SushiBar/SushiBar/FormMain.Designer.cs
index 8039c88..e578a2e 100644
--- a/SushiBar/SushiBar/FormMain.Designer.cs
+++ b/SushiBar/SushiBar/FormMain.Designer.cs
@@ -37,6 +37,9 @@
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.buttonUpdate = new System.Windows.Forms.Button();
this.buttonSetToFinish = new System.Windows.Forms.Button();
this.buttonSetToDone = new System.Windows.Forms.Button();
@@ -45,7 +48,6 @@
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonAddSushiInShop = new System.Windows.Forms.Button();
this.buttonSellSushi = new System.Windows.Forms.Button();
- this.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
@@ -98,7 +100,9 @@
this.списокИнгредиентовToolStripMenuItem,
this.ингредиентыПоСушиToolStripMenuItem,
this.списокЗаказовToolStripMenuItem,
- this.списокМагазиновToolStripMenuItem});
+ this.списокМагазиновToolStripMenuItem,
+ this.магазинССушиToolStripMenuItem,
+ this.списокЗаказовОбъединенныхПоДатамToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчетыToolStripMenuItem.Text = "Отчеты";
@@ -106,24 +110,45 @@
// списокИнгредиентовToolStripMenuItem
//
this.списокИнгредиентовToolStripMenuItem.Name = "списокИнгредиентовToolStripMenuItem";
- this.списокИнгредиентовToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
+ this.списокИнгредиентовToolStripMenuItem.Size = new System.Drawing.Size(310, 22);
this.списокИнгредиентовToolStripMenuItem.Text = "Список суши";
this.списокИнгредиентовToolStripMenuItem.Click += new System.EventHandler(this.SushiListToolStripMenuItem_Click);
//
// ингредиентыПоСушиToolStripMenuItem
//
this.ингредиентыПоСушиToolStripMenuItem.Name = "ингредиентыПоСушиToolStripMenuItem";
- this.ингредиентыПоСушиToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
+ this.ингредиентыПоСушиToolStripMenuItem.Size = new System.Drawing.Size(310, 22);
this.ингредиентыПоСушиToolStripMenuItem.Text = "Суши с ингредиентами";
this.ингредиентыПоСушиToolStripMenuItem.Click += new System.EventHandler(this.SushiIngredientToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
- this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
+ this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(310, 22);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
+ // списокМагазиновToolStripMenuItem
+ //
+ this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
+ this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(310, 22);
+ this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
+ this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.ShopsReportToolStripMenuItem_Click);
+ //
+ // магазинССушиToolStripMenuItem
+ //
+ this.магазинССушиToolStripMenuItem.Name = "магазинССушиToolStripMenuItem";
+ this.магазинССушиToolStripMenuItem.Size = new System.Drawing.Size(310, 22);
+ this.магазинССушиToolStripMenuItem.Text = "Магазин с суши";
+ this.магазинССушиToolStripMenuItem.Click += new System.EventHandler(this.ShopSushiToolStripMenuItem_Click);
+ //
+ // списокЗаказовОбъединенныхПоДатамToolStripMenuItem
+ //
+ this.списокЗаказовОбъединенныхПоДатамToolStripMenuItem.Name = "списокЗаказовОбъединенныхПоДатамToolStripMenuItem";
+ this.списокЗаказовОбъединенныхПоДатамToolStripMenuItem.Size = new System.Drawing.Size(310, 22);
+ this.списокЗаказовОбъединенныхПоДатамToolStripMenuItem.Text = "Список заказов, сгрупированных по датам";
+ this.списокЗаказовОбъединенныхПоДатамToolStripMenuItem.Click += new System.EventHandler(this.OrdersGroupedByDateToolStripMenuItem_Click);
+ //
// buttonUpdate
//
this.buttonUpdate.Location = new System.Drawing.Point(778, 212);
@@ -213,13 +238,6 @@
this.buttonSellSushi.UseVisualStyleBackColor = true;
this.buttonSellSushi.Click += new System.EventHandler(this.ButtonSellSushi_Click);
//
- // списокМагазиновToolStripMenuItem
- //
- this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
- this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
- this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
- this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.ShopsReportToolStripMenuItem_Click);
- //
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -266,5 +284,7 @@
private Button buttonAddSushiInShop;
private Button buttonSellSushi;
private ToolStripMenuItem списокМагазиновToolStripMenuItem;
+ private ToolStripMenuItem магазинССушиToolStripMenuItem;
+ private ToolStripMenuItem списокЗаказовОбъединенныхПоДатамToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/SushiBar/SushiBar/FormMain.cs b/SushiBar/SushiBar/FormMain.cs
index b1e1e0e..2d13da6 100644
--- a/SushiBar/SushiBar/FormMain.cs
+++ b/SushiBar/SushiBar/FormMain.cs
@@ -174,6 +174,15 @@ namespace SushiBarView
}
}
+ private void ShopSushiToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportShopListSushi));
+ if (service is FormReportShopListSushi form)
+ {
+ form.ShowDialog();
+ }
+ }
+
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
@@ -182,6 +191,16 @@ namespace SushiBarView
form.ShowDialog();
}
}
+
+ private void OrdersGroupedByDateToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportOrdersGroupedByDate));
+ if (service is FormReportOrdersGroupedByDate form)
+ {
+ form.ShowDialog();
+ }
+ }
+
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
diff --git a/SushiBar/SushiBar/FormReportOrdersGroupedByDate.Designer.cs b/SushiBar/SushiBar/FormReportOrdersGroupedByDate.Designer.cs
new file mode 100644
index 0000000..5272c1a
--- /dev/null
+++ b/SushiBar/SushiBar/FormReportOrdersGroupedByDate.Designer.cs
@@ -0,0 +1,92 @@
+namespace SushiBarView
+{
+ partial class FormReportOrdersGroupedByDate
+ {
+ ///
+ /// 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.panel = new System.Windows.Forms.Panel();
+ this.buttonToPdf = new System.Windows.Forms.Button();
+ this.buttonMake = new System.Windows.Forms.Button();
+ this.panel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panel
+ //
+ this.panel.Controls.Add(this.buttonToPdf);
+ this.panel.Controls.Add(this.buttonMake);
+ this.panel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel.Location = new System.Drawing.Point(0, 0);
+ this.panel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.panel.Name = "panel";
+ this.panel.Size = new System.Drawing.Size(1031, 40);
+ this.panel.TabIndex = 0;
+ //
+ // buttonToPdf
+ //
+ this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonToPdf.Location = new System.Drawing.Point(160, 8);
+ this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonToPdf.Name = "buttonToPdf";
+ this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
+ this.buttonToPdf.TabIndex = 5;
+ this.buttonToPdf.Text = "В Pdf";
+ this.buttonToPdf.UseVisualStyleBackColor = true;
+ this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
+ //
+ // buttonMake
+ //
+ this.buttonMake.Location = new System.Drawing.Point(13, 8);
+ this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonMake.Name = "buttonMake";
+ this.buttonMake.Size = new System.Drawing.Size(139, 27);
+ this.buttonMake.TabIndex = 4;
+ this.buttonMake.Text = "Сформировать";
+ this.buttonMake.UseVisualStyleBackColor = true;
+ this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
+ //
+ // FormReportOrdersGroupedByDate
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1031, 647);
+ this.Controls.Add(this.panel);
+ this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.Name = "FormReportOrdersGroupedByDate";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Заказы, сгрупированные по дате";
+ this.panel.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Panel panel;
+ private System.Windows.Forms.Button buttonToPdf;
+ private System.Windows.Forms.Button buttonMake;
+ }
+}
\ No newline at end of file
diff --git a/SushiBar/SushiBar/FormReportOrdersGroupedByDate.cs b/SushiBar/SushiBar/FormReportOrdersGroupedByDate.cs
new file mode 100644
index 0000000..4018385
--- /dev/null
+++ b/SushiBar/SushiBar/FormReportOrdersGroupedByDate.cs
@@ -0,0 +1,73 @@
+using Microsoft.Extensions.Logging;
+using Microsoft.Reporting.WinForms;
+using SushiBarContracts.BindingModels;
+using SushiBarContracts.BusinessLogicsContracts;
+
+namespace SushiBarView
+{
+ public partial class FormReportOrdersGroupedByDate : Form
+ {
+ private readonly ReportViewer reportViewer;
+
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportOrdersGroupedByDate(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrdersGroupedByDate.rdlc", FileMode.Open));
+ Controls.Clear();
+ Controls.Add(reportViewer);
+ Controls.Add(panel);
+ }
+
+ private void ButtonMake_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var dataSource = _logic.GetOrdersGroupedByDate();
+
+ var source = new ReportDataSource("DataSetOrders", dataSource);
+ reportViewer.LocalReport.DataSources.Clear();
+ reportViewer.LocalReport.DataSources.Add(source);
+
+ reportViewer.RefreshReport();
+ _logger.LogInformation("Загрузка списка заказов, сгруппированных по дате");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов, сгруппированных по дате");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonToPdf_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveOrdersGroupedByDateToPdfFile(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);
+ }
+ }
+ }
+ }
+}
diff --git a/SushiBar/SushiBar/FormReportOrdersGroupedByDate.resx b/SushiBar/SushiBar/FormReportOrdersGroupedByDate.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/SushiBar/SushiBar/FormReportOrdersGroupedByDate.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/SushiBar/SushiBar/FormReportShopListSushi.Designer.cs b/SushiBar/SushiBar/FormReportShopListSushi.Designer.cs
new file mode 100644
index 0000000..cb9adc1
--- /dev/null
+++ b/SushiBar/SushiBar/FormReportShopListSushi.Designer.cs
@@ -0,0 +1,115 @@
+namespace SushiBarView
+{
+ partial class FormReportShopListSushi
+ {
+ ///
+ /// 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.ColumnShop = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnSushi = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.button1 = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.AllowUserToAddRows = false;
+ this.dataGridView.AllowUserToDeleteRows = false;
+ this.dataGridView.AllowUserToOrderColumns = true;
+ this.dataGridView.AllowUserToResizeColumns = false;
+ this.dataGridView.AllowUserToResizeRows = false;
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ColumnShop,
+ this.ColumnSushi,
+ this.ColumnCount});
+ this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.dataGridView.Location = new System.Drawing.Point(0, 47);
+ this.dataGridView.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.dataGridView.MultiSelect = false;
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.ReadOnly = true;
+ this.dataGridView.RowHeadersVisible = false;
+ this.dataGridView.Size = new System.Drawing.Size(616, 510);
+ this.dataGridView.TabIndex = 2;
+ //
+ // ColumnShop
+ //
+ this.ColumnShop.HeaderText = "Магазин";
+ this.ColumnShop.Name = "ColumnShop";
+ this.ColumnShop.ReadOnly = true;
+ this.ColumnShop.Width = 200;
+ //
+ // ColumnSushi
+ //
+ this.ColumnSushi.HeaderText = "Суши";
+ this.ColumnSushi.Name = "ColumnSushi";
+ this.ColumnSushi.ReadOnly = true;
+ this.ColumnSushi.Width = 200;
+ //
+ // ColumnCount
+ //
+ this.ColumnCount.HeaderText = "Количество";
+ this.ColumnCount.Name = "ColumnCount";
+ this.ColumnCount.ReadOnly = true;
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(13, 14);
+ this.button1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(186, 27);
+ this.button1.TabIndex = 4;
+ this.button1.Text = "Сохранить в Excel";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
+ //
+ // FormReportShopListSushi
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(616, 557);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormReportShopListSushi";
+ this.Text = "Суши по магазинам";
+ this.Load += new System.EventHandler(this.FormReportShopListSushi_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn ColumnShop;
+ private DataGridViewTextBoxColumn ColumnSushi;
+ private DataGridViewTextBoxColumn ColumnCount;
+ private Button button1;
+ }
+}
\ No newline at end of file
diff --git a/SushiBar/SushiBar/FormReportShopListSushi.cs b/SushiBar/SushiBar/FormReportShopListSushi.cs
new file mode 100644
index 0000000..4f86e56
--- /dev/null
+++ b/SushiBar/SushiBar/FormReportShopListSushi.cs
@@ -0,0 +1,70 @@
+using Microsoft.Extensions.Logging;
+using SushiBarContracts.BindingModels;
+using SushiBarContracts.BusinessLogicsContracts;
+
+namespace SushiBarView
+{
+ public partial class FormReportShopListSushi : Form
+ {
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportShopListSushi(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportShopListSushi_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetShopSushi();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
+ foreach (var listElem in elem.ListSushi)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
+ dataGridView.Rows.Add(Array.Empty