70 lines
1.5 KiB
C#
70 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.Core.DTO;
|
|
|
|
namespace MP.IOC.Components.Compo
|
|
{
|
|
public partial class ParetoDetail
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public List<StatDataDTO> ParetoList { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public string Title { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
//base.OnParametersSet();
|
|
totalCount = ParetoList.Count();
|
|
UpdateTable();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private List<StatDataDTO> ListPaged = new();
|
|
|
|
private int numRecPage = 10;
|
|
|
|
private int pageNum = 1;
|
|
|
|
private int totalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Methods
|
|
|
|
private void SaveNumRec(int newNum)
|
|
{
|
|
numRecPage = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
private void SavePage(int newNum)
|
|
{
|
|
pageNum = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
private void UpdateTable()
|
|
{
|
|
// esegue paginazione
|
|
if (totalCount > numRecPage)
|
|
{
|
|
ListPaged = ParetoList.Skip((pageNum - 1) * numRecPage).Take(numRecPage).ToList();
|
|
}
|
|
else
|
|
{
|
|
ListPaged = ParetoList;
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |