Files
limanapp/LiMan.UI/Components/SearchLicCadCam.razor.cs
T
Samuele Locatelli 7974b9c2a9 Fix search licenze
2024-07-15 17:58:44 +02:00

87 lines
2.1 KiB
C#

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<ProductModel> ListProd { get; set; } = new List<ProductModel>();
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;
}
}
}