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);