From ec5b5ee7bc186e7bbf87a5a056436eb081ed5bc0 Mon Sep 17 00:00:00 2001 From: dyakonovr Date: Sat, 18 May 2024 21:15:41 +0400 Subject: [PATCH] All done --- .../SoftwareInstallation/FormMain.Designer.cs | 474 +++++++++--------- .../SoftwareInstallation/FormMain.cs | 428 ++++++++-------- .../FormReportOrdersGroupByDate.Designer.cs | 86 ++++ .../FormReportOrdersGroupByDate.cs | 81 +++ .../FormReportOrdersGroupByDate.resx | 120 +++++ .../FormReportShopPackages.Designer.cs | 100 ++++ .../FormReportShopPackages.cs | 77 +++ .../FormReportShopPackages.resx | 120 +++++ .../SoftwareInstallation/Program.cs | 6 +- .../ReportOrdersGroupByDate.rdlc | 394 +++++++++++++++ .../BusinessLogics/ReportLogic.cs | 73 ++- .../OfficePackage/AbstractSaveToExcel.cs | 82 ++- .../OfficePackage/AbstractSaveToPdf.cs | 39 +- .../OfficePackage/AbstractSaveToWord.cs | 53 +- .../OfficePackage/HelperModels/ExcelInfo.cs | 3 +- .../OfficePackage/HelperModels/PdfInfo.cs | 3 +- .../OfficePackage/HelperModels/WordInfo.cs | 3 +- .../OfficePackage/HelperModels/WordRow.cs | 13 + .../OfficePackage/Implements/SaveToWord.cs | 55 +- .../BusinessLogicContracts/IReportLogic.cs | 8 +- .../ReportOrdersGroupByDateViewModel.cs | 15 + .../ViewModels/ReportShopPackageViewModel.cs | 15 + .../Models/Package.cs | 5 +- .../Implements/OrderStorage.cs | 27 +- 24 files changed, 1816 insertions(+), 464 deletions(-) create mode 100644 SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.Designer.cs create mode 100644 SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.cs create mode 100644 SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.resx create mode 100644 SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.Designer.cs create mode 100644 SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.cs create mode 100644 SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.resx create mode 100644 SoftwareInstallation/SoftwareInstallation/ReportOrdersGroupByDate.rdlc create mode 100644 SoftwareInstallation/SoftwareInstallationBusinessLogic/OfficePackage/HelperModels/WordRow.cs create mode 100644 SoftwareInstallation/SoftwareInstallationContracts/ViewModels/ReportOrdersGroupByDateViewModel.cs create mode 100644 SoftwareInstallation/SoftwareInstallationContracts/ViewModels/ReportShopPackageViewModel.cs diff --git a/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs index 77a2705..83872c8 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs @@ -20,232 +20,255 @@ base.Dispose(disposing); } - #region Windows Form Designer generated code + #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() - { - menuStrip1 = new MenuStrip(); - справочникиToolStripMenuItem = new ToolStripMenuItem(); - компонентыToolStripMenuItem = new ToolStripMenuItem(); - изделияToolStripMenuItem = new ToolStripMenuItem(); - отчётыToolStripMenuItem = new ToolStripMenuItem(); - списокИзделийToolStripMenuItem = new ToolStripMenuItem(); - компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); - списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); - магазиныToolStripMenuItem = new ToolStripMenuItem(); - поставкиToolStripMenuItem = new ToolStripMenuItem(); - продажиToolStripMenuItem = new ToolStripMenuItem(); - dataGridView = new DataGridView(); - buttonCreateOrder = new Button(); - buttonTakeOrderInWork = new Button(); - buttonOrderReady = new Button(); - buttonIssuedOrder = new Button(); - buttonRefresh = new Button(); - shopReplenishment = new Button(); - menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - SuspendLayout(); - // - // menuStrip1 - // - menuStrip1.ImageScalingSize = new Size(20, 20); - menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчётыToolStripMenuItem }); - menuStrip1.Location = new Point(0, 0); - menuStrip1.Name = "menuStrip1"; - menuStrip1.Padding = new Padding(7, 3, 0, 3); - menuStrip1.Size = new Size(1077, 30); - menuStrip1.TabIndex = 0; - menuStrip1.Text = "menuStrip1"; - // - // справочникиToolStripMenuItem - // - справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem, продажиToolStripMenuItem }); - справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; - справочникиToolStripMenuItem.Size = new Size(117, 24); - справочникиToolStripMenuItem.Text = "Справочники"; - // - // компонентыToolStripMenuItem - // - компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; - компонентыToolStripMenuItem.Size = new Size(182, 26); - компонентыToolStripMenuItem.Text = "Компоненты"; - компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click; - // - // изделияToolStripMenuItem - // - изделияToolStripMenuItem.Name = "изделияToolStripMenuItem"; - изделияToolStripMenuItem.Size = new Size(182, 26); - изделияToolStripMenuItem.Text = "Изделия"; - изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click; - // - // отчётыToolStripMenuItem - // - отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem }); - отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; - отчётыToolStripMenuItem.Size = new Size(73, 24); - отчётыToolStripMenuItem.Text = "Отчёты"; - // - // списокИзделийToolStripMenuItem - // - списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem"; - списокИзделийToolStripMenuItem.Size = new Size(276, 26); - списокИзделийToolStripMenuItem.Text = "Список изделий"; - списокИзделийToolStripMenuItem.Click += списокИзделийToolStripMenuItem_Click; - // - // компонентыПоИзделиямToolStripMenuItem - // - компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem"; - компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26); - компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям"; - компонентыПоИзделиямToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click; - // - // списокЗаказовToolStripMenuItem - // - списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; - списокЗаказовToolStripMenuItem.Size = new Size(276, 26); - списокЗаказовToolStripMenuItem.Text = "Список заказов"; - списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; - // - // магазиныToolStripMenuItem - // - магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; - магазиныToolStripMenuItem.Size = new Size(182, 26); - магазиныToolStripMenuItem.Text = "Магазины"; - магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click; - // - // поставкиToolStripMenuItem - // - поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; - поставкиToolStripMenuItem.Size = new Size(180, 22); - поставкиToolStripMenuItem.Text = "Поставки"; - поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; - // продажиToolStripMenuItem - // - продажиToolStripMenuItem.Name = "продажиToolStripMenuItem"; - продажиToolStripMenuItem.Size = new Size(180, 22); - продажиToolStripMenuItem.Text = "Продажи"; - продажиToolStripMenuItem.Click += продажиToolStripMenuItem_Click; - // - // - // - // dataGridView - // - dataGridView.AllowUserToAddRows = false; - dataGridView.AllowUserToDeleteRows = false; - dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(0, 36); - dataGridView.Margin = new Padding(3, 4, 3, 4); - dataGridView.Name = "dataGridView"; - dataGridView.ReadOnly = true; - dataGridView.RowHeadersVisible = false; - dataGridView.RowHeadersWidth = 51; - dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(879, 432); - dataGridView.TabIndex = 1; - // - // buttonCreateOrder - // - buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonCreateOrder.Location = new Point(885, 77); - buttonCreateOrder.Margin = new Padding(3, 4, 3, 4); - buttonCreateOrder.Name = "buttonCreateOrder"; - buttonCreateOrder.Size = new Size(178, 41); - buttonCreateOrder.TabIndex = 2; - buttonCreateOrder.Text = "Создать заказ"; - buttonCreateOrder.UseVisualStyleBackColor = true; - buttonCreateOrder.Click += ButtonCreateOrder_Click; - // - // buttonTakeOrderInWork - // - buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonTakeOrderInWork.Location = new Point(885, 127); - buttonTakeOrderInWork.Margin = new Padding(3, 4, 3, 4); - buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; - buttonTakeOrderInWork.Size = new Size(178, 39); - buttonTakeOrderInWork.TabIndex = 3; - buttonTakeOrderInWork.Text = "Отдать на выполнение"; - buttonTakeOrderInWork.UseVisualStyleBackColor = true; - buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click; - // - // buttonOrderReady - // - buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonOrderReady.Location = new Point(885, 173); - buttonOrderReady.Margin = new Padding(3, 4, 3, 4); - buttonOrderReady.Name = "buttonOrderReady"; - buttonOrderReady.Size = new Size(178, 36); - buttonOrderReady.TabIndex = 4; - buttonOrderReady.Text = "Заказ готов"; - buttonOrderReady.UseVisualStyleBackColor = true; - buttonOrderReady.Click += ButtonOrderReady_Click; - // - // buttonIssuedOrder - // - buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonIssuedOrder.Location = new Point(885, 217); - buttonIssuedOrder.Margin = new Padding(3, 4, 3, 4); - buttonIssuedOrder.Name = "buttonIssuedOrder"; - buttonIssuedOrder.Size = new Size(178, 39); - buttonIssuedOrder.TabIndex = 5; - buttonIssuedOrder.Text = "Заказ выдан"; - buttonIssuedOrder.UseVisualStyleBackColor = true; - buttonIssuedOrder.Click += ButtonIssuedOrder_Click; - // - // buttonRefresh - // - buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonRefresh.Location = new Point(885, 264); - buttonRefresh.Margin = new Padding(3, 4, 3, 4); - buttonRefresh.Name = "buttonRefresh"; - buttonRefresh.Size = new Size(178, 39); - buttonRefresh.TabIndex = 6; - buttonRefresh.Text = "Обновить список"; - buttonRefresh.UseVisualStyleBackColor = true; - buttonRefresh.Click += ButtonRef_Click; - // - // shopReplenishment - // - shopReplenishment.Location = new Point(885, 312); - shopReplenishment.Name = "shopReplenishment"; - shopReplenishment.Size = new Size(178, 41); - shopReplenishment.TabIndex = 7; - shopReplenishment.Text = "Пополнение магазина"; - shopReplenishment.UseVisualStyleBackColor = true; - shopReplenishment.Click += ShopReplenishment_Click; - // - // FormMain - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1077, 467); - Controls.Add(buttonRefresh); - Controls.Add(buttonIssuedOrder); - Controls.Add(buttonOrderReady); - Controls.Add(buttonTakeOrderInWork); - Controls.Add(buttonCreateOrder); - Controls.Add(dataGridView); - Controls.Add(menuStrip1); - Controls.Add(shopReplenishment); - MainMenuStrip = menuStrip1; - Margin = new Padding(3, 4, 3, 4); - Name = "FormMain"; - Text = "Установка ПО"; - Load += FormMain_Load; - menuStrip1.ResumeLayout(false); - menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); - ResumeLayout(false); - PerformLayout(); - } + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + menuStrip1 = new MenuStrip(); + справочникиToolStripMenuItem = new ToolStripMenuItem(); + компонентыToolStripMenuItem = new ToolStripMenuItem(); + изделияToolStripMenuItem = new ToolStripMenuItem(); + магазиныToolStripMenuItem = new ToolStripMenuItem(); + поставкиToolStripMenuItem = new ToolStripMenuItem(); + продажиToolStripMenuItem = new ToolStripMenuItem(); + отчётыToolStripMenuItem = new ToolStripMenuItem(); + списокИзделийToolStripMenuItem = new ToolStripMenuItem(); + компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); + списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); + dataGridView = new DataGridView(); + buttonCreateOrder = new Button(); + buttonTakeOrderInWork = new Button(); + buttonOrderReady = new Button(); + buttonIssuedOrder = new Button(); + buttonRefresh = new Button(); + shopReplenishment = new Button(); + списокМагазиновToolStripMenuItem = new ToolStripMenuItem(); + загруженностьToolStripMenuItem = new ToolStripMenuItem(); + заказыПоДатамToolStripMenuItem = new ToolStripMenuItem(); + menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // menuStrip1 + // + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчётыToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Padding = new Padding(7, 3, 0, 3); + menuStrip1.Size = new Size(1077, 30); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem, продажиToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(117, 24); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // компонентыToolStripMenuItem + // + компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; + компонентыToolStripMenuItem.Size = new Size(182, 26); + компонентыToolStripMenuItem.Text = "Компоненты"; + компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click; + // + // изделияToolStripMenuItem + // + изделияToolStripMenuItem.Name = "изделияToolStripMenuItem"; + изделияToolStripMenuItem.Size = new Size(182, 26); + изделияToolStripMenuItem.Text = "Изделия"; + изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click; + // + // магазиныToolStripMenuItem + // + магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; + магазиныToolStripMenuItem.Size = new Size(182, 26); + магазиныToolStripMenuItem.Text = "Магазины"; + магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click; + // + // поставкиToolStripMenuItem + // + поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; + поставкиToolStripMenuItem.Size = new Size(182, 26); + поставкиToolStripMenuItem.Text = "Поставки"; + поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; + // + // продажиToolStripMenuItem + // + продажиToolStripMenuItem.Name = "продажиToolStripMenuItem"; + продажиToolStripMenuItem.Size = new Size(182, 26); + продажиToolStripMenuItem.Text = "Продажи"; + продажиToolStripMenuItem.Click += продажиToolStripMenuItem_Click; + // + // отчётыToolStripMenuItem + // + отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem, списокМагазиновToolStripMenuItem, загруженностьToolStripMenuItem, заказыПоДатамToolStripMenuItem }); + отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; + отчётыToolStripMenuItem.Size = new Size(73, 24); + отчётыToolStripMenuItem.Text = "Отчёты"; + // + // списокИзделийToolStripMenuItem + // + списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem"; + списокИзделийToolStripMenuItem.Size = new Size(276, 26); + списокИзделийToolStripMenuItem.Text = "Список изделий"; + списокИзделийToolStripMenuItem.Click += списокИзделийToolStripMenuItem_Click; + // + // компонентыПоИзделиямToolStripMenuItem + // + компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem"; + компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26); + компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям"; + компонентыПоИзделиямToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click; + // + // списокЗаказовToolStripMenuItem + // + списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; + списокЗаказовToolStripMenuItem.Size = new Size(276, 26); + списокЗаказовToolStripMenuItem.Text = "Список заказов"; + списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 36); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(879, 432); + dataGridView.TabIndex = 1; + // + // buttonCreateOrder + // + buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonCreateOrder.Location = new Point(885, 77); + buttonCreateOrder.Margin = new Padding(3, 4, 3, 4); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(178, 41); + buttonCreateOrder.TabIndex = 2; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += ButtonCreateOrder_Click; + // + // buttonTakeOrderInWork + // + buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonTakeOrderInWork.Location = new Point(885, 127); + buttonTakeOrderInWork.Margin = new Padding(3, 4, 3, 4); + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; + buttonTakeOrderInWork.Size = new Size(178, 39); + buttonTakeOrderInWork.TabIndex = 3; + buttonTakeOrderInWork.Text = "Отдать на выполнение"; + buttonTakeOrderInWork.UseVisualStyleBackColor = true; + buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click; + // + // buttonOrderReady + // + buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonOrderReady.Location = new Point(885, 173); + buttonOrderReady.Margin = new Padding(3, 4, 3, 4); + buttonOrderReady.Name = "buttonOrderReady"; + buttonOrderReady.Size = new Size(178, 36); + buttonOrderReady.TabIndex = 4; + buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.UseVisualStyleBackColor = true; + buttonOrderReady.Click += ButtonOrderReady_Click; + // + // buttonIssuedOrder + // + buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonIssuedOrder.Location = new Point(885, 217); + buttonIssuedOrder.Margin = new Padding(3, 4, 3, 4); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(178, 39); + buttonIssuedOrder.TabIndex = 5; + buttonIssuedOrder.Text = "Заказ выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += ButtonIssuedOrder_Click; + // + // buttonRefresh + // + buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonRefresh.Location = new Point(885, 264); + buttonRefresh.Margin = new Padding(3, 4, 3, 4); + buttonRefresh.Name = "buttonRefresh"; + buttonRefresh.Size = new Size(178, 39); + buttonRefresh.TabIndex = 6; + buttonRefresh.Text = "Обновить список"; + buttonRefresh.UseVisualStyleBackColor = true; + buttonRefresh.Click += ButtonRef_Click; + // + // shopReplenishment + // + shopReplenishment.Location = new Point(885, 312); + shopReplenishment.Name = "shopReplenishment"; + shopReplenishment.Size = new Size(178, 41); + shopReplenishment.TabIndex = 7; + shopReplenishment.Text = "Пополнение магазина"; + shopReplenishment.UseVisualStyleBackColor = true; + shopReplenishment.Click += ShopReplenishment_Click; + // + // списокМагазиновToolStripMenuItem + // + списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem"; + списокМагазиновToolStripMenuItem.Size = new Size(276, 26); + списокМагазиновToolStripMenuItem.Text = "Список магазинов"; + списокМагазиновToolStripMenuItem.Click += списокМагазиновToolStripMenuItem_Click; + // + // загруженностьToolStripMenuItem + // + загруженностьToolStripMenuItem.Name = "загруженностьToolStripMenuItem"; + загруженностьToolStripMenuItem.Size = new Size(276, 26); + загруженностьToolStripMenuItem.Text = "Загруженность"; + загруженностьToolStripMenuItem.Click += изделияПоМагазинамToolStripMenuItem_Click; + // + // заказыПоДатамToolStripMenuItem + // + заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem"; + заказыПоДатамToolStripMenuItem.Size = new Size(276, 26); + заказыПоДатамToolStripMenuItem.Text = "Заказы по датам"; + заказыПоДатамToolStripMenuItem.Click += списокЗаказовгруппировкаПоДатеToolStripMenuItem_Click; + // + // FormMain + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1077, 467); + Controls.Add(buttonRefresh); + Controls.Add(buttonIssuedOrder); + Controls.Add(buttonOrderReady); + Controls.Add(buttonTakeOrderInWork); + Controls.Add(buttonCreateOrder); + Controls.Add(dataGridView); + Controls.Add(menuStrip1); + Controls.Add(shopReplenishment); + MainMenuStrip = menuStrip1; + Margin = new Padding(3, 4, 3, 4); + Name = "FormMain"; + Text = "Установка ПО"; + Load += FormMain_Load; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } - #endregion + #endregion - private MenuStrip menuStrip1; + private MenuStrip menuStrip1; private ToolStripMenuItem справочникиToolStripMenuItem; private ToolStripMenuItem компонентыToolStripMenuItem; private ToolStripMenuItem изделияToolStripMenuItem; @@ -263,5 +286,8 @@ private ToolStripMenuItem поставкиToolStripMenuItem; private ToolStripMenuItem продажиToolStripMenuItem; private Button shopReplenishment; - } + private ToolStripMenuItem списокМагазиновToolStripMenuItem; + private ToolStripMenuItem загруженностьToolStripMenuItem; + private ToolStripMenuItem заказыПоДатамToolStripMenuItem; + } } \ No newline at end of file diff --git a/SoftwareInstallation/SoftwareInstallation/FormMain.cs b/SoftwareInstallation/SoftwareInstallation/FormMain.cs index 2d63238..15aef57 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormMain.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormMain.cs @@ -15,217 +15,245 @@ using System.Windows.Forms; namespace SoftwareInstallationView { - public partial class FormMain : Form - { - private readonly ILogger _logger; - private readonly IOrderLogic _orderLogic; - private readonly IReportLogic _reportLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) - { - InitializeComponent(); - _logger = logger; - _orderLogic = orderLogic; - _reportLogic = reportLogic; - LoadData(); - } - private void FormMain_Load(object sender, EventArgs e) - { - LoadData(); - } - private void LoadData() - { - _logger.LogInformation("Загрузка заказов"); + public partial class FormMain : Form + { + private readonly ILogger _logger; + private readonly IOrderLogic _orderLogic; + private readonly IReportLogic _reportLogic; + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) + { + InitializeComponent(); + _logger = logger; + _orderLogic = orderLogic; + _reportLogic = reportLogic; + LoadData(); + } + private void FormMain_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() + { + _logger.LogInformation("Загрузка заказов"); - try - { - var list = _orderLogic.ReadList(null); + try + { + var list = _orderLogic.ReadList(null); - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["PackageId"].Visible = false; - } + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["PackageId"].Visible = false; + } - _logger.LogInformation("Загрузка заказов"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки заказов"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - private void ShopReplenishment_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormShopReplenishment)); + _logger.LogInformation("Загрузка заказов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки заказов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ShopReplenishment_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormShopReplenishment)); - if (service is FormShopReplenishment form) - { - form.ShowDialog(); - } - } - private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormShops)); + if (service is FormShopReplenishment form) + { + form.ShowDialog(); + } + } + private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormShops)); - if (service is FormShops form) - { - form.ShowDialog(); - } - } - private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs - e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); - if (service is FormComponents form) - { - form.ShowDialog(); - } - } - private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormPackages)); + if (service is FormShops form) + { + form.ShowDialog(); + } + } + private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs + e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); + if (service is FormComponents form) + { + form.ShowDialog(); + } + } + private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormPackages)); - if (service is FormPackages form) - { - form.ShowDialog(); - } - } + if (service is FormPackages form) + { + form.ShowDialog(); + } + } - private void поставкиToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormShopReplenishment)); - if (service is FormShopReplenishment form) - { - form.ShowDialog(); - } - } + private void поставкиToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormShopReplenishment)); + if (service is FormShopReplenishment form) + { + form.ShowDialog(); + } + } - private void продажиToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormSellPackage)); - if (service is FormSellPackage form) - { - form.ShowDialog(); - } - } + private void продажиToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormSellPackage)); + if (service is FormSellPackage form) + { + form.ShowDialog(); + } + } - private void списокИзделийToolStripMenuItem_Click(object sender, EventArgs e) - { - using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; - if (dialog.ShowDialog() == DialogResult.OK) - { - _reportLogic.SavePackagesToWordFile(new ReportBindingModel - { - FileName = dialog.FileName - }); - MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); - } + private void списокИзделийToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SavePackagesToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } - } + } - private void компонентыПоИзделиямToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormReportPackageComponents)); - if (service is FormReportPackageComponents form) - { - form.ShowDialog(); - } + private void компонентыПоИзделиямToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportPackageComponents)); + if (service is FormReportPackageComponents form) + { + form.ShowDialog(); + } - } + } - private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); - if (service is FormReportOrders form) - { - form.ShowDialog(); - } - } - private void ButtonCreateOrder_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); - if (service is FormCreateOrder form) - { - form.ShowDialog(); - LoadData(); - } - } - private void ButtonTakeOrderInWork_Click(object sender, EventArgs e) - { - if (dataGridView.SelectedRows.Count == 1) - { - int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); - try - { - var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id }); - if (!operationResult) - { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); - } - LoadData(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка передачи заказа в работу"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); - } - } - } - private void ButtonOrderReady_Click(object sender, EventArgs e) - { - if (dataGridView.SelectedRows.Count == 1) - { - int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", - id); - try - { - var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id }); - if (!operationResult) - { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); - } - LoadData(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка отметки о готовности заказа"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); - } - } - } - private void ButtonIssuedOrder_Click(object sender, EventArgs e) - { - if (dataGridView.SelectedRows.Count == 1) - { - int id = - Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", - id); - try - { - var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id }); - if (!operationResult) - { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); - } - _logger.LogInformation("Заказ №{id} выдан", id); - LoadData(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); - } - } - } - private void ButtonRef_Click(object sender, EventArgs e) - { - LoadData(); - } - } + private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } + } + + private void списокМагазиновToolStripMenuItem_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 изделияПоМагазинамToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportShopPackages)); + if (service is FormReportShopPackages form) + { + form.ShowDialog(); + } + } + + private void списокЗаказовгруппировкаПоДатеToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrdersGroupByDate)); + if (service is FormReportOrdersGroupByDate form) + { + form.ShowDialog(); + } + } + private void ButtonCreateOrder_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); + if (service is FormCreateOrder form) + { + form.ShowDialog(); + LoadData(); + } + } + private void ButtonTakeOrderInWork_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); + try + { + var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка передачи заказа в работу"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + private void ButtonOrderReady_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", + id); + try + { + var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о готовности заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + private void ButtonIssuedOrder_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = + Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", + id); + try + { + var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + _logger.LogInformation("Заказ №{id} выдан", id); + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + } } diff --git a/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.Designer.cs new file mode 100644 index 0000000..88cf3f7 --- /dev/null +++ b/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.Designer.cs @@ -0,0 +1,86 @@ +namespace SoftwareInstallationView +{ + partial class FormReportOrdersGroupByDate + { + /// + /// 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.ToPdfButton = new System.Windows.Forms.Button(); + this.MakeButton = new System.Windows.Forms.Button(); + this.Panel.SuspendLayout(); + this.SuspendLayout(); + // + // Panel + // + this.Panel.Controls.Add(this.ToPdfButton); + this.Panel.Controls.Add(this.MakeButton); + this.Panel.Dock = System.Windows.Forms.DockStyle.Top; + this.Panel.Location = new System.Drawing.Point(0, 0); + this.Panel.Name = "Panel"; + this.Panel.Size = new System.Drawing.Size(800, 38); + this.Panel.TabIndex = 0; + // + // ToPdfButton + // + this.ToPdfButton.Location = new System.Drawing.Point(142, 3); + this.ToPdfButton.Name = "ToPdfButton"; + this.ToPdfButton.Size = new System.Drawing.Size(113, 32); + this.ToPdfButton.TabIndex = 1; + this.ToPdfButton.Text = "В Pdf"; + this.ToPdfButton.UseVisualStyleBackColor = true; + this.ToPdfButton.Click += new System.EventHandler(this.ToPdfButton_Click); + // + // MakeButton + // + this.MakeButton.Location = new System.Drawing.Point(23, 3); + this.MakeButton.Name = "MakeButton"; + this.MakeButton.Size = new System.Drawing.Size(113, 32); + this.MakeButton.TabIndex = 2; + this.MakeButton.Text = "Сформировать"; + this.MakeButton.UseVisualStyleBackColor = true; + this.MakeButton.Click += new System.EventHandler(this.MakeButton_Click); + // + // FormReportOrdersGroupByDate + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.Panel); + this.Name = "FormReportOrdersGroupByDate"; + this.Text = "Заказы (группировка по дате)"; + this.Panel.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private Panel Panel; + private Button ToPdfButton; + private Button MakeButton; + } +} \ No newline at end of file diff --git a/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.cs b/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.cs new file mode 100644 index 0000000..dcfb1c4 --- /dev/null +++ b/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.cs @@ -0,0 +1,81 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Reporting.WinForms; +using SoftwareInstallationContracts.BindingModels; +using SoftwareInstallationContracts.BusinessLogicContracts; +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 SoftwareInstallationView +{ + public partial class FormReportOrdersGroupByDate : Form + { + private readonly ReportViewer reportViewer; + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportOrdersGroupByDate(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + reportViewer = new ReportViewer + { + Dock = DockStyle.Fill + }; + reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrdersGroupByDate.rdlc", FileMode.Open)); + Controls.Clear(); + Controls.Add(reportViewer); + Controls.Add(Panel); + } + + private void MakeButton_Click(object sender, EventArgs e) + { + try + { + var dataSource = _logic.GetOrdersGroupByDate(); + + 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 ToPdfButton_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveOrdersGroupByDateToPdfFile(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/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.resx b/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SoftwareInstallation/SoftwareInstallation/FormReportOrdersGroupByDate.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.Designer.cs new file mode 100644 index 0000000..fe297e7 --- /dev/null +++ b/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.Designer.cs @@ -0,0 +1,100 @@ +namespace SoftwareInstallationView +{ + partial class FormReportShopPackages + { + /// + /// 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.SaveToExcelButton = new System.Windows.Forms.Button(); + this.StoreName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PackageName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.CountPackage = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit(); + this.SuspendLayout(); + // + // DataGridView + // + this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.StoreName, + this.PackageName, + this.CountPackage}); + this.DataGridView.Location = new System.Drawing.Point(2, 55); + this.DataGridView.Name = "DataGridView"; + this.DataGridView.RowTemplate.Height = 25; + this.DataGridView.Size = new System.Drawing.Size(795, 383); + this.DataGridView.TabIndex = 0; + // + // SaveToExcelButton + // + this.SaveToExcelButton.Location = new System.Drawing.Point(26, 12); + this.SaveToExcelButton.Name = "SaveToExcelButton"; + this.SaveToExcelButton.Size = new System.Drawing.Size(113, 37); + this.SaveToExcelButton.TabIndex = 1; + this.SaveToExcelButton.Text = "Сохранить в Excel"; + this.SaveToExcelButton.UseVisualStyleBackColor = true; + this.SaveToExcelButton.Click += new System.EventHandler(this.SaveToExcelButton_Click); + // + // StoreName + // + this.StoreName.HeaderText = "Название магазина"; + this.StoreName.Name = "StoreName"; + // + // PackageName + // + this.PackageName.HeaderText = "Название изделия"; + this.PackageName.Name = "PackageName"; + // + // CountPackage + // + this.CountPackage.HeaderText = "Количество"; + this.CountPackage.Name = "CountPackage"; + // + // FormReportStorePackages + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.SaveToExcelButton); + this.Controls.Add(this.DataGridView); + this.Name = "FormReportStorePackages"; + this.Text = "Изделия по магазинам"; + this.Load += new System.EventHandler(this.FormReportStorePackages_Load); + ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private DataGridView DataGridView; + private Button SaveToExcelButton; + private DataGridViewTextBoxColumn StoreName; + private DataGridViewTextBoxColumn PackageName; + private DataGridViewTextBoxColumn CountPackage; + } +} \ No newline at end of file diff --git a/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.cs b/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.cs new file mode 100644 index 0000000..3b01b40 --- /dev/null +++ b/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.cs @@ -0,0 +1,77 @@ +using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.BindingModels; +using SoftwareInstallationContracts.BusinessLogicContracts; +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 SoftwareInstallationView +{ + public partial class FormReportShopPackages : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + public FormReportShopPackages(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void SaveToExcelButton_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveShopPackageToExcelFile(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); + } + } + } + + private void FormReportStorePackages_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetShopPackage(); + if (dict != null) + { + DataGridView.Rows.Clear(); + foreach (var elem in dict) + { + DataGridView.Rows.Add(new object[] { elem.ShopName, "", "" }); + foreach (var listElem in elem.Packages) + { + 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); + } + } + } +} diff --git a/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.resx b/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SoftwareInstallation/SoftwareInstallation/FormReportShopPackages.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/SoftwareInstallation/SoftwareInstallation/Program.cs b/SoftwareInstallation/SoftwareInstallation/Program.cs index 434d1f9..1834705 100644 --- a/SoftwareInstallation/SoftwareInstallation/Program.cs +++ b/SoftwareInstallation/SoftwareInstallation/Program.cs @@ -64,6 +64,10 @@ namespace SoftwareInstallation services.AddTransient(); services.AddTransient(); services.AddTransient(); - } + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } } } \ No newline at end of file diff --git a/SoftwareInstallation/SoftwareInstallation/ReportOrdersGroupByDate.rdlc b/SoftwareInstallation/SoftwareInstallation/ReportOrdersGroupByDate.rdlc new file mode 100644 index 0000000..9f481f9 --- /dev/null +++ b/SoftwareInstallation/SoftwareInstallation/ReportOrdersGroupByDate.rdlc @@ -0,0 +1,394 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 10791c83-cee8-4a38-bbd0-245fc17cefb3 + + + + + + SofrwareInstallationContractsViewModels + /* Local Query */ + + + + DateCreate + System.DateTime + + + Sum + System.Decimal + + + Count + System.Int32 + + + + SofrwareInstallationContracts.ViewModels + ReportOrdersViewModel + SofrwareInstallationContracts.ViewModels.ReportOrdersViewModel, SofrwareInstallationContracts, 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 +