using Microsoft.AspNetCore.Components;
using WebWindowComplex.DTO;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class General
{
#region Public Properties
///
/// Finestra corrente
///
[Parameter]
public Window CurrWindow { get; set; } = null!;
[Parameter]
public EventCallback EC_UpdateGeneral { get; set; }
[Parameter]
public EventCallback EC_ReqClose { get; set; }
///
/// Elenco anagrafiche di base
///
[Parameter]
public BaseListPayload ListPayload { get; set; } = null!;
///
/// Elenco Warnings attivi
///
[Parameter]
public Dictionary ListWarnings { get; set; } = new Dictionary();
#endregion Public Properties
#region Protected Properties
///
/// Colore corrente
///
protected string CurrColor
{
get => currColor;
set
{
currColor = value;
var args = new DataUpdateGeneral
{
Color = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
///
/// Vetro corrente
///
protected string CurrGlass
{
get => currGlass;
set
{
currGlass = value;
var args = new DataUpdateGeneral
{
Glass = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
///
/// Materiale corrente
///
protected string CurrMaterial
{
get => currMaterial;
set
{
currMaterial = value;
var args = new DataUpdateGeneral
{
Material = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
///
/// Profilo corrente
///
protected string CurrProfile
{
get => currProfile;
set
{
currProfile = value;
var args = new DataUpdateGeneral
{
Profile = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
#endregion Protected Properties
#region Protected Methods
///
/// Calcola CSS warning
///
///
///
protected string cssValid(string fKey)
{
return ListWarnings.ContainsKey(fKey) ? "border border-danger" : "";
}
protected override void OnParametersSet()
{
currColor = CurrWindow.sColorMaterial;
currGlass = CurrWindow.sGlass;
currMaterial = CurrWindow.sMaterial;
currProfile = CurrWindow.sProfilePath;
}
#endregion Protected Methods
#region Private Fields
private string currColor = "";
private string currGlass = "";
private string currMaterial = "";
private string currProfile = "";
#endregion Private Fields
private void ReqClose()
{
_ = EC_ReqClose.InvokeAsync(true);
}
}
///
/// Classe per aggiornamento dati general
///
public class DataUpdateGeneral
{
public string Color { get; set; } = "";
public string Glass { get; set; } = "";
public string Material { get; set; } = "";
public string Profile { get; set; } = "";
}
}