Files
mapo-core/MP.Stats/Components/TaskExeList.razor.cs
T
2024-04-02 11:46:45 +02:00

89 lines
2.1 KiB
C#

using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Stats.Data;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Stats.Components
{
public partial class TaskExeList
{
#region Public Properties
[Parameter]
public TaskListModel? CurrRecord { get; set; } = null;
#endregion Public Properties
#region Protected Fields
protected bool isLoading = false;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected NavigationManager NavManager { get; set; }
/// <summary>
/// Show error mode: 0 = tutti 1 = solo errori 2 = solo ok
/// </summary>
protected int ShowErrorMode { get; set; } = 0;
[Inject]
protected MpStatsService StatService { get; set; }
protected int totalCount { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected async Task ForceReload(int newNum)
{
numRecord = newNum;
await ReloadData();
}
protected async Task ForceReloadPage(int newNum)
{
currPage = newNum;
await ReloadData();
}
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private List<TaskExecModel> ListRecords;
private List<TaskExecModel> SearchRecords;
#endregion Private Fields
#region Private Properties
private int currPage { get; set; } = 1;
private int numRecord { get; set; } = 10;
#endregion Private Properties
#region Private Methods
private async Task ReloadData()
{
SearchRecords = await StatService.TaskExecGetFilt(CurrRecord.TaskId, 1000, "");
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
#endregion Private Methods
}
}