207 lines
4.7 KiB
C#
207 lines
4.7 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 Public Methods
|
|
|
|
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Fields
|
|
|
|
protected string _selFlux = "*";
|
|
protected string _selMacchina = "*";
|
|
protected string lastUpdate = "-";
|
|
protected bool liveUpdate = true;
|
|
protected DataPager pagerODL;
|
|
protected bool reqNew = false;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected IJSRuntime JSRuntime { get; set; }
|
|
|
|
[Inject]
|
|
protected MpDataService MDService { get; set; }
|
|
|
|
[Inject]
|
|
protected MessageService MsgService { get; set; }
|
|
|
|
[Inject]
|
|
protected NavigationManager NavManager { get; set; }
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void ForceReload(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
}
|
|
|
|
protected void ForceReloadPage(int newNum)
|
|
{
|
|
liveUpdate = newNum == 1;
|
|
currPage = newNum;
|
|
}
|
|
|
|
protected void updateTotal(int newTotCount)
|
|
{
|
|
totalCount = newTotCount;
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
// abilito ricerca...
|
|
MsgService.ShowSearch = false;
|
|
// resetto search
|
|
MsgService.SearchVal = "";
|
|
|
|
ListMacchine = await MDService.MacchineWithFlux();
|
|
// carico dati
|
|
lastUpdate = $"Updated: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
|
await reloadFilters();
|
|
await reloadData();
|
|
}
|
|
|
|
protected async Task pgResetReq(bool doReset)
|
|
{
|
|
if (doReset)
|
|
{
|
|
await pagerODL.resetCurrPage();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Crea nuovo record e va in editing...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected async Task reqNewPODL()
|
|
{
|
|
reqNew = !reqNew;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected async Task toggleUpdate()
|
|
{
|
|
liveUpdate = !liveUpdate;
|
|
await reloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
|
|
private List<string>? ListFlux;
|
|
|
|
private List<string>? ListMacchine;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
|
|
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 string selFlux
|
|
{
|
|
get => _selFlux;
|
|
set
|
|
{
|
|
if (_selFlux != value)
|
|
{
|
|
isLoading = true;
|
|
_selFlux = value;
|
|
ForceReloadPage(1);
|
|
isLoading = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private string selMacchina
|
|
{
|
|
get => _selMacchina;
|
|
set
|
|
{
|
|
if (_selMacchina != value)
|
|
{
|
|
isLoading = true;
|
|
_selMacchina = value;
|
|
ForceReloadPage(1);
|
|
isLoading = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
private int _totalCount = 0;
|
|
private int totalCount
|
|
{
|
|
get => _totalCount;
|
|
set => _totalCount = value;
|
|
//get => MsgService.totalCount;
|
|
//set => MsgService.totalCount = value;
|
|
}
|
|
|
|
private int maxRecord
|
|
{
|
|
get => _maxRecord;
|
|
set
|
|
{
|
|
_maxRecord = value;
|
|
if (value > 100 && liveUpdate)
|
|
{
|
|
liveUpdate = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
private int _maxRecord = 100;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
private async Task reloadFilters()
|
|
{
|
|
await Task.Delay(1);
|
|
ListFlux = await MDService.ParametriGetFilt(selMacchina);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |