diff --git a/VisualComponentsForm/VisualComponentsForm/FormMain.cs b/VisualComponentsForm/VisualComponentsForm/FormMain.cs index 446f54c..e77d64f 100644 --- a/VisualComponentsForm/VisualComponentsForm/FormMain.cs +++ b/VisualComponentsForm/VisualComponentsForm/FormMain.cs @@ -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) diff --git a/VisualComponentsForm/VisualComponentsForm/PluginsConvention.cs b/VisualComponentsForm/VisualComponentsForm/PluginsConvention.cs index 6598dce..47608cf 100644 --- a/VisualComponentsForm/VisualComponentsForm/PluginsConvention.cs +++ b/VisualComponentsForm/VisualComponentsForm/PluginsConvention.cs @@ -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()!.Id; + int Id = listBox.GetSelectedRecord()!.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 totalList = new(); + + List 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() + { + 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 + pdfTable.SaveToPdfFile(new PdfTableInfo { FilePath = saveDocument.FileName, DocumentTitle = "Заголовок",