using GPW.CORE.Data.DbModels; using GPW.CORE.UI.Data; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; namespace GPW.CORE.UI.Components { public partial class FasiSearch { #region Protected Fields protected string _gruppoSel = ""; protected int _idxProj = 0; protected bool vetoUpd = false; #endregion Protected Fields #region Public Fields public int idxFase = 0; #endregion Public Fields #region Private Properties [Inject] private MessageService AppMServ { get; set; } [Inject] private IJSRuntime JSRuntime { get; set; } #endregion Private Properties #region Protected Properties protected List fasiList { get; set; } = new List(); [Inject] protected GpwDataService GDataServ { get; set; } protected List gruppiList { get; set; } = new List(); protected List projList { get; set; } = new List(); #endregion Protected Properties #region Public Properties public string gruppoSel { get { return _gruppoSel; } set { _gruppoSel = value; if (!vetoUpd) { var pUpd = Task.Run(async () => await ReloadData()); pUpd.Wait(); } } } public int idxProj { get { return _idxProj; } set { _idxProj = value; if (!vetoUpd) { var pUpd = Task.Run(async () => await ReloadData()); pUpd.Wait(); } } } [Parameter] public EventCallback ItemSelected { get; set; } #endregion Public Properties #region Protected Methods protected override async Task OnInitializedAsync() { await ReloadData(); } protected async Task ReloadData() { gruppiList = await GDataServ.AnagGruppiAll(); var allProj = await GDataServ.AnagProjAll(); projList = allProj.Where(x => x.Attivo == true && x.Gruppo == gruppoSel).OrderBy(x => x.ClienteNav.RagSociale).ThenBy(x => x.NomeProj).ToList(); var allFasi = await GDataServ.AnagFasiAll(); fasiList = allFasi.Where(x => x.IdxProgetto == idxProj && x.Attivo == true).ToList(); } protected async Task SelectRecord() { await ItemSelected.InvokeAsync(idxFase); } #endregion Protected Methods } }