Fix GenValMan/GenList
This commit is contained in:
@@ -59,30 +59,77 @@ namespace Lux.UI.Components.Compo.Generic
|
||||
|
||||
#endregion Public Classes
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected List<GenValueModel> AllRecords = new List<GenValueModel>();
|
||||
protected List<GenValueModel> ListRecords = new List<GenValueModel>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IGenValService GVService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!SelFilt.Equals(actFilt) || true)
|
||||
{
|
||||
actFilt = SelFilt;
|
||||
await ReloadDataAsync();
|
||||
UpdateTable();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private FiltSelect actFilt = new FiltSelect();
|
||||
|
||||
private List<GenValueModel> AllRecords = new List<GenValueModel>();
|
||||
|
||||
private int currPage = 1;
|
||||
|
||||
private GenValueModel? EditRecord = null;
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
private List<GenValueModel> ListRecords = new List<GenValueModel>();
|
||||
|
||||
private int numRecord = 10;
|
||||
|
||||
private GenValueModel? SelRecord = null;
|
||||
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IGenValService GVService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private Task DoAdd()
|
||||
{
|
||||
// aggiungo un nuovo record in coda...
|
||||
EditRecord = new GenValueModel()
|
||||
{
|
||||
ClassCod = actFilt.SelCodGroup,
|
||||
ValString = $"Nuovo-{DateTime.Now:yy.MM.ss HH.mm.ss}",
|
||||
Index = totalCount + 1
|
||||
};
|
||||
return DoSave(EditRecord);
|
||||
}
|
||||
|
||||
private async Task DoCancel()
|
||||
{
|
||||
await ResetEdit();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clona record
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
protected void DoClone(GenValueModel curRec)
|
||||
private void DoClone(GenValueModel curRec)
|
||||
{
|
||||
#if false
|
||||
editRecord = new ItemModel()
|
||||
@@ -108,7 +155,7 @@ namespace Lux.UI.Components.Compo.Generic
|
||||
/// impossta record x eliminazione
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
protected async Task DoDelete(GenValueModel selRec)
|
||||
private async Task DoDelete(GenValueModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ClassCod} | {selRec.ValString}"))
|
||||
return;
|
||||
@@ -126,7 +173,7 @@ namespace Lux.UI.Components.Compo.Generic
|
||||
/// Edit articolo selezionato
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
protected void DoEdit(GenValueModel curRec)
|
||||
private void DoEdit(GenValueModel curRec)
|
||||
{
|
||||
EditRecord = curRec;
|
||||
}
|
||||
@@ -134,82 +181,11 @@ namespace Lux.UI.Components.Compo.Generic
|
||||
/// <summary>
|
||||
/// Reset selezione
|
||||
/// </summary>
|
||||
protected void DoReset()
|
||||
private void DoReset()
|
||||
{
|
||||
EditRecord = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione articolo x display info
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
protected void DoSelect(GenValueModel curRec)
|
||||
{
|
||||
SelRecord = curRec;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!SelFilt.Equals(actFilt) || true)
|
||||
{
|
||||
actFilt = SelFilt;
|
||||
await ReloadDataAsync();
|
||||
UpdateTable();
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private FiltSelect actFilt = new FiltSelect();
|
||||
|
||||
private int currPage = 1;
|
||||
|
||||
private GenValueModel? EditRecord = null;
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
private int numRecord = 10;
|
||||
|
||||
private GenValueModel? SelRecord = null;
|
||||
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private Task DoAdd()
|
||||
{
|
||||
// aggiungo un nuovo record in coda...
|
||||
EditRecord = new GenValueModel()
|
||||
{
|
||||
ClassCod = actFilt.SelCodGroup,
|
||||
ValString = $"Nuovo-{DateTime.Now:yy.MM.ss HH.mm.ss}",
|
||||
Index = totalCount + 1
|
||||
};
|
||||
return DoSave(EditRecord);
|
||||
}
|
||||
|
||||
private async Task DoCancel()
|
||||
{
|
||||
await ResetEdit();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
private async Task DoSave(GenValueModel currRec)
|
||||
{
|
||||
// salvo
|
||||
@@ -220,6 +196,15 @@ namespace Lux.UI.Components.Compo.Generic
|
||||
SelRecord = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione articolo x display info
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
private void DoSelect(GenValueModel curRec)
|
||||
{
|
||||
SelRecord = curRec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue spostamento
|
||||
/// </summary>
|
||||
@@ -262,6 +247,18 @@ namespace Lux.UI.Components.Compo.Generic
|
||||
return ReloadDataAsync();
|
||||
}
|
||||
|
||||
private void SaveNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
private void SavePage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filtro e paginazione
|
||||
/// </summary>
|
||||
|
||||
@@ -1,27 +1,39 @@
|
||||
using EgwCoreLib.Lux.Data.DbModel.Items;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Utils;
|
||||
using EgwCoreLib.Lux.Data.Services.Utils;
|
||||
using Lux.UI.Components.Compo;
|
||||
using Lux.UI.Components.Compo.Generic;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Lux.UI.Components.Pages
|
||||
{
|
||||
public partial class GenList
|
||||
{
|
||||
#region Protected Fields
|
||||
#region Protected Methods
|
||||
|
||||
protected List<GenClassModel> ListGenClass = new List<GenClassModel>();
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
return ReloadBaseData();
|
||||
}
|
||||
|
||||
#endregion Protected Fields
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Protected Properties
|
||||
#region Private Fields
|
||||
|
||||
protected GenValMan.FiltSelect CurrFilt { get; set; } = new GenValMan.FiltSelect();
|
||||
private ItemModel? editRecord = null;
|
||||
private bool isLoading = false;
|
||||
private List<GenClassModel> ListGenClass = new List<GenClassModel>();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private GenValMan.FiltSelect CurrFilt { get; set; } = new GenValMan.FiltSelect();
|
||||
|
||||
[Inject]
|
||||
protected IGenClassService DLService { get; set; } = null!;
|
||||
private IGenClassService DLService { get; set; } = null!;
|
||||
|
||||
protected string SearchVal
|
||||
private string SearchVal
|
||||
{
|
||||
get => CurrFilt.SearchVal;
|
||||
set
|
||||
@@ -32,7 +44,7 @@ namespace Lux.UI.Components.Pages
|
||||
}
|
||||
}
|
||||
|
||||
protected string SelCodGroup
|
||||
private string SelCodGroup
|
||||
{
|
||||
get => CurrFilt.SelCodGroup;
|
||||
set
|
||||
@@ -46,29 +58,7 @@ namespace Lux.UI.Components.Pages
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
return ReloadBaseData();
|
||||
}
|
||||
|
||||
protected void ResetSearch()
|
||||
{
|
||||
SearchVal = "";
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private ItemModel? editRecord = null;
|
||||
private bool isLoading = false;
|
||||
|
||||
#endregion Private Fields
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
@@ -84,6 +74,11 @@ namespace Lux.UI.Components.Pages
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void ResetSearch()
|
||||
{
|
||||
SearchVal = "";
|
||||
}
|
||||
|
||||
private void SaveSel(string codGroup)
|
||||
{
|
||||
SelCodGroup = codGroup;
|
||||
|
||||
Reference in New Issue
Block a user