50d65eebaa
- renaming classi gestione DbModels in - spostamento anagrafica flussi da auth a generale
168 lines
4.2 KiB
C#
168 lines
4.2 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.Data.DbModels;
|
|
using MP.INVE.Data;
|
|
|
|
namespace MP.INVE.Components
|
|
{
|
|
public partial class ListTotLotto
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public SelectInvioParams currParams { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public bool isLoading { get; set; }
|
|
|
|
[Parameter]
|
|
public string searchVal { get; set; } = "";
|
|
|
|
[Parameter]
|
|
public int SessionID { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public EventCallback<int> updateRecordCount { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
elencoTotLotto = null;
|
|
SearchRecords = null;
|
|
GC.Collect();
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Fields
|
|
|
|
protected List<InveSessTotLotModel>? elencoTotLotto;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MiDataService MIService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await Task.Delay(1);
|
|
if (SessionID != 0)
|
|
{
|
|
await reloadData();
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private List<InveSessTotLotModel>? SearchRecords;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private int _totalCount { get; set; } = 0;
|
|
|
|
private int currPage
|
|
{
|
|
get => currParams.CurrPage;
|
|
set
|
|
{
|
|
currParams.CurrPage = value;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
private int numRecord
|
|
{
|
|
get => currParams.NumRec;
|
|
set
|
|
{
|
|
currParams.NumRec = value;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
private int totalCount
|
|
{
|
|
get => _totalCount;
|
|
set
|
|
{
|
|
if (_totalCount != value)
|
|
{
|
|
_totalCount = value;
|
|
updateRecordCount.InvokeAsync(value);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
protected async Task selRecord(InveSessTotLotModel selRecord)
|
|
{
|
|
currRecord = selRecord;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected async Task resetSel()
|
|
{
|
|
currRecord = null;
|
|
await Task.Delay(1);
|
|
}
|
|
public string checkSelect(InveSessTotLotModel thisRecord)
|
|
{
|
|
string answ = "";
|
|
if (currRecord != null)
|
|
{
|
|
try
|
|
{
|
|
answ = (currRecord.Lotto == thisRecord.Lotto && currRecord.CodArticolo==thisRecord.CodArticolo) ? "table-info" : "";
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
public string mainCss
|
|
{
|
|
get => currRecord != null ? "col-9" : "col-12";
|
|
}
|
|
|
|
protected InveSessTotLotModel? currRecord { get; set; } = null;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task reloadData()
|
|
{
|
|
elencoTotLotto = null;
|
|
//totalCount = 0;
|
|
isLoading = true;
|
|
SearchRecords = MIService.InveSessTotLotList(SessionID);
|
|
// se ho search --> filtro...
|
|
if (!string.IsNullOrEmpty(searchVal))
|
|
{
|
|
StringComparison strComp = StringComparison.CurrentCultureIgnoreCase;
|
|
SearchRecords = SearchRecords.Where(x => x.CodArticolo.Contains(searchVal, strComp) || x.DescrArt.Contains(searchVal, strComp) || x.Lotto.Contains(searchVal, strComp)).ToList();
|
|
}
|
|
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;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |