Files
mapo-core/MP.SPEC/Pages/PARAMS.razor.cs
T
2022-09-15 18:23:10 +02:00

109 lines
2.5 KiB
C#

using Microsoft.AspNetCore.Components;
using MP.SPEC.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Pages
{
public partial class PARAMS
{
#region Protected Fields
protected DataPager pagerODL;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MessageService MsgService { get; set; }
#endregion Protected Properties
#region Protected Methods
protected void ForceReload(int newNum)
{
numRecord = newNum;
//currFilter.LiveUpdate = (currPage == 1);
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
currFilter.LiveUpdate = (currPage == 1);
}
protected override async Task OnInitializedAsync()
{
isLoading = true;
// abilito ricerca...
MsgService.ShowSearch = false;
// resetto search
MsgService.SearchVal = "";
await Task.Delay(1);
isLoading = false;
}
protected async Task pgResetReq(bool doReset)
{
if (doReset)
{
await pagerODL.resetCurrPage();
}
}
protected void updateTotal(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Fields
private int _totalCount = 0;
#endregion Private Fields
#region Private Properties
private SelectFluxParams currFilter { get; set; } = new SelectFluxParams();
private int currPage
{
get => MsgService.currPage;
set => MsgService.currPage = value;
}
private bool isLoading { get; set; } = false;
private int numRecord
{
get => MsgService.numRecord;
set => MsgService.numRecord = value;
}
private int totalCount
{
get => _totalCount;
set => _totalCount = value;
}
#endregion Private Properties
#region Private Methods
private async Task updateFilter(SelectFluxParams newParams)
{
isLoading = true;
currFilter = newParams;
currFilter.LiveUpdate = (currPage == 1);
currPage = newParams.CurrPage;
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;
}
#endregion Private Methods
}
}