Files
2026-03-30 13:19:40 +02:00

173 lines
4.4 KiB
C#

using Microsoft.AspNetCore.Components;
using WebWindowComplex.DTO;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class General
{
#region Public Properties
/// <summary>
/// Finestra corrente
/// </summary>
[Parameter]
public Window CurrWindow { get; set; } = null!;
[Parameter]
public bool User { get; set; } = false!;
[Parameter]
public EventCallback<DataUpdateGeneral> EC_UpdateGeneral { get; set; }
[Parameter]
public EventCallback<bool> EC_ReqClose { get; set; }
/// <summary>
/// Elenco anagrafiche di base
/// </summary>
[Parameter]
public BaseListPayload ListPayload { get; set; } = null!;
/// <summary>
/// Elenco Warnings attivi
/// </summary>
[Parameter]
public Dictionary<string, string> ListWarnings { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Elenco domande pendenti
/// </summary>
[Parameter]
public Dictionary<string, string> DictPendReq { get; set; } = new Dictionary<string, string>();
#endregion Public Properties
#region Protected Properties
/// <summary>
/// Colore corrente
/// </summary>
protected string CurrColor
{
get => currColor;
set
{
currColor = value;
var args = new DataUpdateGeneral
{
Color = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Vetro corrente
/// </summary>
protected string CurrGlass
{
get => currGlass;
set
{
currGlass = value;
var args = new DataUpdateGeneral
{
Glass = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Materiale corrente
/// </summary>
protected string CurrWood
{
get => currWood;
set
{
currWood = value;
var args = new DataUpdateGeneral
{
Wood = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Profilo corrente
/// </summary>
protected string CurrProfile
{
get => currProfile;
set
{
currProfile = value;
var args = new DataUpdateGeneral
{
Profile = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Calcola CSS warning
/// </summary>
/// <param name="fKey"></param>
/// <returns></returns>
protected string cssValid(string fKey)
{
string ans = "";
if (ListWarnings != null && DictPendReq != null &&
(ListWarnings.ContainsKey(fKey) || DictPendReq.ContainsKey(fKey)))
ans = "border border-danger";
else
ans = "";
return ans;
}
protected override void OnParametersSet()
{
currColor = CurrWindow.sColorMaterial;
currGlass = CurrWindow.sGlass;
currWood = CurrWindow.sWood;
currProfile = CurrWindow.sProfilePath;
}
#endregion Protected Methods
#region Private Fields
private string currColor = "";
private string currGlass = "";
private string currWood = "";
private string currProfile = "";
#endregion Private Fields
private void ReqClose()
{
_ = EC_ReqClose.InvokeAsync(true);
}
}
/// <summary>
/// Classe per aggiornamento dati general
/// </summary>
public class DataUpdateGeneral
{
public string Color { get; set; } = "";
public string Glass { get; set; } = "";
public string Wood { get; set; } = "";
public string Profile { get; set; } = "";
}
}