b0804c78e7
- fix calcolo qta - fix display - fix stored ricerca
88 lines
2.4 KiB
C#
88 lines
2.4 KiB
C#
using MagMan.Data.Admin.DbModels;
|
|
using MagMan.Data.Admin.Services;
|
|
using MagMan.Data.Tenant.DbModels;
|
|
using MagMan.Data.Tenant.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace MagMan.UI.Components
|
|
{
|
|
public partial class AliasEdit
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public AliasModel? CurrRecord { get; set; } = null;
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_update { get; set; }
|
|
|
|
[Parameter]
|
|
public int KeyNum { get; set; } = 0;
|
|
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected TenantService TService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task DoCancel()
|
|
{
|
|
await EC_update.InvokeAsync(true);
|
|
}
|
|
|
|
protected string textActive
|
|
{
|
|
get
|
|
{
|
|
string answ = "ND";
|
|
if (CurrRecord != null)
|
|
{
|
|
answ = CurrRecord.IsActive ? "Attivo" : "Eliminato";
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
protected async Task DoSave()
|
|
{
|
|
bool fatto = false;
|
|
await Task.Delay(1);
|
|
if (CurrRecord != null)
|
|
{
|
|
fatto = await TService.AliasUpsert(KeyNum, CurrRecord);
|
|
}
|
|
if (fatto)
|
|
{
|
|
await EC_update.InvokeAsync(true);
|
|
}
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
private List<string> ListAliasTarget { get; set; } = new List<string>();
|
|
private List<Core.DTO.MaterialDTO> AllMaterials { get; set; } = new List<Core.DTO.MaterialDTO>();
|
|
protected async Task ReloadData()
|
|
{
|
|
// rileggo TUTTI i materiali
|
|
AllMaterials = await TService.MaterialDtoGetAll(KeyNum, false, false);
|
|
// proietto elenco alias ammissibili
|
|
ListAliasTarget = AllMaterials
|
|
.GroupBy(x => x.MatCode)
|
|
.Select(grp => grp.First())
|
|
.OrderBy(x => x.MatCode)
|
|
.Select(x => x.MatCode)
|
|
.ToList();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |