рабает на половину

This commit is contained in:
annalyovushkina@yandex.ru 2024-11-06 01:21:02 +04:00
parent 7b11510913
commit 259259e165
10 changed files with 31 additions and 30 deletions

View File

@ -154,7 +154,7 @@ namespace PluginsApp
} }
} }
private void CreateSimpleDoc() private void CreateChartDoc()
{ {
using var dialog = new SaveFileDialog using var dialog = new SaveFileDialog
{ {
@ -164,7 +164,33 @@ namespace PluginsApp
{ {
try try
{ {
if (_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName })) if (_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName.ToString() }))
{
MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception ex)
{
MessageBox.Show("Произошла ошибка: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void CreateSimpleDoc()
{
using var dialog = new SaveFileDialog
{
Filter = "PDF Files|*.pdf"
};
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
if (_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName.ToString() }))
{ {
MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
@ -181,32 +207,6 @@ namespace PluginsApp
} }
private void CreateTableDoc() private void CreateTableDoc()
{
using var dialog = new SaveFileDialog
{
Filter = "PDF Files|*.pdf"
};
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
if (_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName }))
{
MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception ex)
{
MessageBox.Show("Произошла ошибка: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void CreateChartDoc()
{ {
using var dialog = new SaveFileDialog using var dialog = new SaveFileDialog
{ {
@ -216,7 +216,7 @@ namespace PluginsApp
{ {
try try
{ {
if (_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName })) if (_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName.ToString() }))
{ {
MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }

View File

@ -13,6 +13,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" /> <PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.0" /> <PackageReference Include="System.Text.Json" Version="7.0.0" />

View File

@ -174,7 +174,7 @@ namespace WinFormUchetLab
images.Add(item.TaskImage); images.Add(item.TaskImage);
} }
string[] imagesArray = images.ToArray(); string[] imagesArray = images.ToArray();
_pdfImage.CreatePdfDoc(new DataForImage(saveDocument.FileName, "Сканы чеков", imagesArray)); _pdfImage.CreatePdfDoc(new DataForImage(saveDocument.FileName, "Картинки для лаб", imagesArray));
return true; return true;
} }
return false; return false;