First common.

This commit is contained in:
ElEgEv 2023-11-02 21:27:47 +04:00
parent 695eca91b9
commit e9733d991b
2 changed files with 68 additions and 25 deletions

View File

@ -247,8 +247,6 @@ namespace VisualComponentsForm
LineChartExcel chart = new();
EnumAreaLegend legend = new();
foreach(var elem in list)
{
if(elem.Questions.Length >= 50 && elem.Questions.Length < 100)

View File

@ -1,12 +1,18 @@
using DatabaseImplement.Implements;
using Contracts.ViewModel;
using DatabaseImplement.Implements;
using DataModels.Models;
using DocumentFormat.OpenXml.EMMA;
using NonVisualComponents;
using NonVisualComponents.Classes;
using NonVisualComponents.Enums;
using NonVisualComponents.objects;
using PluginsLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VisualComponentsLib.Components.SupportClasses;
using VisualComponentsLib.CustomListBox;
namespace VisualComponentsForm
@ -15,10 +21,10 @@ namespace VisualComponentsForm
{
private readonly LabWorkStorage _labWorkStorage;
private readonly IDiscipline _discipline;
private readonly ValueTree valTree;
private readonly ComponentTextWord componentTextWord;
private readonly ConfigurableTable configurableTable;
private readonly PieChartDocument pieChartDocument;
private readonly MyListBox listBox;
private SimpleTable wordTable;
private PdfTable pdfTable;
private ExcelChartInfo excelTable;
public string PluginName { get; set; } = "Список объектов";
@ -26,22 +32,22 @@ namespace VisualComponentsForm
{
_labWorkStorage = new LabWorkStorage();
_discipline = new DisciplineStorage();
componentTextWord = new ComponentTextWord();
configurableTable = new ConfigurableTable();
pieChartDocument = new PieChartDocument();
valTree = new ValueTree();
wordTable = new SimpleTable();
pdfTable = new PdfTable();
//excelTable = new ExcelChartInfo();
listBox = new MyListBox();
}
public UserControl GetControl
{
get { return valTree; }
get { return listBox; }
}
public PluginsConventionElement GetElement
{
get
{
int Id = valTree.GetSelectedRecord<OrderViewModel>()!.Id;
int Id = listBox.GetSelectedRecord<LabWorkViewModel>()!.Id;
byte[] bytes = new byte[16];
BitConverter.GetBytes(Id).CopyTo(bytes, 0);
@ -56,18 +62,57 @@ namespace VisualComponentsForm
{
try
{
string[] strings = _labWorkStorage.getUniqueStatusNames();
double[] doubles = _labWorkStorage.getCountByStatus(strings);
//сразу группируем списки по дисциплинам
var list = _labWorkStorage.GetFullList();
pieChartDocument.Gen(new PieChartDocumentConfig()
List<string[,]> totalList = new();
List<int> supportList = new(4) { 0, 0, 0, 0 };
LineChartExcel chart = new();
foreach (var elem in list)
{
FilePath = saveDocument.FileName,
Title = System.IO.Path.GetFileName(saveDocument.FileName),
ChartTitle = "Сколько оплаченных заказов в каких статусах находятся",
Data = doubles,
Labels = strings,
LegendPosition = ChartLegendPosition.Top,
});
if (elem.Questions.Length >= 50 && elem.Questions.Length < 100)
{
supportList[0]++;
}
if (elem.Questions.Length >= 100 && elem.Questions.Length < 150)
{
supportList[1]++;
}
if (elem.Questions.Length >= 150 && elem.Questions.Length < 200)
{
supportList[2]++;
}
if (elem.Questions.Length >= 200 && elem.Questions.Length < 250)
{
supportList[3]++;
}
}
var data = new List<DataItem>()
{
new DataItem() { Name = "50-100", Value = supportList[0] },
new DataItem() { Name = "100-150", Value = supportList[1] },
new DataItem() { Name = "150-200", Value = supportList[2] },
new DataItem() { Name = "200-250", Value = supportList[3] }
};
excelTable = new(
saveDocument.FileName,
"Третье задание",
"Диаграмма",
EnumAreaLegend.Left,
data
);
chart.GenerateChartExcel(excelTable);
MessageBox.Show("Сохарнено успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
return true;
}
@ -106,7 +151,7 @@ namespace VisualComponentsForm
data = data
};
componentTextWord.CreateFileWithBigText(wd);
wordTable.CreateFileWithBigText(wd);
return true;
}
@ -174,7 +219,7 @@ namespace VisualComponentsForm
rowHeight[i] = 20;
}
configurableTable.SaveToPdfFile(new PdfTableInfo<OrderTableViewModel>
pdfTable.SaveToPdfFile(new PdfTableInfo<OrderTableViewModel>
{
FilePath = saveDocument.FileName,
DocumentTitle = "Заголовок",