Files
mapo-core/MP.SPEC/Pages/PARAMS.razor.cs
T
Samuele Locatelli ae39db267d CurrPage:
- riporto a 1 se cambio filtro
- sbaglia primo cambio da sel DataPager
2022-09-15 18:01:25 +02:00

152 lines
3.5 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.SPEC.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Pages
{
public partial class PARAMS
{
#region Protected Fields
#if false
protected string _selFlux = "*";
protected string _selMacchina = "*";
protected string lastUpdate = "-";
protected bool reqNew = false;
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected MpDataService MDService { get; set; }
#endif
protected DataPager pagerODL;
#endregion Protected Fields
#region Protected Properties
#if false
protected bool liveUpdate { get; set; } = true;
#endif
[Inject]
protected MessageService MsgService { get; set; }
#if false
[Inject]
protected NavigationManager NavManager { get; set; }
#endif
#endregion Protected Properties
#region Protected Methods
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
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)
{
//await Task.Delay(1);
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;
//get => MsgService.totalCount;
//set => MsgService.totalCount = value;
}
#endregion Private Properties
#region Private Methods
#if false
private async Task reloadData()
{
isLoading = true;
await Task.Delay(1);
if (!liveUpdate)
{
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
isLoading = false;
await Task.Delay(1);
}
#endif
private async Task updateFilter(SelectFluxParams newParams)
{
isLoading = true;
currFilter = newParams;
currFilter.LiveUpdate = false;
currPage = newParams.CurrPage;
//currFilter.LiveUpdate = !currFilter.LiveUpdate;
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;
}
#endregion Private Methods
}
}