Полностью доделал
This commit is contained in:
parent
34d262287b
commit
290b40fe1c
@ -146,73 +146,99 @@ namespace AppView
|
||||
|
||||
public bool CreateWordDocument(PluginsConventionSaveDocument saveDocument)
|
||||
{
|
||||
ImageClass info = new ImageClass();
|
||||
try
|
||||
{
|
||||
ImageClass info = new ImageClass();
|
||||
|
||||
var images = _providerStorage.GetFullList().Select(x => x.Logo).ToList();
|
||||
var images = _providerStorage.GetFullList().Select(x => x.Logo).ToList();
|
||||
|
||||
info.Title = "Images";
|
||||
info.Path = saveDocument.FileName;
|
||||
info.Files = images;
|
||||
info.Title = "Images";
|
||||
info.Path = saveDocument.FileName;
|
||||
info.Files = images;
|
||||
|
||||
documentWithImage1.CreateDocument(info);
|
||||
return true;
|
||||
documentWithImage1.CreateDocument(info);
|
||||
MessageBox.Show("Готово");
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message, "Ошибка");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument)
|
||||
{
|
||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||
try
|
||||
{
|
||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||
|
||||
List<ColumnDefinition> columnDefinitionsUp = new List<ColumnDefinition> {
|
||||
List<ColumnDefinition> columnDefinitionsUp = new List<ColumnDefinition> {
|
||||
new ColumnDefinition{Header = "#", PropertyName = "Id", Weight = 30},
|
||||
new ColumnDefinition{Header = "Информация", PropertyName = "NumberType", Weight = 30},
|
||||
new ColumnDefinition{Header = "", PropertyName = "NumberType", Weight = 30},
|
||||
new ColumnDefinition{Header = "Номер телефона", PropertyName = "Number", Weight = 30},
|
||||
};
|
||||
List<ColumnDefinition> columnDefinitionsDown = new List<ColumnDefinition> {
|
||||
List<ColumnDefinition> columnDefinitionsDown = new List<ColumnDefinition> {
|
||||
new ColumnDefinition{Header = "#", PropertyName = "Id", Weight = 30},
|
||||
new ColumnDefinition{Header = "Название", PropertyName = "Name", Weight = 30},
|
||||
new ColumnDefinition{Header = "Тип изделия", PropertyName = "Type", Weight = 30},
|
||||
new ColumnDefinition{Header = "-", PropertyName = "Number", Weight = 30},
|
||||
};
|
||||
|
||||
var providers = _providerStorage.GetFullList();
|
||||
var providers = _providerStorage.GetFullList();
|
||||
|
||||
List<int[]> mergedColums = new() { new int[] { 1, 2 } };
|
||||
List<int[]> mergedColums = new() { new int[] { 1, 2 } };
|
||||
|
||||
BigTable<ProviderViewModel> info = new(saveDocument.FileName, "Table", columnDefinitionsUp, columnDefinitionsDown, providers, mergedColums);
|
||||
BigTable<ProviderViewModel> info = new(saveDocument.FileName, "Table", columnDefinitionsUp, columnDefinitionsDown, providers, mergedColums);
|
||||
|
||||
table2column1.CreateTable(info);
|
||||
MessageBox.Show("Готово");
|
||||
return true;
|
||||
table2column1.CreateTable(info);
|
||||
MessageBox.Show("Готово");
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message, "Ошибка");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument)
|
||||
{
|
||||
|
||||
var providers = _providerStorage.GetFullList();
|
||||
|
||||
var uniqueTypes = providers.Select(p => p.Type).Distinct();
|
||||
|
||||
List<ChartData> data = new List<ChartData>();
|
||||
|
||||
foreach (var uniqueType in uniqueTypes)
|
||||
try
|
||||
{
|
||||
var typeProviders = providers.Where(p => p.Type == uniqueType).ToList();
|
||||
var providers = _providerStorage.GetFullList();
|
||||
|
||||
var dataList = new List<double>();
|
||||
var uniqueTypes = providers.Select(p => p.Type).Distinct();
|
||||
|
||||
// Используем Count() для подсчета общего количества поставщиков каждого типа
|
||||
int totalCount = typeProviders.Count();
|
||||
List<ChartData> data = new List<ChartData>();
|
||||
|
||||
ChartData chData = new ChartData();
|
||||
chData.SeriesName = uniqueType;
|
||||
chData.Data = new double[] { totalCount };
|
||||
foreach (var uniqueType in uniqueTypes)
|
||||
{
|
||||
var typeProviders = providers.Where(p => p.Type == uniqueType).ToList();
|
||||
|
||||
data.Add(chData);
|
||||
var dataList = new List<double>();
|
||||
|
||||
// Используем Count() для подсчета общего количества поставщиков каждого типа
|
||||
int totalCount = typeProviders.Count();
|
||||
|
||||
ChartData chData = new ChartData();
|
||||
chData.SeriesName = uniqueType;
|
||||
chData.Data = new double[] { totalCount };
|
||||
|
||||
data.Add(chData);
|
||||
}
|
||||
|
||||
gistograma1.GenerateExcelChartDocument(saveDocument.FileName, "Сводка по типам изделия.", "Количество поставщиков для товаров каждого типа", WinFormsLibrary.not_visual.LegendPosition.Bottom, data);
|
||||
MessageBox.Show("Готово");
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message, "Ошибка");
|
||||
return false;
|
||||
}
|
||||
|
||||
gistograma1.GenerateExcelChartDocument(saveDocument.FileName, "Сводка по типам изделия.", "Количество поставщиков для товаров каждого типа", WinFormsLibrary.not_visual.LegendPosition.Bottom, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -183,38 +183,50 @@ namespace WinFormsAppByPlugins
|
||||
|
||||
private void CreateSimpleDoc()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
try
|
||||
{
|
||||
Filter = "Word Files|*.docx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateWordDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "Word Files|*.docx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateWordDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà çàãðóçêè ïëàãèíà."); }
|
||||
}
|
||||
private void CreateTableDoc()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
try
|
||||
{
|
||||
Filter = "PDF Files|*.pdf"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "PDF Files|*.pdf"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà çàãðóçêè ïëàãèíà."); }
|
||||
}
|
||||
private void CreateChartDoc()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
try
|
||||
{
|
||||
Filter = "Excel Files|*.xlsx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
SaveFileDialog saveFileDialog = new()
|
||||
{
|
||||
Filter = "Excel Files|*.xlsx"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà çàãðóçêè ïëàãèíà."); }
|
||||
}
|
||||
|
||||
private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus();
|
||||
|
Loading…
Reference in New Issue
Block a user