83 lines
2.0 KiB
C#
83 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.Data.DatabaseModels;
|
|
using MP.Data.Services;
|
|
using NLog;
|
|
|
|
namespace MP_TAB_SERV.Components
|
|
{
|
|
public partial class ScrapKitMan
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public RegistroScartiModel ParentKit { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
protected List<RegistroScartiKitModel> ListComplete { get; set; } = new List<RegistroScartiKitModel>();
|
|
|
|
protected List<RegistroScartiKitModel> ListPaged { get; set; } = new List<RegistroScartiKitModel>();
|
|
|
|
[Inject]
|
|
protected TabDataService TabDServ { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
protected void UpdateTable()
|
|
{
|
|
// esegue paginazione
|
|
if (TotalCount > NumRecPage)
|
|
{
|
|
ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
|
|
}
|
|
else
|
|
{
|
|
ListPaged = ListComplete;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
private bool isProcessing = false;
|
|
|
|
private int NumRecPage = 10;
|
|
|
|
private int PageNum = 1;
|
|
|
|
private int TotalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
isProcessing = true;
|
|
await Task.Delay(1);
|
|
if (ParentKit != null)
|
|
{
|
|
ListComplete = await TabDServ.RegScartiKitGetFilt(ParentKit);
|
|
TotalCount = ListComplete.Count;
|
|
// esegue paginazione
|
|
UpdateTable();
|
|
}
|
|
isProcessing = false;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |