From e1ba4013532eb0b0681bc04b7f1f83ffc50e54a0 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Thu, 22 Jan 2026 14:46:39 +0100 Subject: [PATCH] Gestito parametro di ingresso lista Profili --- Test.UI/Components/Pages/EditJWD.razor | 1 + Test.UI/Components/Pages/EditJWD.razor.cs | 82 +++++++++++++++++-- WebWindowComplex/DTO/BaseListPayload.cs | 10 ++- WebWindowComplex/DTO/SelectPayload.cs | 14 ++++ WebWindowComplex/Models/Frame.cs | 10 ++- WebWindowComplex/Models/Window.cs | 9 +- WebWindowComplex/TableComp.razor.cs | 29 +++++-- WebWindowComplex/WebWindowComplex.csproj | 14 +++- .../WebWindowConfigurator.csproj | 18 +++- 9 files changed, 158 insertions(+), 29 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor b/Test.UI/Components/Pages/EditJWD.razor index 73d836c..db522c4 100644 --- a/Test.UI/Components/Pages/EditJWD.razor +++ b/Test.UI/Components/Pages/EditJWD.razor @@ -69,6 +69,7 @@ protected BaseListPayload SetupList = new BaseListPayload(); + /// + /// Configurazione selezionati + /// + protected SelectPayload SelectList = new SelectPayload(); + #endregion Protected Fields #region Protected Properties @@ -65,7 +71,8 @@ namespace Test.UI.Components.Pages { new string("White"), new string("Black"), - new string("Blu") + new string("Blu"), + new string("Wood") }; protected List AvailFamilyHardwareList { get; set; } = new List() @@ -92,18 +99,68 @@ namespace Test.UI.Components.Pages new string("Abete") }; - protected List AvailProfileList { get; set; } = new List() + protected List AvailProfileListOld { get; set; } = new List() { new string("Profilo78"), new string("ProfiloSaomad") }; - protected Dictionary> AvailThreshold { get; set; } = new Dictionary>() + protected Dictionary> AvailThresholdOld { get; set; } = new Dictionary>() { {"Profilo78", new List() { new Threshold(3, "Bottom"), new Threshold(1, "Threshold")}}, {"ProfiloSaomad", new List(){ new Threshold(3, "Bottom"), new Threshold(2, "BottomWaterdrip"), new Threshold(1, "Threshold")}} }; + /// + /// Lista profili da DB + /// + private List AvailProfileList = new List(); + + + private List ThresholdProfilo78 = new List() + { + { new Threshold(3, "Bottom") }, + { new Threshold(1, "Threshold") } + }; + + private List ThresholdProfiloSaomad = new List() + { + { new Threshold(3, "Bottom") }, + { new Threshold(2, "BottomWaterdrip") }, + { new Threshold(1, "Threshold") } + }; + + private Dictionary ParamProfilo78 = new Dictionary() + { + {"Frame_BottomRail_Overlap", 33.2}, + {"Frame_Fill_Rail_DimMax", 85}, + {"Frame_Fill_Rail_DimMin", 70}, + {"Frame_Fill_Rail_DimStd", 72}, + {"Frame_Fixed_Bottom_DimMax", 80}, + {"Frame_Fixed_Bottom_DimMin", 70}, + {"Frame_Fixed_Bottom_DimStd", 78}, + {"Frame_Fixed_Top_DimMax", 80}, + {"Frame_Fixed_Top_DimMin", 70}, + {"Frame_Fixed_Top_DimStd", 78} + }; + + private Dictionary ParamProfiloSaomad = new Dictionary() + { + {"Frame_Frame_Split_DimMax", 85}, + {"Frame_Frame_Split_DimMin", 55}, + {"Frame_Frame_Split_DimStd", 60}, + {"Frame_Mixed_Bottom_DimMax", 80}, + {"Frame_Mixed_Bottom_DimMin", 70}, + {"Frame_Mixed_Bottom_DimStd", 78}, + {"Frame_Mixed_Split_DimMax", 110}, + {"Frame_Mixed_Split_DimMin", 70}, + {"Frame_Mixed_Split_DimStd", 90}, + {"Frame_Mixed_Top_DimMax", 80}, + {"Frame_Mixed_Top_DimMin", 70}, + {"Frame_Mixed_Top_DimStd", 78}, + {"Frame_Rail_Bottom_DimMax", 80} + }; + [Inject] protected IConfiguration Config { get; set; } = null!; @@ -150,6 +207,20 @@ namespace Test.UI.Components.Pages currJwd = InitialJwd; // rileggo altri dati await ReloadData(); + // costruisco lista profili + ProfilePayload pp1 = new ProfilePayload() + { + ProfileName = "Profilo78", + ThresholdList = ThresholdProfilo78, + ParameterDict = ParamProfilo78 + }; + ProfilePayload pp2 = new ProfilePayload() + { + ProfileName = "ProfiloSaomad", + ThresholdList = ThresholdProfiloSaomad, + ParameterDict = ParamProfiloSaomad + }; + AvailProfileList = new List { pp1, pp2 }; // preparo conf oggetti x controllo SetupList = new BaseListPayload() { @@ -158,8 +229,9 @@ namespace Test.UI.Components.Pages Glass = AvailGlassList, Hardware = AvailHardwareList, Material = AvailMaterialList, - Profile = AvailProfileList, - Threshold = AvailThreshold + ProfileList = AvailProfileList, + Profile = AvailProfileListOld, + Threshold = AvailThresholdOld }; CurrData = new LivePayload() { diff --git a/WebWindowComplex/DTO/BaseListPayload.cs b/WebWindowComplex/DTO/BaseListPayload.cs index 68891d9..01be0b6 100644 --- a/WebWindowComplex/DTO/BaseListPayload.cs +++ b/WebWindowComplex/DTO/BaseListPayload.cs @@ -67,9 +67,10 @@ namespace WebWindowComplex.DTO 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 profileOK = ProfileList != null && ProfileList.Count > 0; + bool profileOKOld = Profile != null && Profile.Count > 0; bool thresholdOK = Threshold != null && Threshold.Count > 0; - return famHwOK && glassOK && hwOK && colorOK && matOK && profileOK && thresholdOK; + return famHwOK && glassOK && hwOK && colorOK && matOK && profileOK; } /// /// Verifica che Payload sia almeno parzialmente popolato @@ -82,9 +83,10 @@ namespace WebWindowComplex.DTO 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 profileOK = ProfileList != null && ProfileList.Count > 0; + bool profileOKOld = Profile != null && Profile.Count > 0; bool thresholdOK = Threshold != null && Threshold.Count > 0; - return famHwOK || glassOK || hwOK || colorOK || matOK || profileOK || thresholdOK; + return famHwOK || glassOK || hwOK || colorOK || matOK || profileOK; } } } diff --git a/WebWindowComplex/DTO/SelectPayload.cs b/WebWindowComplex/DTO/SelectPayload.cs index f297485..466b2e0 100644 --- a/WebWindowComplex/DTO/SelectPayload.cs +++ b/WebWindowComplex/DTO/SelectPayload.cs @@ -52,5 +52,19 @@ namespace WebWindowComplex.DTO bool profileOK = !string.IsNullOrEmpty(Profile); return famHwOK && colorOK && matOK && glassOk && profileOK; } + + /// + /// Verifica che Payload sia almeno parzialmente popolato + /// + /// + public bool IsPopulated() + { + bool famHwOK = FamilyHardware != null; + bool glassOK = Glass != null; + bool matOK = Material != null; + bool colorOK = ColorMaterial != null; + bool profileOK = Profile != null; + return famHwOK || glassOK || colorOK || matOK || profileOK; + } } } diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index e61ef58..3a88dec 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -12,10 +12,12 @@ namespace WebWindowComplex.Models public class Frame : Area { #region Public Fields - // Lista hardware completa passata dal chiamante del componente - public static Dictionary> m_AllThresholdList = new Dictionary>(); + public static Dictionary> m_AllThresholdListOld = new Dictionary>(); + // Lista soglie completa passata dal chiamante del componente + public static List m_AllThresholdList = new List(); + #endregion Public Fields #region Public Constructors @@ -361,7 +363,7 @@ namespace WebWindowComplex.Models public void RefreshThresholdList() { m_ThresholdList.Clear(); - m_ThresholdList = m_AllThresholdList.GetValueOrDefault(ParentWindow.sProfilePath); + m_ThresholdList = m_AllThresholdList; } public double HeightFrame() @@ -413,7 +415,7 @@ namespace WebWindowComplex.Models newFrame.RefreshThresholdList(); if (m_AllThresholdList != null && m_AllThresholdList.Any()) { - newFrame.SetSelThresholdFromName(m_AllThresholdList.GetValueOrDefault(Window.sProfilePath)?.FirstOrDefault()?.Name ?? ""); + newFrame.SetSelThresholdFromName(m_AllThresholdList.FirstOrDefault().Name ?? ""); } //newFrame.FrameArcElem = null; return newFrame; diff --git a/WebWindowComplex/Models/Window.cs b/WebWindowComplex/Models/Window.cs index 593460a..d4a59cd 100644 --- a/WebWindowComplex/Models/Window.cs +++ b/WebWindowComplex/Models/Window.cs @@ -17,13 +17,12 @@ namespace WebWindowComplex.Models { public class Window { - #region Public Events + #region Public Fields - //public event EventHandler OnPreview = delegate { }; - //public event EventHandler OnReqShape = delegate { }; - //public event EventHandler OnReqHwOption = delegate { }; + // Lista dei parametri del profilo passata dal chiamante del componente + public static Dictionary m_ParameterList = new Dictionary(); - #endregion Public Events + #endregion Public Fields #region Public Properties diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 3122280..85ac460 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -52,7 +52,7 @@ namespace WebWindowComplex /// Preselezione valori /// [Parameter] - public SelectPayload? CurrSelection { get; set; } = null; + public SelectPayload? SelectionData { get; set; } = null; /// /// Richiesta azione al parent @@ -557,6 +557,7 @@ namespace WebWindowComplex try { WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + UpdateInputList(WindowFromJson); setCurrWindow(WindowFromJson); //SOLO SE non sono in edit... if (!editLock) @@ -748,18 +749,28 @@ namespace WebWindowComplex /// /// Metodo per settare i parmateri di ingresso selezionati /// - protected void UpdateSelParameter() + protected void UpdateInputList(JsonWindow WindowFromJson) { - Frame.m_AllThresholdList = ListPayload.Threshold; + //Frame.m_AllThresholdList = ListPayload.Threshold; + string profile = WindowFromJson.ProfilePath; + Window.m_ParameterList = ListPayload.ProfileList.FirstOrDefault(x => x.ProfileName.Equals(profile)).ParameterDict; + Frame.m_AllThresholdList = ListPayload.ProfileList.FirstOrDefault(x => x.ProfileName.Equals(profile)).ThresholdList; Sash.m_HardwareCompleteList = ListPayload.Hardware; Sash.s_FamilyHardwareList = ListPayload.FamilyHardware; - if (CurrSelection != null && CurrSelection.IsValid()) + } + + /// + /// Metodo per settare i parmateri di ingresso selezionati + /// + protected void UpdateSelParameter() + { + if (SelectionData != null && SelectionData.IsValid()) { - SelFamilyHardware = CurrSelection.FamilyHardware ?? ""; - SelColorMaterial = CurrSelection.ColorMaterial ?? ""; - SelMaterial = CurrSelection.Material ?? ""; - SelGlass = CurrSelection.Glass ?? ""; - SelProfile = CurrSelection.Profile ?? ""; + SelFamilyHardware = SelectionData.FamilyHardware ?? ""; + SelColorMaterial = SelectionData.ColorMaterial ?? ""; + SelMaterial = SelectionData.Material ?? ""; + SelGlass = SelectionData.Glass ?? ""; + SelProfile = SelectionData.Profile ?? ""; } } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 1f13b6e..d624666 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.8.1.2209 + 2.8.1.2214 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -42,6 +42,18 @@ + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 86c538d..b75e24e 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.8.1.2209 + 2.8.1.2214 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -57,6 +57,22 @@ + + + + + + + + + + + + + + + +