готово

This commit is contained in:
Татьяна Артамонова 2023-11-10 13:19:47 +04:00
parent dbd09b5386
commit 9a6819261e
3 changed files with 11 additions and 25 deletions

View File

@ -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<GridColumnConfig>
{
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<GridColumnConfig>
{
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<StudentBindingModel> 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)
{

View File

@ -35,7 +35,6 @@
/// Обновление набора данных в контроле
/// </summary>
void ReloadData();
void Configure();
/// <summary>
/// Создание простого документа

View File

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