From 9a6819261e6ab19b5e5e2d4d66d1c964ae412774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=B0=D1=82=D1=8C=D1=8F=D0=BD=D0=B0=20=D0=90=D1=80?= =?UTF-8?q?=D1=82=D0=B0=D0=BC=D0=BE=D0=BD=D0=BE=D0=B2=D0=B0?= Date: Fri, 10 Nov 2023 13:19:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainPluginConvention.cs | 34 ++++++------------- .../Plugins/IPluginsConvention.cs | 1 - UniversityView/FormMainPlugins.cs | 1 + 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/PluginsConventionLibrary/MainPluginConvention.cs b/PluginsConventionLibrary/MainPluginConvention.cs index b4cf92f..81d6c35 100644 --- a/PluginsConventionLibrary/MainPluginConvention.cs +++ b/PluginsConventionLibrary/MainPluginConvention.cs @@ -29,7 +29,7 @@ namespace PluginsConventionLibrary tableOfValues = new TableOfValues(); var menu = new ContextMenuStrip(); - var directionMenuItem = new ToolStripMenuItem("Формы"); + var directionMenuItem = new ToolStripMenuItem("Направления"); menu.Items.Add(directionMenuItem); directionMenuItem.Click += (sender, e) => { @@ -38,13 +38,21 @@ namespace PluginsConventionLibrary }; tableOfValues.ContextMenuStrip = menu; ReloadData(); - Configure(); } public void ReloadData() { try { + var columnConfigs = new List + { + new GridColumnConfig { HeaderText = "Id", Width = 100, Visible = false, PropertyName = "Id" }, + new GridColumnConfig { HeaderText = "ФИО", Width = 100, Visible = true, PropertyName = "FIO" }, + new GridColumnConfig { HeaderText = "Направление", Width = 80, Visible = true, PropertyName = "DirectionName" }, + new GridColumnConfig { HeaderText = "Электронная почта", Width = 80, Visible = true, PropertyName = "Email" }, + }; + + tableOfValues.ConfigureColumns(columnConfigs); tableOfValues.ClearRows(); var list = _studentLogic.Read(null); if (list != null) @@ -111,25 +119,6 @@ namespace PluginsConventionLibrary return true; } - public void Configure() - { - var columnConfigs = new List - { - new GridColumnConfig { HeaderText = "Id", Width = 100, Visible = false, PropertyName = "Id" }, - new GridColumnConfig { HeaderText = "ФИО", Width = 100, Visible = true, PropertyName = "FIO" }, - new GridColumnConfig { HeaderText = "Направление", Width = 80, Visible = true, PropertyName = "DirectionName" }, - new GridColumnConfig { HeaderText = "Электронная почта", Width = 80, Visible = true, PropertyName = "Email" }, - }; - - tableOfValues.ConfigureColumns(columnConfigs); - } - - private byte[] StringToImage(string bytes) - { - byte[] arrayimg = Convert.FromBase64String(bytes); - return arrayimg; - } - public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument) { ExcelComponent excelComponent = new(); @@ -152,7 +141,6 @@ namespace PluginsConventionLibrary } ExcelImageInfo info = new(dialog.FileName, "Документ с фотографиями студентов", images); excelComponent.GenerateExcelWithImages(info); - MessageBox.Show("Сохарнено успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { @@ -207,7 +195,6 @@ namespace PluginsConventionLibrary } TableWord tableWord = new(dialog.FileName, "Таблица со студентами", columnDefinitions, columnDefinitions2, data, mergedColumns); componentWord.CreateTable(tableWord); - MessageBox.Show("Сохарнено успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { @@ -258,7 +245,6 @@ namespace PluginsConventionLibrary } } gistogramPdfComponent.GenerateHistogramDocument(dialog.FileName, "Histogram", "Students-Directions", LegendPosition.TopRight, gistData); - MessageBox.Show("Сохарнено успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { diff --git a/PluginsConventionLibrary/Plugins/IPluginsConvention.cs b/PluginsConventionLibrary/Plugins/IPluginsConvention.cs index af3c095..f85aa18 100644 --- a/PluginsConventionLibrary/Plugins/IPluginsConvention.cs +++ b/PluginsConventionLibrary/Plugins/IPluginsConvention.cs @@ -35,7 +35,6 @@ /// Обновление набора данных в контроле /// void ReloadData(); - void Configure(); /// /// Создание простого документа diff --git a/UniversityView/FormMainPlugins.cs b/UniversityView/FormMainPlugins.cs index 81e89f8..76b8a9a 100644 --- a/UniversityView/FormMainPlugins.cs +++ b/UniversityView/FormMainPlugins.cs @@ -115,6 +115,7 @@ namespace UniversityView private void CreateSimpleDoc() { using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" }; + if (_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument { FileName = dialog.FileName })) { MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);