100 lines
3.3 KiB
C#
100 lines
3.3 KiB
C#
using EgwCoreLib.Razor.Data;
|
|
using LiMan.DB.DTO;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Org.BouncyCastle.Ocsp;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace LiMan.UI.Components
|
|
{
|
|
public partial class InstAppPareto
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public AppStatusDTO CurrRecord { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
protected List<AppRelStatusDTO> ListRecord { get; set; } = new List<AppRelStatusDTO>();
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
ListRecord = CurrRecord.DetailInstalled.OrderByDescending(x => x.VersNumInstall).ToList();
|
|
// sistemo info x grafico...
|
|
ChartData = ListRecord
|
|
.GroupBy(x => x.VersNumInstall)
|
|
.Select(g => (double)g.Sum(x => x.NumImp))
|
|
.ToArray();
|
|
ChartLabels = ListRecord
|
|
.GroupBy(x => x.VersNumInstall)
|
|
.Select(g => g.Key)
|
|
.ToArray();
|
|
ChartColor.Clear();
|
|
var listStatus = ListRecord
|
|
.GroupBy(x => x.VersNumInstall)
|
|
.Select(g => g.First().UpToDateStatus)
|
|
.ToList();
|
|
foreach (var item in listStatus)
|
|
{
|
|
switch (item)
|
|
{
|
|
case 4:
|
|
ChartColor.Add(new DoughnutStyling("#12FF06", "#006900"));
|
|
break;
|
|
case 3:
|
|
ChartColor.Add(new DoughnutStyling("#ABFF69", "#11AA11"));
|
|
break;
|
|
case 2:
|
|
ChartColor.Add(new DoughnutStyling("#99CC33", "#AAFF00"));
|
|
break;
|
|
case 1:
|
|
ChartColor.Add(new DoughnutStyling("#F59C00", "#953500"));
|
|
break;
|
|
case 0:
|
|
ChartColor.Add(new DoughnutStyling("#FF6936", "#AA0000"));
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private string cssVers(AppRelStatusDTO rec)
|
|
{
|
|
string answ = "";
|
|
switch (rec.UpToDateStatus)
|
|
{
|
|
case 4:
|
|
answ = "text-success fw-bold";
|
|
break;
|
|
case 3:
|
|
answ = "text-success";
|
|
break;
|
|
case 2:
|
|
answ = "text-warning";
|
|
break;
|
|
case 1:
|
|
answ = "text-danger";
|
|
break;
|
|
case 0:
|
|
answ = "text-danger fw-bold";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
private string[] ChartLabels = new string[1];
|
|
private double[] ChartData = new double[1];
|
|
private List<DoughnutStyling> ChartColor = new List<DoughnutStyling>();
|
|
#endregion Protected Methods
|
|
}
|
|
} |