Files
magman/MagMan.UI/Pages/Alias.razor.cs
T
Samuele Locatelli 8959cb0751 Update gestione Alias
2024-02-22 16:20:51 +01:00

89 lines
2.3 KiB
C#

// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this
// file to you under the MIT license.
using MagMan.Core.Services;
using MagMan.Data.Admin.Services;
using MagMan.Data.Tenant.DbModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
namespace MagMan.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, User")]
public partial class Alias
{
#region Public Methods
public void Dispose()
{
AppMService.EA_CustomerSel -= AppMService_EA_CustomerSel;
AppMService.EA_KeySel -= AppMService_EA_KeySel;
}
#endregion Public Methods
#region Protected Fields
protected int nKey = 0;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; } = null!;
[Inject]
protected MTAdminService MTService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
AppMService.ShowSearch = true;
AppMService.ShowCustomers = true;
AppMService.PageName = "Alias";
AppMService.PageIcon = "fa-solid fa-tags pr-2";
AppMService.EA_CustomerSel += AppMService_EA_CustomerSel;
AppMService.EA_KeySel += AppMService_EA_KeySel;
CustomerID = AppMService.CustomerID;
nKey = AppMService.KeyNum;
// rileggo dati
await ReloadData();
}
#endregion Protected Methods
#region Private Properties
private int CustomerID { get; set; } = 0;
private bool isLoading { get; set; } = false;
#endregion Private Properties
#region Private Methods
private async void AppMService_EA_CustomerSel()
{
CustomerID = AppMService.CustomerID;
await InvokeAsync(StateHasChanged);
}
private async void AppMService_EA_KeySel()
{
nKey = AppMService.KeyNum;
await InvokeAsync(StateHasChanged);
}
private async Task ReloadData()
{
isLoading = true;
await Task.Delay(50);
isLoading = false;
}
#endregion Private Methods
}
}