Files
2026-01-16 15:10:19 +01:00

77 lines
2.7 KiB
C#

using Egw.Window.Data;
namespace WebWindowTest.DTO
{
/// <summary>
/// Payload complessivo delle anagrafiche necessarie x Window
/// </summary>
public class BaseListPayload
{
/// <summary>
/// Elenco Famiglie HW in formato DTO
/// </summary>
public List<string> FamilyHardware { get; set; } = null!;
/// <summary>
/// Elenco HW
/// </summary>
public List<Hardware> Hardware { get; set; } = null!;
/// <summary>
/// Elenco colori
/// </summary>
public List<string> ColorMaterial { get; set; } = null!;
/// <summary>
/// Elenco Materiali impiegabili
/// </summary>
public List<string> Material { get; set; } = null!;
/// <summary>
/// Elenco vetri ammessi
/// </summary>
public List<string> Glass { get; set; } = null!;
/// <summary>
/// Elenco profili ammessi
/// </summary>
public List<string> Profile { get; set; } = null!;
/// <summary>
/// Elenco profili ammessi
/// </summary>
public Dictionary<string,List<Threshold>> Threshold { get; set; } = null!;
/// <summary>
/// Verifica di validità dell'intero Payload
/// </summary>
/// <returns></returns>
public bool IsValid()
{
bool famHwOK = FamilyHardware != null && FamilyHardware.Count > 0;
bool hwOK = Hardware != null && Hardware.Count > 0;
bool glassOK = Glass != null && Glass.Count > 0;
bool matOK = Material != null && Material.Count > 0;
bool colorOK = ColorMaterial != null && ColorMaterial.Count > 0;
bool profileOK = Profile != null && Profile.Count > 0;
bool thresholdOK = Threshold != null && Threshold.Count > 0;
return famHwOK && glassOK && hwOK && colorOK && matOK && profileOK && thresholdOK;
}
/// <summary>
/// Verifica che Payload sia almeno parzialmente popolato
/// </summary>
/// <returns></returns>
public bool IsPopulated()
{
bool famHwOK = FamilyHardware != null && FamilyHardware.Count > 0;
bool hwOK = Hardware != null && Hardware.Count > 0;
bool glassOK = Glass != null && Glass.Count > 0;
bool matOK = Material != null && Material.Count > 0;
bool colorOK = ColorMaterial != null && ColorMaterial.Count > 0;
bool profileOK = Profile != null && Profile.Count > 0;
bool thresholdOK = Threshold != null && Threshold.Count > 0;
return famHwOK || glassOK || hwOK || colorOK || matOK || profileOK || thresholdOK;
}
}
}