Update x salvataggio num righe selezionate utente

This commit is contained in:
Samuele Locatelli
2024-07-01 19:00:55 +02:00
parent 7df4d7e9de
commit 1b0ff7fd1d
5 changed files with 54 additions and 20 deletions
+18
View File
@@ -224,6 +224,24 @@ namespace MagMan.Core.Services
await localStore.SetItemAsync("ClientID", newVal);
}
/// <summary>
/// Num record x la pagina corrente
/// </summary>
public async Task<int> NumRowGridGet(string gridName)
{
var answ = await localStore.GetItemAsync<int>($"{gridName}_nRow");
answ = answ > 0 ? answ : 10;
return answ;
}
/// <summary>
/// Imposta num record x la pagina corrente
/// </summary>
public async Task NumRowGridSet(string gridName, int newVal)
{
await localStore.SetItemAsync($"{gridName}_nRow", newVal);
}
/// <summary>
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
/// </summary>
+7 -8
View File
@@ -112,11 +112,13 @@ namespace MagMan.UI.Components
await ReloadData();
}
protected override void OnInitialized()
protected override async Task OnInitializedAsync()
{
currSearch = "";
AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated;
AppMService.QueUpdAliasMat.EA_NewMessage += QueUpdAliasMat_EA_NewMessage;
numRecord = await AppMService.NumRowGridGet(gridKey);
}
protected override async Task OnParametersSetAsync()
@@ -135,11 +137,12 @@ namespace MagMan.UI.Components
return answ;
}
protected void SetNumRec(int newNum)
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
currPage = 1;
InvokeAsync(ReloadData);
await AppMService.NumRowGridSet(gridKey, newNum);
await InvokeAsync(ReloadData);
}
protected void SetPage(int newNum)
@@ -161,11 +164,9 @@ namespace MagMan.UI.Components
#region Private Fields
private AliasModel? CurrItem = null;
private string currSearch = "";
private int filtType = 0;
private string gridKey = "AliasMan";
private List<AliasModel>? ListRecords = null;
private int MaterialId = 0;
@@ -215,7 +216,6 @@ namespace MagMan.UI.Components
private async Task ReloadData()
{
isLoading = true;
//await InvokeAsync(StateHasChanged);
ListRecords = null;
SearchRecords = await TService.AliasGetFilt(KeyNum, "MatCode");
// se voglio solo attivi --> filtro
@@ -234,7 +234,6 @@ namespace MagMan.UI.Components
totalCount = SearchRecords.Count;
SortTable();
isLoading = false;
//await InvokeAsync(StateHasChanged);
}
private void SortTable()
+11 -2
View File
@@ -109,16 +109,25 @@ namespace MagMan.UI.Components
rLim = Configuration.GetValue<double>("OptConf:projProgRLim");
}
private string gridKey = "ProjectMan";
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
protected void SetNumRec(int newNum)
protected override async Task OnAfterRenderAsync(bool firstRender)
{
numRecord = await AppMService.NumRowGridGet(gridKey);
}
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
currPage = 1;
InvokeAsync(ReloadData);
await AppMService.NumRowGridSet(gridKey, newNum);
await InvokeAsync(ReloadData);
}
protected void SetPage(int newNum)
+9 -5
View File
@@ -85,6 +85,11 @@ namespace MagMan.UI.Components
await ReloadData();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
numRecord = await AppMService.NumRowGridGet(gridKey);
}
protected override void OnInitialized()
{
currSearch = "";
@@ -97,11 +102,12 @@ namespace MagMan.UI.Components
await ReloadData();
}
protected void SetNumRec(int newNum)
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
currPage = 1;
InvokeAsync(ReloadData);
await AppMService.NumRowGridSet(gridKey, newNum);
await InvokeAsync(ReloadData);
}
protected void SetPage(int newNum)
@@ -123,11 +129,9 @@ namespace MagMan.UI.Components
#region Private Fields
private ResourceExpDTO? CurrItem = null;
private string currSearch = "";
private int filtType = 0;
private string gridKey = "ResAct";
private List<ResourceExpDTO>? ListRecords = null;
private int ResourceId = 0;
+9 -5
View File
@@ -84,6 +84,11 @@ namespace MagMan.UI.Components
await ReloadData();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
numRecord = await AppMService.NumRowGridGet(gridKey);
}
protected override void OnInitialized()
{
currSearch = "";
@@ -96,11 +101,12 @@ namespace MagMan.UI.Components
await ReloadData();
}
protected void SetNumRec(int newNum)
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
currPage = 1;
InvokeAsync(ReloadData);
await AppMService.NumRowGridSet(gridKey, newNum);
await InvokeAsync(ReloadData);
}
protected void SetPage(int newNum)
@@ -122,11 +128,9 @@ namespace MagMan.UI.Components
#region Private Fields
private ResourceExpDTO? CurrItem = null;
private string currSearch = "";
private int filtType = 0;
private string gridKey = "ResEstim";
private List<ResourceExpDTO>? ListRecords = null;
private int ResourceId = 0;