Files
limanapp/LiMan.UI/Components/InstAppRelStatus.razor.cs
T
Samuele Locatelli 01f308743e Update stats page
2025-01-13 14:44:09 +01:00

75 lines
1.7 KiB
C#

using LiMan.DB.DTO;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
namespace LiMan.UI.Components
{
public partial class InstAppRelStatus
{
#region Public Properties
[Parameter]
public List<AppStatusDTO> AppStats { get; set; } = new List<AppStatusDTO>();
#endregion Public Properties
#region Protected Methods
protected override void OnParametersSet()
{
isLoading = true;
UpdateTable();
isLoading = false;
}
protected void setNumPage(int newNum)
{
currPage = newNum;
UpdateTable();
isLoading = false;
}
protected void setNumRec(int newNum)
{
numRecord = newNum;
UpdateTable();
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private int currPage = 1;
private bool isLoading = false;
private int numRecord = 10;
private int totalCount = 0;
#endregion Private Fields
#region Private Properties
private List<AppStatusDTO> ListRecord { get; set; } = new List<AppStatusDTO>();
#endregion Private Properties
#region Private Methods
private void UpdateTable()
{
totalCount = AppStats.Count;
ListRecord = AppStats
.OrderByDescending(x => x.NumImp)
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
.ToList();
}
#endregion Private Methods
}
}