diff --git a/Directory.Packages.props b/Directory.Packages.props index 8dc4cd3..04cf0e7 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,8 +9,8 @@ all - - + + diff --git a/Test.UI/Components/Pages/BaseEdit.razor.cs b/Test.UI/Components/Pages/BaseEdit.razor.cs index 3f03d14..73c568a 100644 --- a/Test.UI/Components/Pages/BaseEdit.razor.cs +++ b/Test.UI/Components/Pages/BaseEdit.razor.cs @@ -533,8 +533,21 @@ namespace Test.UI.Components.Pages private void updateInfoJwd(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) { - var newJwd = SerialMan.MassUpdate(currSer, newFamilyHardware, newHardware, newColorMaterial, newMaterial, newGlass, newProfile); - CurrData.CurrJwd = newJwd; + Dictionary DictParam = new Dictionary(); + if (!string.IsNullOrEmpty(newFamilyHardware)) + DictParam.Add("FamilyHardware", newFamilyHardware!); + if (!string.IsNullOrEmpty(newColorMaterial)) + DictParam.Add("Color", newColorMaterial!); + if (!string.IsNullOrEmpty(newMaterial)) + DictParam.Add("Material", newMaterial!); + if (!string.IsNullOrEmpty(newGlass)) + DictParam.Add("Glass", newGlass!); + if (!string.IsNullOrEmpty(newProfile)) + DictParam.Add("Profile", newProfile!); + var dp = SerialMan.MassUpdate(currSer, DictParam); + CurrData.CurrJwd = dp.serializeStruct; + //var newJwd = SerialMan.MassUpdate(currSer, shape, newFamilyHardware, newHardware, newColorMaterial, newMaterial, newGlass, newProfile); + //CurrData.CurrJwd = newJwd; } #endregion Private Methods diff --git a/Test.UI/Components/Pages/EditJWD.razor b/Test.UI/Components/Pages/EditJWD.razor index 177c798..425f8ca 100644 --- a/Test.UI/Components/Pages/EditJWD.razor +++ b/Test.UI/Components/Pages/EditJWD.razor @@ -4,7 +4,7 @@ EditJWD -@* + FamilyHw @@ -21,10 +21,10 @@ Color - @foreach (var item in AvailColorMaterialList) - { - @item - } + @foreach (var item in AvailColorMaterialList) + { + @item + } @@ -54,7 +54,7 @@ Profile - @foreach (var item in AvailProfileList) + @foreach (var item in DescriptionProfileList) { @item } @@ -62,10 +62,10 @@ - updateInfoJwd(CurrData.CurrJwd, familyHWMassUpdate, null, colorMassUpdate, materialMassUpdate, glassMassUpdate, profileMassUpdate)">Save + UpdateInfoJwdAsync(CurrData.CurrJwd, familyHWMassUpdate, colorMassUpdate, materialMassUpdate, glassMassUpdate, profileMassUpdate)">Save - *@ + @if (doEdit) { - /// Predisposizione valori live SVG/JWD - /// - protected LivePayload CurrData = new LivePayload(); - - protected List currElement = new List(); - - protected Dictionary currGroupShape = new Dictionary(); - - protected Dictionary currHwOption = new Dictionary(); - - protected string currJwd = "..."; - - protected Dictionary m_CurrArgs = new Dictionary(); - - protected string prevJwd = ""; - /// /// Configurazione selezionati /// @@ -64,60 +56,11 @@ namespace Test.UI.Components.Pages #region Protected Properties - protected List AvailColorMaterialList { get; set; } = new List() - { - new string("White"), - new string("Black"), - new string("Blu"), - new string("Wood") - }; - - protected List AvailFamilyHardwareList { get; set; } = new List() - { - new string("ArTech"), - new string("ArTechPlana") - }; - - protected List AvailGlassList { get; set; } = new List() - { - new string("Vetro BE 2S 4/12/4"), - new string("Vetro BE 2S 4/16/4"), - new string("Vetro BE 3S 4/12/4/12/4"), - new string("Vetro BE 3S 4/16/4/16/4"), - new string("Vetro BE 2S 4T/12/4T"), - new string("Vetro BE 2S 4T/16/4T") - }; - - protected List AvailHardwareList { get; set; } = new List(); - - protected List AvailMaterialList { get; set; } = new List() - { - new string("Pino"), - new string("Abete") - }; - - [Inject] - protected IConfiguration Config { get; set; } = null!; - - [Inject] - protected DataLayerServices DLService { get; set; } = null!; - - [Inject] - protected ImageCacheService ICService { get; set; } = null!; - protected MarkupString JsonSer { get => (MarkupString)currJwd.Replace(Environment.NewLine, "").Replace(" ", " "); } - protected string SelColorMaterial { get; set; } = ""; - - protected string SelFamilyHardware { get; set; } = ""; - - protected string SelGlass { get; set; } = ""; - - protected string SelMaterial { get; set; } = ""; - #endregion Protected Properties #region Protected Methods @@ -134,6 +77,7 @@ namespace Test.UI.Components.Pages protected override async Task OnInitializedAsync() { ConfInit(); + await ReloadBaseList(); User = false; Random random = new Random(); CalcUid = Convert.ToString(random.Next(1000, 10000)); @@ -142,21 +86,14 @@ namespace Test.UI.Components.Pages //initialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); currJwd = initialJwd; // rileggo altri dati - await ReloadData(); - // costruisco lista profili - ProfilePayload pp1 = new ProfilePayload() + //await ReloadData(); + // converto i profili nel nuovo formato x payload... + var profList = AvailProfileList.Select(x => new ProfilePayload() { - ProfileName = "Profilo78", - ThresholdList = ThresholdProfilo78, - ParameterDict = ParamProfilo78 - }; - ProfilePayload pp2 = new ProfilePayload() - { - ProfileName = "ProfiloSaomad", - ThresholdList = ThresholdProfiloSaomad, - ParameterDict = ParamProfiloSaomad - }; - AvailProfileList = new List { pp1, pp2 }; + ProfileName = x.Code, + ThresholdList = x.ThresholdList, + ParameterDict = x.ProfileDataDict + }).ToList(); // preparo conf oggetti x controllo SetupList = new BaseListPayload() { @@ -165,7 +102,7 @@ namespace Test.UI.Components.Pages Glass = AvailGlassList, Hardware = AvailHardwareList, Material = AvailMaterialList, - ProfileList = AvailProfileList + ProfileList = profList }; CurrData = new LivePayload() { @@ -174,6 +111,7 @@ namespace Test.UI.Components.Pages DictShape = currGroupShape, DictOptionsXml = currHwOption }; + DescriptionProfileList = profList.Select(x=>x.ProfileName).ToList(); DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage; DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage; @@ -182,14 +120,82 @@ namespace Test.UI.Components.Pages #endregion Protected Methods + #region Private Properties + + [Inject] + private ConfigDataService CDService { get; set; } = default!; + + [Inject] + private IConfGlassService CGService { get; set; } = null!; + + [Inject] + private IConfProfileService CPService { get; set; } = null!; + + [Inject] + private IConfWoodService CWService { get; set; } = null!; + + [Inject] + private IGenValService GVService { get; set; } = default!; + + [Inject] + private IConfiguration Config { get; set; } = null!; + + [Inject] + private DataLayerServices DLService { get; set; } = null!; + + [Inject] + private ImageCacheService ICService { get; set; } = null!; + + private string SelColorMaterial { get; set; } = ""; + + private string SelFamilyHardware { get; set; } = ""; + + private string SelGlass { get; set; } = ""; + + private string SelMaterial { get; set; } = ""; + + #endregion Private Properties + #region Private Fields + private List AllConfGlass = new(); + private List AllColors = new(); + private List AllConfHardware = new(); + private List AllConfWood = new(); + private List AvailColorMaterialList = new List(); + private List AvailFamilyHardwareList = new List(); + private List AvailGlassList = new List(); + private List AvailHardwareList = new(); + private List AvailMaterialList = new List(); + private List AvailProfileList = new(); + + private List DescriptionProfileList = new(); + + private EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS cEnvir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + + /// + /// Predisposizione valori live SVG/JWD + /// + private LivePayload CurrData = new LivePayload(); + + private List currElement = new List(); + + private Dictionary currGroupShape = new Dictionary(); + + private Dictionary currHwOption = new Dictionary(); + + private string currJwd = "..."; + + private Dictionary m_CurrArgs = new Dictionary(); + + private string prevJwd = ""; + private string apiUrl = ""; - /// - /// Lista profili da DB - /// - private List AvailProfileList = new List(); + ///// + ///// Lista profili da DB + ///// + //private List AvailProfileList = new List(); private string calcTag = ""; @@ -220,210 +226,19 @@ namespace Test.UI.Components.Pages /// private bool isInteractive = false; - //private string colorMassUpdate; - //private string familyHWMassUpdate; - //private string glassMassUpdate; - //private Hardware hardwareMassUpdate; - //private string materialMassUpdate; - //private string profileMassUpdate; + private string colorMassUpdate; + private string familyHWMassUpdate; + private string glassMassUpdate; + private Hardware hardwareMassUpdate; + private string materialMassUpdate; + private string profileMassUpdate; + private string outClose = ""; private string outSave = ""; - private Dictionary ParamProfilo78 = new Dictionary() - { - {"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}, - {"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}, - {"Frame_Rail_Bottom_DimMin", 70}, - {"Frame_Rail_Bottom_DimStd", 78}, - {"Frame_Rail_DimMax", 78}, - {"Frame_Rail_DimMin", 68}, - {"Frame_Rail_DimStd", 72}, - {"Frame_Sash_Bottom_DimMax", 80}, - {"Frame_Sash_Bottom_DimMin", 70}, - {"Frame_Sash_Bottom_DimStd", 78}, - {"Frame_Sash_Horizontal_DimMax", 110}, - {"Frame_Sash_Horizontal_DimMin", 75}, - {"Frame_Sash_Horizontal_DimStd", 95}, - {"Frame_Sash_Threshold_DimMax", 26}, - {"Frame_Sash_Threshold_DimMin", 24}, - {"Frame_Sash_Threshold_DimStd", 25}, - {"Frame_Sash_Top_DimMax", 80}, - {"Frame_Sash_Top_DimMin", 70}, - {"Frame_Sash_Top_DimStd", 78}, - {"Frame_Sash_Vertical_DimMax", 110}, - {"Frame_Sash_Vertical_DimMin", 85}, - {"Frame_Sash_Vertical_DimStd", 95}, - {"Frame_Slide_Bottom_DimMax", 60}, - {"Frame_Slide_Bottom_DimMin", 50}, - {"Frame_Slide_Bottom_DimStd", 55}, - {"Frame_Slide_Fixed_DimMax", 60}, - {"Frame_Slide_Fixed_DimMin", 50}, - {"Frame_Slide_Fixed_DimStd", 55}, - {"Frame_Slide_MovableBack_Bottom_DimMax", 60}, - {"Frame_Slide_MovableBack_Bottom_DimMin", 50}, - {"Frame_Slide_MovableBack_Bottom_DimStd", 55}, - {"Frame_Slide_MovableBack_Threshold_DimMax", 10}, - {"Frame_Slide_MovableBack_Threshold_DimMin", 3}, - {"Frame_Slide_MovableBack_Threshold_DimStd", 4}, - {"Frame_Slide_Movable_DimMax", 60}, - {"Frame_Slide_Movable_DimMin", 50}, - {"Frame_Slide_Movable_DimStd", 55}, - {"Frame_Slide_Threshold_DimMax", 10}, - {"Frame_Slide_Threshold_DimMin", 3}, - {"Frame_Slide_Threshold_DimStd", 4}, - {"Frame_Slide_Top_DimMax", 60}, - {"Frame_Slide_Top_DimMin", 50}, - {"Frame_Slide_Top_DimStd", 55}, - {"Sash_Fill_Rail_DimMax", 80}, - {"Sash_Fill_Rail_DimMin", 70}, - {"Sash_Fill_Rail_DimStd", 78}, - {"Sash_Frame_Bottom_DimMax", 80}, - {"Sash_Frame_Bottom_DimMin", 70}, - {"Sash_Frame_Bottom_DimStd", 78}, - {"Sash_Frame_Top_DimMax", 80}, - {"Sash_Frame_Top_DimMin", 70}, - {"Sash_Frame_Top_DimStd", 78}, - {"Sash_French_In_DimMax", 80}, - {"Sash_French_In_DimMin", 70}, - {"Sash_French_In_DimStd", 78}, - {"Sash_French_Out_DimMax", 80}, - {"Sash_French_Out_DimMin", 70}, - {"Sash_French_Out_DimStd", 78}, - {"Sash_Rail_Bottom_DimMax", 80}, - {"Sash_Rail_Bottom_DimMin", 70}, - {"Sash_Rail_Bottom_DimStd", 78}, - {"Sash_Rail_DimMax", 80}, - {"Sash_Rail_DimMin", 70}, - {"Sash_Rail_DimStd", 78}, - {"Sash_Sash_Active_DimMax", 80}, - {"Sash_Sash_Active_DimMin", 70}, - {"Sash_Sash_Active_DimStd", 78}, - {"Sash_Sash_Inactive_DimMax", 80}, - {"Sash_Sash_Inactive_DimMin", 70}, - {"Sash_Sash_Inactive_DimStd", 78}, - {"Sash_Sash_Split_DimMax", 70}, - {"Sash_Sash_Split_DimMin", 50}, - {"Sash_Sash_Split_DimStd", 60}, - {"Sash_Slide_Active_DimMax", 90}, - {"Sash_Slide_Active_DimMin", 70}, - {"Sash_Slide_Active_DimStd", 80}, - {"Sash_Slide_Active_In_DimMax", 90}, - {"Sash_Slide_Active_In_DimMin", 70}, - {"Sash_Slide_Active_In_DimStd", 80}, - {"Sash_Slide_Fixed_Bottom_DimMax", 150}, - {"Sash_Slide_Fixed_Bottom_DimMin", 120}, - {"Sash_Slide_Fixed_Bottom_DimStd", 135}, - {"Sash_Slide_Fixed_Side_DimMax", 90}, - {"Sash_Slide_Fixed_Side_DimMin", 70}, - {"Sash_Slide_Fixed_Side_DimStd", 80}, - {"Sash_Slide_Fixed_Top_DimMax", 90}, - {"Sash_Slide_Fixed_Top_DimMin", 70}, - {"Sash_Slide_Fixed_Top_DimStd", 80}, - {"Sash_Slide_Inactive_DimMax", 90}, - {"Sash_Slide_Inactive_DimMin", 70}, - {"Sash_Slide_Inactive_DimStd", 80}, - {"Sash_Slide_MovableBack_Bottom_DimMax", 150}, - {"Sash_Slide_MovableBack_Bottom_DimMin", 120}, - {"Sash_Slide_MovableBack_Bottom_DimStd", 135}, - {"Sash_Slide_MovableBack_Side_DimMax", 90}, - {"Sash_Slide_MovableBack_Side_DimMin", 70}, - {"Sash_Slide_MovableBack_Side_DimStd", 80}, - {"Sash_Slide_MovableBack_Top_DimMax", 90}, - {"Sash_Slide_MovableBack_Top_DimMin", 70}, - {"Sash_Slide_MovableBack_Top_DimStd", 80}, - {"Sash_Slide_Movable_Bottom_DimMax", 150}, - {"Sash_Slide_Movable_Bottom_DimMin", 120}, - {"Sash_Slide_Movable_Bottom_DimStd", 135}, - {"Sash_Slide_Movable_Side_DimMax", 90}, - {"Sash_Slide_Movable_Side_DimMin", 70}, - {"Sash_Slide_Movable_Side_DimStd", 80}, - {"Sash_Slide_Movable_Top_DimMax", 90}, - {"Sash_Slide_Movable_Top_DimMin", 70}, - {"Sash_Slide_Movable_Top_DimStd", 80}, - {"Frame_BottomRail_Overlap", 33.2}, - {"French_In_Overlap", 26}, - {"French_Out_Overlap", 26}, - {"Mixed_Bottom_Overlap", 26}, - {"Mixed_Split_Bottom_Overlap", 41}, - {"Mixed_Split_Top_Overlap", 41}, - {"Mixed_Top_Overlap", 41}, - {"NO_Mixed_Bottom_Overlap", 26}, - {"NO_Mixed_Split_Bottom_Overlap", 41}, - {"NO_Mixed_Split_Top_Overlap", 41}, - {"NO_Slide_MovableBack_Threshold_Overlap", 0}, - {"NO_Slide_Threshold_Overlap", 0}, - {"Sash_Active_Overlap", 26}, - {"Sash_Inactive_Overlap", 26}, - {"Sash_BottomRail_Overlap", 24.5}, - {"Sash_Bottom_Overlap", 26}, - {"Sash_Horizontal_Bottom_Overlap", 26}, - {"Sash_Horizontal_Top_Overlap", 41}, - {"Sash_Threshold_Overlap", 18}, - {"Sash_Top_Overlap", 41}, - {"Sash_Vertical_Overlap", 41}, - {"Slide_Active_Overlap", 80}, - {"Slide_Bottom_Overlap", 0}, - {"Slide_Fixed_Overlap", -5}, - {"Slide_MovableBack_Bottom_Overlap", 0}, - {"Slide_MovableBack_Threshold_Overlap", 0}, - {"Slide_Movable_Overlap", -5}, - {"Slide_Threshold_Overlap", 0}, - {"Slide_Top_Overlap", -12} - }; - - 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} - }; - private bool startEmpty = true; - 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 string windowUid = "CurrWindow"; #endregion Private Fields @@ -440,8 +255,7 @@ namespace Test.UI.Components.Pages } else { - return File.ReadAllText("Data\\AntaDoppiaInglesine.jwd"); - //return File.ReadAllText("Data\\AntaDoppia.jwd"); + return File.ReadAllText("Data\\AntaDoppia.jwd"); } } } @@ -450,6 +264,51 @@ namespace Test.UI.Components.Pages #region Private Methods + /// + /// Init classi configurazione + /// + /// + private async Task ReloadBaseList() + { + // lettura config setup varie da DB/Cache Redis + AllConfGlass = await CGService.GetAllAsync(); + AvailProfileList = await CPService.GetAllAsync(); + + // FixMe Todo: eliminare da REDIS e usare elenco DB solamente... + var rawProfiles = CDService.ProfileList(cEnvir, "Default"); + // se fosse vuoto chiamo update... + if (rawProfiles == null || rawProfiles.Count == 0) + { + rawProfiles = CDService.ProfileList(cEnvir, "Default"); + } + var rawHw = CDService.HwModelList(cEnvir, "HW.AGB"); + // hw filtro solo validi... + AllConfHardware = rawHw + .Where(x => !x.FamilyName.Equals(x.Description, StringComparison.OrdinalIgnoreCase)) + .ToList(); + AllConfWood = await CWService.GetAllAsync(); + AllColors = await GVService.GetFiltAsync("WoodCol"); + // conversione tipi + AvailGlassList = AllConfGlass + .Select(x => x.Description) + .ToList(); + AvailFamilyHardwareList = AllConfHardware + .DistinctBy(x => x.FamilyName) + .OrderBy(x => x.FamilyName) + .Select(x => x.FamilyName) + .ToList(); + AvailHardwareList = AllConfHardware + .Select(x => new Egw.Window.Data.Hardware(x.Id, x.FamilyName, x.Description, x.OpeningType, x.Shape, x.SashQty, x.SashPosition)) + .ToList(); + AvailMaterialList = AllConfWood + .Select(x => x.Description) + .ToList(); + AvailColorMaterialList = AllColors + .OrderBy(x => x.Index) + .Select(x => x.ValString) + .ToList(); + } + /// /// Effettua chiusura oggetto con eventuale save /// @@ -614,25 +473,6 @@ namespace Test.UI.Components.Pages await Task.Delay(1); } - /// - /// Rilettura dati - /// - /// - private Task ReloadData() - { - AvailHardwareList = new List(); - if (File.Exists(cFileHardware)) - { - string rawValHW = File.ReadAllText(cFileHardware); - var rawListHW = JsonConvert.DeserializeObject>(rawValHW) ?? new List(); - foreach (var item in rawListHW) - { - AvailHardwareList.Add(item); - } - } - return Task.Delay(100); - } - private void SetEdit(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) { doEdit = true; @@ -648,10 +488,23 @@ namespace Test.UI.Components.Pages return InvokeAsync(StateHasChanged); } - private void updateInfoJwd(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) + private async Task UpdateInfoJwdAsync(string currSer, string? newFamilyHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) { - var newJwd = SerialMan.MassUpdate(currSer, newFamilyHardware, newHardware, newColorMaterial, newMaterial, newGlass, newProfile); - CurrData.CurrJwd = newJwd; + Dictionary DictParam = new Dictionary(); + if (!string.IsNullOrEmpty(newFamilyHardware)) + DictParam.Add( "FamilyHardware", newFamilyHardware! ); + if (!string.IsNullOrEmpty(newColorMaterial)) + DictParam.Add("Color", newColorMaterial!); + if (!string.IsNullOrEmpty(newMaterial)) + DictParam.Add("Material", newMaterial!); + if (!string.IsNullOrEmpty(newGlass)) + DictParam.Add("Glass", newGlass!); + if (!string.IsNullOrEmpty(newProfile)) + DictParam.Add("Profile", newProfile!); + var dp = SerialMan.MassUpdate(currSer, DictParam); + CurrData.CurrJwd = dp.serializeStruct; + //var newJwd = SerialMan.MassUpdate(currSer, newFamilyHardware, newHardware, newColorMaterial, newMaterial, newGlass, newProfile); + //CurrData.CurrJwd = newJwd; } #endregion Private Methods diff --git a/Test.UI/Components/Pages/TestError.razor.cs b/Test.UI/Components/Pages/TestError.razor.cs index a458773..78e7347 100644 --- a/Test.UI/Components/Pages/TestError.razor.cs +++ b/Test.UI/Components/Pages/TestError.razor.cs @@ -601,8 +601,21 @@ namespace Test.UI.Components.Pages private void updateInfoJwd(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) { - var newJwd = SerialMan.MassUpdate(currSer, newFamilyHardware, newHardware, newColorMaterial, newMaterial, newGlass, newProfile); - CurrData.CurrJwd = newJwd; + Dictionary DictParam = new Dictionary(); + if (!string.IsNullOrEmpty(newFamilyHardware)) + DictParam.Add("FamilyHardware", newFamilyHardware!); + if (!string.IsNullOrEmpty(newColorMaterial)) + DictParam.Add("Color", newColorMaterial!); + if (!string.IsNullOrEmpty(newMaterial)) + DictParam.Add("Material", newMaterial!); + if (!string.IsNullOrEmpty(newGlass)) + DictParam.Add("Glass", newGlass!); + if (!string.IsNullOrEmpty(newProfile)) + DictParam.Add("Profile", newProfile!); + var dp = SerialMan.MassUpdate(currSer, DictParam); + CurrData.CurrJwd = dp.serializeStruct; + //var newJwd = SerialMan.MassUpdate(currSer, shape, newFamilyHardware, newHardware, newColorMaterial, newMaterial, newGlass, newProfile); + //CurrData.CurrJwd = newJwd; } private void RemoveParams(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) diff --git a/Test.UI/Program.cs b/Test.UI/Program.cs index f7388cb..50b6016 100644 --- a/Test.UI/Program.cs +++ b/Test.UI/Program.cs @@ -1,4 +1,6 @@ +using EgwCoreLib.Lux.Data; using EgwCoreLib.Lux.Data.Services; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using NLog; using NLog.Web; @@ -26,6 +28,20 @@ builder.Services.AddRazorComponents() // costruzione connectionMultiplexer redis... string connStr = configuration.GetConnectionString("Redis") ?? "localhost"; ConnectionMultiplexer redisConn = ConnectionMultiplexer.Connect(connStr); +// registrazione in blocco servizi con metodo extension custom +var connectionString = builder.Configuration.GetConnectionString("Lux.All") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); +builder.Services.AddDbContextFactory(options => +{ + var conn = builder.Configuration.GetConnectionString("Lux.All"); + options.UseMySql(conn, ServerVersion.AutoDetect(conn), mySqlOptions => + { + mySqlOptions.EnableStringComparisonTranslations(); + }) + .EnableSensitiveDataLogging(false) + .EnableDetailedErrors(false) + .LogTo(_ => { }); // disabilita EF logging; +}); +builder.Services.AddLuxData(connectionString); // registro connMultiplexer REDIS builder.Services.AddSingleton(redisConn); // registro wrapper servizi REDIS @@ -34,7 +50,7 @@ builder.Services.AddSingleton(); // Aggiunta servizi specifici builder.Services.AddSingleton(); builder.Services.AddSingleton(); - +builder.Services.AddSingleton(); var app = builder.Build(); diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 9b0b1cc..7df3a77 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -123,11 +123,14 @@ namespace WebWindowComplex.Compo currSplit = CurrSplit }; _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDimElem }); - // Se la shape selezionata è grid o custom, richiede reset shape - if (value > 2) - _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape }); - if (SearchSash(CurrSplit)) - _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetHwOpt }); + if(!(CurrSplit.ParentArea.ParentArea is Sash)) + { + // Se la shape selezionata è grid o custom, richiede reset shape + if (value == (int)SplitShapes.GRID || value == (int)SplitShapes.CUSTOM) + _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape }); + if (SearchSash(CurrSplit)) + _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetHwOpt }); + } _ = EC_ReqElement.InvokeAsync(CurrSplit); _ = EC_UpdateSplit.InvokeAsync(args); } diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs index e6bd09c..2ef9437 100644 --- a/WebWindowComplex/Compo/CardTree.razor.cs +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -169,6 +169,7 @@ namespace WebWindowComplex.Compo { FrameWindow.AddFirstSash(); await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDimElem }); + await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDictShape }); var args = new DataUpdateFrame() { currFrame = FrameWindow, diff --git a/WebWindowComplex/GeneralData.cs b/WebWindowComplex/GeneralData.cs new file mode 100644 index 0000000..2fff3af --- /dev/null +++ b/WebWindowComplex/GeneralData.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebWindowComplex +{ + public class GeneralData + { + public string serializeStruct { get; set; } = ""; + public Dictionary DictParameter { get; set; } = new(); + + } +} diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 5bfe44d..b2a8131 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -935,16 +935,19 @@ namespace WebWindowComplex.Models internal string SetSelFamilyHardwareFromIndex(string codHardware) { - string? item = ""; - if (string.IsNullOrEmpty(m_SelFamilyHardware)) + if(codHardware != "000000") { - item = m_HardwareCompleteList - .Where(x => x.Id == codHardware) - .Select(x => x.FamilyName) - .FirstOrDefault(); - SetSelFamilyHardware(item ?? ""); + string? item = ""; + if (string.IsNullOrEmpty(m_SelFamilyHardware)) + { + item = m_HardwareCompleteList + .Where(x => x.Id == codHardware) + .Select(x => x.FamilyName) + .FirstOrDefault(); + SetSelFamilyHardware(item ?? ""); + } } - return SelFamilyHardware; + return m_SelFamilyHardware; } internal void SetSelHardwareFromId(string sId) diff --git a/WebWindowComplex/SerialMan.cs b/WebWindowComplex/SerialMan.cs index 2daaf14..f952d0b 100644 --- a/WebWindowComplex/SerialMan.cs +++ b/WebWindowComplex/SerialMan.cs @@ -14,68 +14,107 @@ namespace WebWindowComplex public class SerialMan { /// - /// Riceve un JWD in ingresso e effettua una sostituzione dei parametri rieschiesti (SE non nulli) + /// Riceve un JWD in ingresso e effettua una sostituzione dei parametri richiesti (SE non nulli) /// /// /// /// /// /// Valore serializzato con le modifiche richieste - public static string MassUpdate(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) + public static GeneralData MassUpdate(string currSer, Dictionary DictParameter) { - string outVal = currSer; + if (string.IsNullOrEmpty(currSer) || currSer == "{}") + { + GeneralData dp = new GeneralData() + { + serializeStruct = currSer, + DictParameter = DictParameter + }; + return dp; + } // serializzazione JWD --> window JsonWindow WindowFromJson = JsonConvert.DeserializeObject(currSer, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); Window currWindow = WindowFromJson.Deserialize(); - // verifica 1:1 delle richieste - if (!string.IsNullOrEmpty(newFamilyHardware)) + if (!string.IsNullOrEmpty(DictParameter.GetValueOrDefault("Color"))) { - SearchSash(currWindow.AreaList.First(), newFamilyHardware, null); + currWindow.sColorMaterial = DictParameter.GetValueOrDefault("Color")!; + DictParameter.Remove("Color"); } - if (newHardware != null) + if (!string.IsNullOrEmpty(DictParameter.GetValueOrDefault("Material"))) { - SearchSash(currWindow.AreaList.First(), null, newHardware); + currWindow.sMaterial = DictParameter.GetValueOrDefault("Material")!; + DictParameter.Remove("Material"); } - if (!string.IsNullOrEmpty(newColorMaterial)) + if (!string.IsNullOrEmpty(DictParameter.GetValueOrDefault("Glass"))) { - currWindow.sColorMaterial = newColorMaterial; - } - if (!string.IsNullOrEmpty(newMaterial)) - { - currWindow.sMaterial = newMaterial; - } - if (!string.IsNullOrEmpty(newGlass)) - { - currWindow.sGlass = newGlass; - } - if (!string.IsNullOrEmpty(newProfile)) - { - currWindow.sProfilePath = newProfile; + currWindow.sGlass = DictParameter.GetValueOrDefault("Glass")!; + DictParameter.Remove("Glass"); } var CurrJwd = JsonConvert.SerializeObject(currWindow.Serialize(), Formatting.Indented); - return CurrJwd; - - + GeneralData datap = new GeneralData() + { + serializeStruct = CurrJwd, + DictParameter = DictParameter + }; + return datap; } - internal static void SearchSash(Area currentArea, string? newFamilyHw, Hardware? newHardware) - { - if (currentArea.AreaType.Equals(AreaTypes.SASH)) - { - Sash s = (Sash)currentArea; - if (!string.IsNullOrEmpty(newFamilyHw)) - { - s.SelFamilyHardware = newFamilyHw; - } - if (newHardware != null) - { - s.SelHardware = newHardware; - } - } - foreach (Area child in currentArea.AreaList) - { - SearchSash(child, newFamilyHw, newHardware); - } - } + //public static string MassUpdate(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) + //{ + // if(string.IsNullOrEmpty(currSer) || currSer == "{}") + // { + // return currSer; + // } + // // serializzazione JWD --> window + // JsonWindow WindowFromJson = JsonConvert.DeserializeObject(currSer, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + // Window currWindow = WindowFromJson.Deserialize(); + // // verifica 1:1 delle richieste + // if (!string.IsNullOrEmpty(newFamilyHardware)) + // { + // SearchSash(currWindow.AreaList.First(), newFamilyHardware, null); + // } + // if (newHardware != null) + // { + // SearchSash(currWindow.AreaList.First(), null, newHardware); + // } + // if (!string.IsNullOrEmpty(newColorMaterial)) + // { + // currWindow.sColorMaterial = newColorMaterial; + // } + // if (!string.IsNullOrEmpty(newMaterial)) + // { + // currWindow.sMaterial = newMaterial; + // } + // if (!string.IsNullOrEmpty(newGlass)) + // { + // currWindow.sGlass = newGlass; + // } + // if (!string.IsNullOrEmpty(newProfile)) + // { + // currWindow.sProfilePath = newProfile; + // } + // var CurrJwd = JsonConvert.SerializeObject(currWindow.Serialize(), Formatting.Indented); + // return CurrJwd; + //} + + //internal static void SearchSash(Area currentArea, string? newFamilyHw, Hardware? newHardware) + //{ + // if (currentArea.AreaType.Equals(AreaTypes.SASH)) + // { + // Sash s = (Sash)currentArea; + // if (!string.IsNullOrEmpty(newFamilyHw)) + // { + // s.SelFamilyHardware = newFamilyHw; + // } + // if (newHardware != null) + // { + // s.SelHardware = newHardware; + // } + // } + // foreach (Area child in currentArea.AreaList) + // { + // SearchSash(child, newFamilyHw, newHardware); + // } + //} } } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index bb67bc9..3518546 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -337,7 +337,7 @@ namespace WebWindowComplex private int m_maxRow = 0; - private List m_SashList = new List(); + private List m_SashGroupList = new List(); private List m_SplitList = new List(); @@ -401,13 +401,15 @@ namespace WebWindowComplex /// private int prevReq { get; set; } = 0; + private List prevHardware { get; set; } = new(); + private int reqHwOpt { get; set; } = 0; private Dictionary RowCollapsed { get; set; } = new Dictionary(); private List SashGroupList { - get => m_SashList; + get => m_SashGroupList; } private string SelColorMaterial { get; set; } = ""; @@ -807,7 +809,7 @@ namespace WebWindowComplex } case AreaTypes.SASH: { - m_SashList.Add((Sash)node); + m_SashGroupList.Add((Sash)node); break; } case AreaTypes.FILL: @@ -1242,6 +1244,22 @@ namespace WebWindowComplex // Aggiornamento liste sash, split, splitted, fill e itemTable UpdateLists(); } + for (int i = 0; i < SashGroupList.Count; i++) + { + if ((string.IsNullOrEmpty(SashGroupList.ElementAt(i).SelFamilyHardware)) && + SashGroupList.ElementAt(i).nSashQty == prevHardware.ElementAt(i).SashQty) + { + SashGroupList.ElementAt(i).SetSelFamilyHardwareFromIndex(prevHardware.ElementAt(i).Id); + } + else if (!string.IsNullOrEmpty(SashGroupList.ElementAt(i).SelFamilyHardware) || SashGroupList.ElementAt(i).SelHardware != null) + { + var item = SashGroupList.ElementAt(i).SelHardware; + if (i > prevHardware.Count - 1) + prevHardware.Add(item); + else + prevHardware[i] = SashGroupList.ElementAt(i).SelHardware; + } + } if (SashGroupList.Count > 0) currAntaIndex = 0; // Aggiorno window con dati shape e hw option @@ -1468,21 +1486,6 @@ namespace WebWindowComplex for (int elem = 2; elem <= elemList.Count - 2; elem++) elemList.ElementAt(elem).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapNameTop + "_Overlap")); elemList.Last().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapNameSx + "_Overlap")); - //bool recalcDim = false; - //for(int i = 0; i < elemList.Count; i++) - //{ - // if (!elemList.ElementAt(i).Equals(elemOld.ElementAt(i))) - // recalcDim = true; - //} - //if (recalcDim) - //{ - // Frame frame = sash.ParentWindow.AreaList.First(); - // if (frame != null) - // { - // frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width"); - // frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height"); - // } - //} } /// @@ -1602,7 +1605,7 @@ namespace WebWindowComplex reqList.Add(FrameWindow.GroupId); // Aggiorno le liste sash, split m_FillList = new List(); - m_SashList = new List(); + m_SashGroupList = new List(); m_SplitList = new List(); m_SplittedList = new List(); CreateWindowsList((m_CurrWindow!).AreaList.First(), false); @@ -1726,7 +1729,7 @@ namespace WebWindowComplex m_maxCol = 0; m_maxRow = 0; m_FillList = new List(); - m_SashList = new List(); + m_SashGroupList = new List(); m_SplitList = new List(); m_SplittedList = new List(); m_ItemTableList = new List(); diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 0a17b20..cfd5bff 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.2016 + 3.1.3.2716 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -54,6 +54,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 7d810dc..74d6bff 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.2016 + 3.1.3.2716 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -56,6 +56,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +