diff --git a/Lux.UI/Components/Compo/Generic/GenValMan.razor.cs b/Lux.UI/Components/Compo/Generic/GenValMan.razor.cs index de09a1cc..ecfb8eec 100644 --- a/Lux.UI/Components/Compo/Generic/GenValMan.razor.cs +++ b/Lux.UI/Components/Compo/Generic/GenValMan.razor.cs @@ -59,30 +59,77 @@ namespace Lux.UI.Components.Compo.Generic #endregion Public Classes - #region Protected Fields - - protected List AllRecords = new List(); - protected List ListRecords = new List(); - - #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 AllRecords = new List(); + + private int currPage = 1; + + private GenValueModel? EditRecord = null; + + private bool isLoading = false; + + private List ListRecords = new List(); + + 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(); + } + /// /// Clona record /// /// - 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 /// /// - protected async Task DoDelete(GenValueModel selRec) + private async Task DoDelete(GenValueModel selRec) { if (!await JSRuntime.InvokeAsync("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 /// /// - protected void DoEdit(GenValueModel curRec) + private void DoEdit(GenValueModel curRec) { EditRecord = curRec; } @@ -134,82 +181,11 @@ namespace Lux.UI.Components.Compo.Generic /// /// Reset selezione /// - protected void DoReset() + private void DoReset() { EditRecord = null; } - /// - /// Selezione articolo x display info - /// - /// - 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; } + /// + /// Selezione articolo x display info + /// + /// + private void DoSelect(GenValueModel curRec) + { + SelRecord = curRec; + } + /// /// Esegue spostamento /// @@ -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(); + } + /// /// Filtro e paginazione /// diff --git a/Lux.UI/Components/Pages/GenList.razor.cs b/Lux.UI/Components/Pages/GenList.razor.cs index 0165d74c..916d61a6 100644 --- a/Lux.UI/Components/Pages/GenList.razor.cs +++ b/Lux.UI/Components/Pages/GenList.razor.cs @@ -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 ListGenClass = new List(); + 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 ListGenClass = new List(); + + #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;