Files
mapo-core/MP.INVE/Components/ListTotLotto.razor.cs
T
2022-12-14 14:43:45 +01:00

92 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.INVE;
using MP.INVE.Shared;
using MP.INVE.Components;
using MP.Data.DatabaseModels;
using MP.INVE.Data;
namespace MP.INVE.Components
{
public partial class ListTotLotto
{
public void Dispose()
{
elencoTotLotto = null;
SearchRecords = null;
GC.Collect();
}
[Parameter]
public int SessionID { get; set; } = 0;
[Inject]
protected MiDataService MIService { get; set; } = null!;
private int totalCount
{
get => currParams.TotCount;
set
{
currParams.TotCount = value;
StateHasChanged();
}
}
private int numRecord
{
get => currParams.NumRec;
set
{
currParams.NumRec = value;
StateHasChanged();
}
}
private int currPage
{
get => currParams.CurrPage;
set
{
currParams.CurrPage = value;
StateHasChanged();
}
}
protected async override Task OnParametersSetAsync()
{
await Task.Delay(1);
if (SessionID != 0)
{
await reloadData();
}
}
private async Task reloadData()
{
elencoTotLotto = null;
totalCount = 0;
isLoading = true;
SearchRecords = MIService.InveSessTotLotList(SessionID);
totalCount = SearchRecords.Count;
elencoTotLotto = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
await Task.Delay(1);
isLoading = false;
}
protected List<InveSessTotLotModel>? elencoTotLotto;
private List<InveSessTotLotModel>? SearchRecords;
[Parameter]
public SelectInvioParams currParams { get; set; } = null!;
[Parameter]
public bool isLoading { get; set; }
}
}