diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.Designer.cs new file mode 100644 index 0000000..db2e6fc --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.Designer.cs @@ -0,0 +1,118 @@ +namespace BlacksmithWorkshop +{ + partial class FormReportManufactureWorkPieces + { + /// + /// 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(); + buttonSaveToExcel = new Button(); + ColumnManufacture = new DataGridViewTextBoxColumn(); + ColumnWorkPiece = new DataGridViewTextBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToOrderColumns = true; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.BackgroundColor = SystemColors.ControlLightLight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnManufacture, ColumnWorkPiece, ColumnCount }); + dataGridView.Dock = DockStyle.Bottom; + dataGridView.Location = new Point(0, 63); + dataGridView.Margin = new Padding(4, 5, 4, 5); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.Size = new Size(704, 680); + dataGridView.TabIndex = 0; + // + // buttonSaveToExcel + // + buttonSaveToExcel.Location = new Point(16, 18); + buttonSaveToExcel.Margin = new Padding(4, 5, 4, 5); + buttonSaveToExcel.Name = "buttonSaveToExcel"; + buttonSaveToExcel.Size = new Size(212, 35); + buttonSaveToExcel.TabIndex = 1; + buttonSaveToExcel.Text = "Сохранить в Excel"; + buttonSaveToExcel.UseVisualStyleBackColor = true; + buttonSaveToExcel.Click += ButtonSaveToExcel_Click; + // + // ColumnManufacture + // + ColumnManufacture.HeaderText = "Изделие"; + ColumnManufacture.MinimumWidth = 6; + ColumnManufacture.Name = "ColumnManufacture"; + ColumnManufacture.ReadOnly = true; + ColumnManufacture.Width = 200; + // + // ColumnWorkPiece + // + ColumnWorkPiece.HeaderText = "Заготовка"; + ColumnWorkPiece.MinimumWidth = 6; + ColumnWorkPiece.Name = "ColumnWorkPiece"; + ColumnWorkPiece.ReadOnly = true; + ColumnWorkPiece.Width = 200; + // + // ColumnCount + // + ColumnCount.HeaderText = "Количество"; + ColumnCount.MinimumWidth = 6; + ColumnCount.Name = "ColumnCount"; + ColumnCount.ReadOnly = true; + ColumnCount.Width = 125; + // + // FormReportManufactureWorkPieces + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(704, 743); + Controls.Add(buttonSaveToExcel); + Controls.Add(dataGridView); + Margin = new Padding(4, 5, 4, 5); + Name = "FormReportManufactureWorkPieces"; + Text = "Заготовки по изделиям"; + Load += FormReportManufactureWorkPieces_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Button buttonSaveToExcel; + private DataGridViewTextBoxColumn ColumnManufacture; + private DataGridViewTextBoxColumn ColumnWorkPiece; + private DataGridViewTextBoxColumn ColumnCount; + } +} \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs new file mode 100644 index 0000000..1762eca --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs @@ -0,0 +1,86 @@ +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.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 BlacksmithWorkshop +{ + public partial class FormReportManufactureWorkPieces : Form + { + private readonly ILogger _logger; + + private readonly IReportLogic _logic; + + public FormReportManufactureWorkPieces(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void FormReportManufactureWorkPieces_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetManufactureWorkPiece(); + + if (dict != null) + { + dataGridView.Rows.Clear(); + + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.ManufactureName, "", "" }); + + foreach (var listElem in elem.WorkPieces) + { + 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.SaveManufactureWorkPieceToExcelFile(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/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.resx b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.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/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.Designer.cs new file mode 100644 index 0000000..e4f2502 --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.Designer.cs @@ -0,0 +1,118 @@ +namespace BlacksmithWorkshop +{ + partial class FormReportShopManufactures + { + /// + /// 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(); + buttonSaveToExcel = new Button(); + ColumnShop = new DataGridViewTextBoxColumn(); + ColumnManufacture = new DataGridViewTextBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToOrderColumns = true; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.BackgroundColor = SystemColors.ControlLightLight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShop, ColumnManufacture, ColumnCount }); + dataGridView.Dock = DockStyle.Bottom; + dataGridView.Location = new Point(0, 63); + dataGridView.Margin = new Padding(4, 5, 4, 5); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.Size = new Size(704, 680); + dataGridView.TabIndex = 0; + // + // buttonSaveToExcel + // + buttonSaveToExcel.Location = new Point(16, 18); + buttonSaveToExcel.Margin = new Padding(4, 5, 4, 5); + buttonSaveToExcel.Name = "buttonSaveToExcel"; + buttonSaveToExcel.Size = new Size(212, 35); + buttonSaveToExcel.TabIndex = 1; + buttonSaveToExcel.Text = "Сохранить в Excel"; + buttonSaveToExcel.UseVisualStyleBackColor = true; + buttonSaveToExcel.Click += ButtonSaveToExcel_Click; + // + // ColumnShop + // + ColumnShop.HeaderText = "Магазин"; + ColumnShop.MinimumWidth = 6; + ColumnShop.Name = "ColumnShop"; + ColumnShop.ReadOnly = true; + ColumnShop.Width = 200; + // + // ColumnManufacture + // + ColumnManufacture.HeaderText = "Изделие"; + ColumnManufacture.MinimumWidth = 6; + ColumnManufacture.Name = "ColumnManufacture"; + ColumnManufacture.ReadOnly = true; + ColumnManufacture.Width = 200; + // + // ColumnCount + // + ColumnCount.HeaderText = "Количество"; + ColumnCount.MinimumWidth = 6; + ColumnCount.Name = "ColumnCount"; + ColumnCount.ReadOnly = true; + ColumnCount.Width = 125; + // + // FormReportShopManufactures + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(704, 743); + Controls.Add(buttonSaveToExcel); + Controls.Add(dataGridView); + Margin = new Padding(4, 5, 4, 5); + Name = "FormReportShopManufactures"; + Text = "Загруженность магазинов"; + Load += FormReportShopManufactures_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Button buttonSaveToExcel; + private DataGridViewTextBoxColumn ColumnShop; + private DataGridViewTextBoxColumn ColumnManufacture; + private DataGridViewTextBoxColumn ColumnCount; + } +} \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.cs new file mode 100644 index 0000000..e6162dc --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.cs @@ -0,0 +1,86 @@ +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.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 BlacksmithWorkshop +{ + public partial class FormReportShopManufactures : Form + { + private readonly ILogger _logger; + + private readonly IReportLogic _logic; + + public FormReportShopManufactures(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void FormReportShopManufactures_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetShopManufactures(); + + if (dict != null) + { + dataGridView.Rows.Clear(); + + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" }); + + foreach (var listElem in elem.Manufactures) + { + 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.SaveShopManufacturesToExcelFile(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/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.resx b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportShopManufactures.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/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs index e7b1270..8f7e25c 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs @@ -1,4 +1,6 @@ using BlacksmithWorkshopBusinessLogic.BusinessLogic; +using BlacksmithWorkshopBusinessLogic.OfficePackage.Implements; +using BlacksmithWorkshopBusinessLogic.OfficePackage; using BlacksmithWorkshopContracts.BusinessLogicsContracts; using BlacksmithWorkshopContracts.StoragesContracts; using BlacksmithWorkshopDatabaseImplement.Implements; @@ -46,8 +48,13 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -58,6 +65,10 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); - } + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupedOrders.Designer.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupedOrders.Designer.rdlc new file mode 100644 index 0000000..099c0ff --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupedOrders.Designer.rdlc @@ -0,0 +1,39 @@ +namespace BlacksmithWorkshop +{ + partial class ReportGroupedOrders + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "ReportGroupedOrders"; + } + + #endregion + } +} \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupedOrders.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupedOrders.rdlc new file mode 100644 index 0000000..bb2cb05 --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupedOrders.rdlc @@ -0,0 +1,20 @@ +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 BlacksmithWorkshop +{ + public partial class ReportGroupedOrders: Form + { + public ReportGroupedOrders() + { + InitializeComponent(); + } + } +} diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.Designer.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.Designer.rdlc new file mode 100644 index 0000000..af3ecb7 --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.Designer.rdlc @@ -0,0 +1,39 @@ +namespace BlacksmithWorkshop +{ + partial class ReportOrders + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "ReportOrders"; + } + + #endregion + } +} \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc new file mode 100644 index 0000000..db34c87 --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc @@ -0,0 +1,20 @@ +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 BlacksmithWorkshop +{ + public partial class ReportOrders: Form + { + public ReportOrders() + { + InitializeComponent(); + } + } +}