Files
lux/Lux.UI/Components/Compo/OfferMan.razor.cs
T
2026-03-05 10:12:13 +01:00

89 lines
2.3 KiB
C#

using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.Services;
using Microsoft.AspNetCore.Components;
using System.Threading.Tasks;
namespace Lux.UI.Components.Compo
{
/// <summary>
/// Componente per la gestione delle offerte.
/// </summary>
public partial class OfferMan
{
#region Public Properties
/// <summary>
/// Modello dell'offerta corrente (bindato dal genitore).
/// </summary>
[Parameter]
public OfferModel CurrRecord { get; set; } = null!;
/// <summary>
/// Callback invocato al chiusura della finestra (con valore <c>true</c> per cancellazione).
/// </summary>
[Parameter]
public EventCallback<bool> EC_Close { get; set; }
/// <summary>
/// Callback invocato al salvataggio con l'offerta aggiornata.
/// </summary>
[Parameter]
public EventCallback<OfferModel> EC_Updated { get; set; }
#endregion Public Properties
#region Protected Properties
/// <summary>
/// Servizi di accesso ai dati iniettati dal framework.
/// </summary>
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Chiamato automaticamente all'inizializzazione del componente.
/// </summary>
protected override void OnInitialized()
{
ReloadData();
}
#endregion Protected Methods
#region Private Fields
/// <summary>
/// Lista di tutti i clienti caricati.
/// </summary>
private List<CustomerModel> CustomersList = new List<CustomerModel>();
private List<DealerModel> DealersList = new List<DealerModel>();
#endregion Private Fields
#region Private Methods
private Task DoCancel()
{
return EC_Close.InvokeAsync(true);
}
private Task DoSave()
{
// richiesta update con salvataggio record
return EC_Updated.InvokeAsync(CurrRecord);
}
private void ReloadData()
{
CustomersList = DLService.CustomersGetAll();
DealersList = DLService.DealersGetAll();
}
#endregion Private Methods
}
}