From ec4a31077f707f8f3da3702ffd28cb80bfb72e34 Mon Sep 17 00:00:00 2001 From: dasha Date: Thu, 23 Mar 2023 19:48:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A7=D1=82=D0=BE-=D1=82=D0=BE=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=85=D0=BE=D0=B6=D0=B5=D0=B5=20=D0=BD=D0=B0=20=D1=81=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B0=D0=BD=D0=BD=D1=83=D1=8E=20=D0=BB=D0=B0=D0=B1?= =?UTF-8?q?=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/FormMain.Designer.cs | 44 +- SushiBar/SushiBar/FormMain.cs | 19 + .../FormReportOrdersGroupedByDate.Designer.cs | 92 ++++ .../SushiBar/FormReportOrdersGroupedByDate.cs | 73 ++++ .../FormReportOrdersGroupedByDate.resx | 60 +++ .../FormReportShopListSushi.Designer.cs | 115 +++++ SushiBar/SushiBar/FormReportShopListSushi.cs | 70 ++++ .../SushiBar/FormReportShopListSushi.resx | 60 +++ SushiBar/SushiBar/Program.cs | 4 +- .../SushiBar/ReportOrdersGroupedByDate.rdlc | 394 ++++++++++++++++++ SushiBar/SushiBar/SushiBarView.csproj | 6 + .../BusinessLogics/ReportLogic.cs | 97 ++++- .../OfficePackage/AbstractSaveToExcel.cs | 93 ++++- .../OfficePackage/AbstractSaveToPdf.cs | 34 +- .../OfficePackage/HelperModels/ExcelInfo.cs | 2 + .../OfficePackage/HelperModels/PdfInfo.cs | 2 + .../BusinessLogicsContracts/IReportLogic.cs | 25 ++ .../ReportOrdersGroupedByDateViewModel.cs | 11 + .../ViewModels/ReportShopSushiViewModel.cs | 11 + ... 20230323154341_ShopMigration.Designer.cs} | 6 +- ...ion.cs => 20230323154341_ShopMigration.cs} | 0 .../SushiBarDatabaseModelSnapshot.cs | 4 +- .../SushiBarDatabaseImplement/Models/Sushi.cs | 2 + 23 files changed, 1178 insertions(+), 46 deletions(-) create mode 100644 SushiBar/SushiBar/FormReportOrdersGroupedByDate.Designer.cs create mode 100644 SushiBar/SushiBar/FormReportOrdersGroupedByDate.cs create mode 100644 SushiBar/SushiBar/FormReportOrdersGroupedByDate.resx create mode 100644 SushiBar/SushiBar/FormReportShopListSushi.Designer.cs create mode 100644 SushiBar/SushiBar/FormReportShopListSushi.cs create mode 100644 SushiBar/SushiBar/FormReportShopListSushi.resx create mode 100644 SushiBar/SushiBar/ReportOrdersGroupedByDate.rdlc create mode 100644 SushiBar/SushiBarContracts/ViewModels/ReportOrdersGroupedByDateViewModel.cs create mode 100644 SushiBar/SushiBarContracts/ViewModels/ReportShopSushiViewModel.cs rename SushiBar/SushiBarDatabaseImplement/Migrations/{20230314085708_ShopMigration.Designer.cs => 20230323154341_ShopMigration.Designer.cs} (98%) rename SushiBar/SushiBarDatabaseImplement/Migrations/{20230314085708_ShopMigration.cs => 20230323154341_ShopMigration.cs} (100%) 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()); + } + } + _logger.LogInformation("Загрузка списка магазинов с суши"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка магазинов с суши"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonSaveToExcel_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveShopSushiToExcelFile(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/FormReportShopListSushi.resx b/SushiBar/SushiBar/FormReportShopListSushi.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/SushiBar/SushiBar/FormReportShopListSushi.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/Program.cs b/SushiBar/SushiBar/Program.cs index c4d0ee6..a2183ba 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -47,12 +47,12 @@ namespace SushiBarView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -61,7 +61,9 @@ namespace SushiBarView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/SushiBar/SushiBar/ReportOrdersGroupedByDate.rdlc b/SushiBar/SushiBar/ReportOrdersGroupedByDate.rdlc new file mode 100644 index 0000000..8db86c9 --- /dev/null +++ b/SushiBar/SushiBar/ReportOrdersGroupedByDate.rdlc @@ -0,0 +1,394 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 10791c83-cee8-4a38-bbd0-245fc17cefb3 + + + + + + SushiBarContractsViewModels + /* Local Query */ + + + + DateCreate + System.DateTime + + + Sum + System.Decimal + + + Count + System.Int32 + + + + SushiBarContracts.ViewModels + ReportOrdersViewModel + SushiBarContracts.ViewModels.ReportOrdersViewModel, SushiBarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + + + + + + true + true + + + + + =Parameters!ReportParameterPeriod.Value + + + + + + + ReportParameterPeriod + 1cm + 1cm + 21cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Заказы + + + + + + + 1cm + 21cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + 6.60986cm + + + 6.60986cm + + + 6.60986cm + + + + + 0.61323cm + + + + + true + true + + + + + Дата заказов + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Количество заказов + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Сумма + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.61323cm + + + + + true + true + + + + + =Fields!DateCreate.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + true + + + + + + true + true + + + + + =Fields!Count.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.48391cm + 0.55245cm + 1.22646cm + 19.82958cm + 2 + + + + + + 5.72875cm +