using Liman.CadCam.DbModel; using Liman.CadCam.Services; using LiMan.UI.Data; using Microsoft.AspNetCore.Components; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace LiMan.UI.Components { public partial class SearchLicCadCam : IDisposable { #region Public Properties public string searchVal { get; set; } = ""; #endregion Public Properties #region Protected Properties [Inject] protected MessageService AppMessages { get; set; } = null!; #endregion Protected Properties #region Protected Methods protected override void OnInitialized() { AppMessages.EA_SearchUpdated += AppMessages_EA_SearchUpdated; } public void Dispose() { AppMessages.EA_SearchUpdated -= AppMessages_EA_SearchUpdated; } #endregion Protected Methods #region Private Methods private void AppMessages_EA_SearchUpdated() { ReloadData(); } protected override async Task OnInitializedAsync() { ListProd = await CCService.ProductsGetAll(); ListProd = ListProd.OrderBy(x => x.ProductName).ToList(); } [Inject] protected CadCamService CCService { get; set; } = null!; private List ListProd { get; set; } = new List(); private void ReloadData() { isLoading = true; if (searchVal != AppMessages.SearchVal) { searchVal = AppMessages.SearchVal; } isLoading = false; InvokeAsync(StateHasChanged); } private bool isLoading = false; #endregion Private Methods protected int SelProdId { get; set; } = 0; protected string SelLockId { get; set; } = ""; private void reset() { SelLockId = ""; } protected void SetLockId(string lockId) { SelLockId = lockId; } } }