diff --git a/WebDoorCreator.UI/Components/Hardware/HardwareList.razor.cs b/WebDoorCreator.UI/Components/Hardware/HardwareList.razor.cs index 73e73a2..e5a3520 100644 --- a/WebDoorCreator.UI/Components/Hardware/HardwareList.razor.cs +++ b/WebDoorCreator.UI/Components/Hardware/HardwareList.razor.cs @@ -1,3 +1,4 @@ +using MailKit.Net.Imap; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; using WebDoorCreator.Data.DbModels; @@ -86,12 +87,32 @@ namespace WebDoorCreator.UI.Components.Hardware if (HwToShow != null) { var listRecordGP = await WDService.ListValuesGetAll(HwToShow.TableName, "Graphic Parameters1"); - Dictionary> defaultDict = new Dictionary>(); + var listRecordFolder = await WDService.ListValuesGetAll(HwToShow.TableName, "Folder"); + var listRecordTmp = await WDService.ListValuesGetAll(HwToShow.TableName, "Template"); + Dictionary> defaultDict = new Dictionary>(); Dictionary actDict = new Dictionary(); List listDefVal = new List(); List defaultParamsList = new List(); - if (listRecordGP != null) + if (listRecordGP != null && listRecordFolder != null) { + var firstFolder = listRecordFolder.FirstOrDefault(); + if (firstFolder != null) + { + actDict.Add(firstFolder.FieldName, firstFolder.Value.Trim()); + if (listRecordTmp != null) + { + var listRecordTemplates = listRecordTmp.Where(x => x.Value.Contains(firstFolder.Value)).ToList(); + if (listRecordTemplates != null) + { + var firstTemplate = listRecordTemplates.FirstOrDefault(); + if (firstTemplate != null) + { + actDict.Add(firstTemplate.FieldName, firstTemplate.Value.Trim()); + } + } + } + } + foreach (var item in listRecordGP) { if (item.isSerializable && item.DefaultVal.Contains(",")) @@ -106,8 +127,8 @@ namespace WebDoorCreator.UI.Components.Hardware } //defaultParamsList.Add(listDefVal); + defaultDict.Add(item.Label, listDefVal); } - defaultDict.Add(HwToShow.Value, listDefVal); //actDict.Add(HwToShow.TableName, actParamsList); var jsonDef = JsonConvert.SerializeObject(defaultDict); diff --git a/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor.cs b/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor.cs index 8af040b..e26a7bd 100644 --- a/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor.cs +++ b/WebDoorCreator.UI/Components/Hardware/HwSingleInstance.razor.cs @@ -59,8 +59,8 @@ namespace WebDoorCreator.UI.Components.Hardware //} protected string _folderName { - get => currVal != null ? currVal["folder"] : ""; - set => currVal["folder"] = value; + get => currVal != null ? currVal["Folder"] : ""; + set => currVal["Folder"] = value; } /// @@ -83,8 +83,8 @@ namespace WebDoorCreator.UI.Components.Hardware protected string templateName { - get => currVal != null ? currVal["template"] : ""; - set => currVal["template"] = value; + get => currVal != null ? currVal["Template"] : ""; + set => currVal["Template"] = value; } protected Dictionary> graphicParams { get; set; } = null!;