93 lines
2.1 KiB
C#
93 lines
2.1 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 AppStatusDTO? CurrRecord { get; set; } = null;
|
|
|
|
private List<AppStatusDTO> ListRecord { get; set; } = new List<AppStatusDTO>();
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private string checkSelect(string codApp)
|
|
{
|
|
string answ = (CurrRecord != null && codApp == CurrRecord.CodApp) ? "table-info" : "";
|
|
return answ;
|
|
}
|
|
|
|
private string tblCol
|
|
{
|
|
get => CurrRecord == null ? "col-12" : "col-3";
|
|
}
|
|
|
|
private void DoSelect(AppStatusDTO selRec)
|
|
{
|
|
CurrRecord = selRec;
|
|
}
|
|
|
|
private void UpdateTable()
|
|
{
|
|
totalCount = AppStats.Count;
|
|
ListRecord = AppStats
|
|
.OrderByDescending(x => x.NumImp)
|
|
.Skip((currPage - 1) * numRecord)
|
|
.Take(numRecord)
|
|
.ToList();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |