Fix ordering in pareto detail

This commit is contained in:
Samuele Locatelli
2025-01-17 11:17:50 +01:00
parent 3ab1e3681b
commit 5bf07d00f5
6 changed files with 128 additions and 33 deletions
+9 -2
View File
@@ -10,12 +10,19 @@
<tr>
<th>
<button class="btn btn-sm btn-dark @CssResetCli" title="Rimuovi Filtro Cliente" @onclick="ResetCliente"><i class="fa-solid fa-rotate-right"></i> Cliente</button>
<Sorter ParamName="CodInst" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th>
<button class="btn btn-sm btn-primary @CssResetImp" title="Rimuovi Filtro Dispositivo" @onclick="ResetCodImp"><i class="fa-solid fa-rotate-right"></i> Dispositivo</button>
<Sorter ParamName="PcInst" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th># Lic.
<Sorter ParamName="NumImp" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th class="text-end">
Versione
<Sorter ParamName="VersNumInstall" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th># Lic.</th>
<th class="text-end">Versione</th>
</tr>
</thead>
<tbody>
+115 -27
View File
@@ -6,6 +6,7 @@ using Org.BouncyCastle.Ocsp;
using System;
using System.Collections.Generic;
using System.Linq;
using static EgwCoreLib.Razor.Sorter;
namespace LiMan.UI.Components
{
@@ -14,10 +15,10 @@ namespace LiMan.UI.Components
#region Public Properties
[Parameter]
public AppStatusDTO CurrRecord { get; set; } = null!;
public List<AppRelStatusDTO> AppDetList { get; set; } = new List<AppRelStatusDTO>();
[Parameter]
public List<AppRelStatusDTO> AppDetList { get; set; } = new List<AppRelStatusDTO>();
public AppStatusDTO CurrRecord { get; set; } = null!;
#endregion Public Properties
@@ -87,6 +88,13 @@ namespace LiMan.UI.Components
MServ.UsrParamSet("PcInst", "");
// Richiedo azione x gestione dettaglio info
MServ.ReportSelCodInst();
// se era selezionato impianto lo deseleziona...
if (HasFlitImp)
{
CodImpSel = "";
HasFlitImp = false;
MServ.ReportSelCodImp();
}
}
/// <summary>
@@ -100,6 +108,12 @@ namespace LiMan.UI.Components
AppInstList = AppDetList
.Where(x => x.CodImp == currRec.CodImp)
.ToList();
// se era selezionato cliente lo riseleziono...
if (HasFlitCli)
{
CodInstSel = currRec.CodInst;
MServ.ReportSelCodInst();
}
// salvo nelle preferenze i valori CodImp e PcInst
MServ.UsrParamSet("Cliente", currRec.Cliente);
MServ.UsrParamSet("CodInst", currRec.CodInst);
@@ -109,8 +123,6 @@ namespace LiMan.UI.Components
MServ.ReportSelCodImp();
}
private List<AppRelStatusDTO> AppInstList = new List<AppRelStatusDTO>();
protected void setNumPage(int newNum)
{
currPage = newNum;
@@ -125,30 +137,34 @@ namespace LiMan.UI.Components
isLoading = false;
}
protected void SortRequested(SortCallBack e)
{
isLoading = true;
if (sortField == e.ParamName)
{
sortAsc = e.IsAscending;
}
sortField = e.ParamName;
ReloadData();
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private List<AppRelStatusDTO> AppInstList = new List<AppRelStatusDTO>();
private List<DoughnutStyling> ChartColor = new List<DoughnutStyling>();
private double[] ChartData = new double[1];
private string[] ChartLabels = new string[1];
private string CodImpSel = "";
private string CodInstSel = "";
private int currPage = 1;
private bool HasFlitCli = false;
private bool HasFlitImp = false;
private bool isLoading = false;
private int numRecord = 25;
private int numRecord = 10;
private string sKey = "InstAppPareto";
private int totalCount = 0;
#endregion Private Fields
@@ -175,22 +191,40 @@ namespace LiMan.UI.Components
get => HasFlitImp ? "" : "disabled";
}
private string CssBtnInst(string CodInst)
private bool sortAsc
{
return HasFlitCli && CodInstSel == CodInst ? "btn-dark" : "btn-outline-dark";
get
{
bool answ = false;
var sVal = MServ.UsrParamGet($"{sKey}_sort");
if (!string.IsNullOrEmpty(sVal))
{
bool.TryParse(sVal, out answ);
}
return answ;
}
set => MServ.UsrParamSet($"{sKey}_sort", $"{value}");
}
private string sortField
{
get => MServ.UsrParamGet($"{sKey}_field");
set => MServ.UsrParamSet($"{sKey}_field", $"{value}");
}
#endregion Private Properties
#region Private Methods
private string CssBtnImp(string CodImp)
{
return HasFlitImp && CodImpSel == CodImp ? "btn-primary" : "btn-outline-primary";
}
#endregion Private Properties
#region Private Methods
private string CssBtnInst(string CodInst)
{
return HasFlitCli && CodInstSel == CodInst ? "btn-dark" : "btn-outline-dark";
}
private string cssVers(AppRelStatusDTO rec)
{
@@ -280,13 +314,67 @@ namespace LiMan.UI.Components
}
}
private void ReloadData()
{
SearchRecord = CurrRecord.DetailInstalled
.OrderByDescending(x => x.VersNumInstall)
.ToList();
SearchRecord = CurrRecord.DetailInstalled;
totalCount = SearchRecord.Count;
// sistemo tabella
switch (sortField)
{
case "NumImp":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.NumImp).ThenByDescending(x => x.VersNumInstall).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.NumImp).ThenByDescending(x => x.VersNumInstall).ToList();
}
break;
case "VersNumInstall":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.VersNumInstall).ThenBy(x => x.PcInst).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.VersNumInstall).ThenBy(x => x.PcInst).ToList();
}
break;
case "PcInst":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.PcInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.PcInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
break;
case "CodInst":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.CodInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.CodInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
break;
default:
SearchRecord = SearchRecord
.OrderByDescending(x => x.VersNumInstall)
.ThenBy(x => x.PcInst)
.ToList();
break;
}
// paginazione
ListRecord = SearchRecord
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>2.1.2501.1710</Version>
<Version>2.1.2501.1711</Version>
<RootNamespace>LiMan.UI</RootNamespace>
<AssemblyName>LiMan.UI</AssemblyName>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2501.1710</h4>
<h4>Versione: 2.1.2501.1711</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
2.1.2501.1710
2.1.2501.1711
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2501.1710</version>
<version>2.1.2501.1711</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>