diff --git a/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj b/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj index f605b33..b3e2747 100644 --- a/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj +++ b/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable diff --git a/SushiBar/SushiBarContracts/SushiBarContracts.csproj b/SushiBar/SushiBarContracts/SushiBarContracts.csproj index ef52534..22d1530 100644 --- a/SushiBar/SushiBarContracts/SushiBarContracts.csproj +++ b/SushiBar/SushiBarContracts/SushiBarContracts.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable diff --git a/SushiBar/SushiBarDataModels/SushiBarDataModels.csproj b/SushiBar/SushiBarDataModels/SushiBarDataModels.csproj index 132c02c..30402ac 100644 --- a/SushiBar/SushiBarDataModels/SushiBarDataModels.csproj +++ b/SushiBar/SushiBarDataModels/SushiBarDataModels.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable diff --git a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj index 7adb075..ec6a8f0 100644 --- a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj +++ b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj @@ -1,15 +1,15 @@ - net6.0 + net8.0 enable enable - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SushiBar/SushiBarFileImplement/SushiBarFileImplement.csproj b/SushiBar/SushiBarFileImplement/SushiBarFileImplement.csproj index 00e2c96..b4adc48 100644 --- a/SushiBar/SushiBarFileImplement/SushiBarFileImplement.csproj +++ b/SushiBar/SushiBarFileImplement/SushiBarFileImplement.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable diff --git a/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj b/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj index 00e2c96..b4adc48 100644 --- a/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj +++ b/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable diff --git a/SushiBar/SushiBarView/FormMain.Designer.cs b/SushiBar/SushiBarView/FormMain.Designer.cs index 5dee4ec..daeff07 100644 --- a/SushiBar/SushiBarView/FormMain.Designer.cs +++ b/SushiBar/SushiBarView/FormMain.Designer.cs @@ -38,6 +38,10 @@ toolStripMenuItem = new ToolStripMenuItem(); componentsToolStripMenuItem = new ToolStripMenuItem(); sushiToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + списокКомпонентовToolStripMenuItem = new ToolStripMenuItem(); + компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); + списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); menuStrip.SuspendLayout(); SuspendLayout(); @@ -104,7 +108,7 @@ // // menuStrip // - menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem }); + menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчетыToolStripMenuItem }); menuStrip.Location = new Point(0, 0); menuStrip.Name = "menuStrip"; menuStrip.Size = new Size(1265, 24); @@ -132,6 +136,31 @@ sushiToolStripMenuItem.Text = "Суши"; sushiToolStripMenuItem.Click += sushiToolStripMenuItem_Click; // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem }); + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(60, 20); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // списокКомпонентовToolStripMenuItem + // + списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem"; + списокКомпонентовToolStripMenuItem.Size = new Size(218, 22); + списокКомпонентовToolStripMenuItem.Text = "Список компонентов"; + // + // компонентыПоИзделиямToolStripMenuItem + // + компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem"; + компонентыПоИзделиямToolStripMenuItem.Size = new Size(218, 22); + компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям"; + // + // списокЗаказовToolStripMenuItem + // + списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; + списокЗаказовToolStripMenuItem.Size = new Size(218, 22); + списокЗаказовToolStripMenuItem.Text = "Список заказов"; + // // FormMain // AutoScaleDimensions = new SizeF(7F, 15F); @@ -167,5 +196,9 @@ private ToolStripMenuItem toolStripMenuItem; private ToolStripMenuItem componentsToolStripMenuItem; private ToolStripMenuItem sushiToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + private ToolStripMenuItem списокКомпонентовToolStripMenuItem; + private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem; + private ToolStripMenuItem списокЗаказовToolStripMenuItem; } } \ No newline at end of file diff --git a/SushiBar/SushiBarView/FormReportSushiComponents.Designer.cs b/SushiBar/SushiBarView/FormReportSushiComponents.Designer.cs new file mode 100644 index 0000000..5e9cac9 --- /dev/null +++ b/SushiBar/SushiBarView/FormReportSushiComponents.Designer.cs @@ -0,0 +1,96 @@ +namespace SushiBarView +{ + partial class FormReportSushiComponents + { + /// + /// 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() + { + dataGridViewExcel = new DataGridView(); + ColumnComponent = new DataGridViewTextBoxColumn(); + ColumnSushi = new DataGridViewTextBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + ButtonSaveToExcel = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridViewExcel).BeginInit(); + SuspendLayout(); + // + // dataGridViewExcel + // + dataGridViewExcel.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewExcel.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewExcel.Columns.AddRange(new DataGridViewColumn[] { ColumnComponent, ColumnSushi, ColumnCount }); + dataGridViewExcel.Location = new Point(1, 72); + dataGridViewExcel.Name = "dataGridViewExcel"; + dataGridViewExcel.Size = new Size(799, 377); + dataGridViewExcel.TabIndex = 0; + // + // ColumnComponent + // + ColumnComponent.HeaderText = "Компонент"; + ColumnComponent.Name = "ColumnComponent"; + // + // ColumnSushi + // + ColumnSushi.HeaderText = "Суши"; + ColumnSushi.Name = "ColumnSushi"; + // + // ColumnCount + // + ColumnCount.HeaderText = "Количество"; + ColumnCount.Name = "ColumnCount"; + // + // ButtonSaveToExcel + // + ButtonSaveToExcel.Location = new Point(12, 12); + ButtonSaveToExcel.Name = "ButtonSaveToExcel"; + ButtonSaveToExcel.Size = new Size(168, 54); + ButtonSaveToExcel.TabIndex = 1; + ButtonSaveToExcel.Text = "Сохранить в Excel"; + ButtonSaveToExcel.UseVisualStyleBackColor = true; + ButtonSaveToExcel.Click += this.ButtonSaveToExcel_Click_1; + // + // FormReportSushiComponents + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(ButtonSaveToExcel); + Controls.Add(dataGridViewExcel); + Name = "FormReportSushiComponents"; + Text = "Компоненты по изделиям"; + Load += FormReportSushiComponents_Load; + ((System.ComponentModel.ISupportInitialize)dataGridViewExcel).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridViewExcel; + private DataGridViewTextBoxColumn ColumnComponent; + private DataGridViewTextBoxColumn ColumnSushi; + private DataGridViewTextBoxColumn ColumnCount; + private Button ButtonSaveToExcel; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarView/FormReportSushiComponents.cs b/SushiBar/SushiBarView/FormReportSushiComponents.cs new file mode 100644 index 0000000..353d6ff --- /dev/null +++ b/SushiBar/SushiBarView/FormReportSushiComponents.cs @@ -0,0 +1,81 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using System.Windows.Forms; + +namespace SushiBarView +{ + public partial class FormReportSushiComponents : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + public FormReportSushiComponents(ILogger + logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + private void FormReportSushiComponents_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetSushiComponent(); + if (dict != null) + { + dataGridViewExcel.Rows.Clear(); + foreach (var elem in dict) + { + dataGridViewExcel.Rows.Add(new object[] { elem.ComponentName, "", "" }); + foreach (var listElem in elem.Sushis) + { + dataGridViewExcel.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); + } + dataGridViewExcel.Rows.Add(new object[] { "Итого", "", elem.TotalCount }); + dataGridViewExcel.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.SaveSushiComponentToExcelFile(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/SushiBarView/FormReportSushiComponents.resx b/SushiBar/SushiBarView/FormReportSushiComponents.resx new file mode 100644 index 0000000..93d1f77 --- /dev/null +++ b/SushiBar/SushiBarView/FormReportSushiComponents.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/SushiBar/SushiBarView/Report1.rdlc b/SushiBar/SushiBarView/Report1.rdlc new file mode 100644 index 0000000..7c2476d --- /dev/null +++ b/SushiBar/SushiBarView/Report1.rdlc @@ -0,0 +1,10 @@ + + + 6.5in + + 2in + + true + + + diff --git a/SushiBar/SushiBarView/SushiBarView.csproj b/SushiBar/SushiBarView/SushiBarView.csproj index 6f09278..950035f 100644 --- a/SushiBar/SushiBarView/SushiBarView.csproj +++ b/SushiBar/SushiBarView/SushiBarView.csproj @@ -2,14 +2,18 @@ WinExe - net6.0-windows + net8.0-windows7.0 enable true enable - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + all runtime; build; native; contentfiles; analyzers; buildtransitive