fix gestione scrittura su db valori default e attuali

This commit is contained in:
zaccaria.majid
2023-04-11 09:26:45 +02:00
parent 856148a3e2
commit e344e4cf43
2 changed files with 28 additions and 7 deletions
@@ -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<string, List<string>> defaultDict = new Dictionary<string, List<string>>();
var listRecordFolder = await WDService.ListValuesGetAll(HwToShow.TableName, "Folder");
var listRecordTmp = await WDService.ListValuesGetAll(HwToShow.TableName, "Template");
Dictionary<string, List<string>> defaultDict = new Dictionary<string, List<string>>();
Dictionary<string, string> actDict = new Dictionary<string, string>();
List<string> listDefVal = new List<string>();
List<string> defaultParamsList = new List<string>();
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);
@@ -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;
}
/// <summary>
@@ -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<string, List<string>> graphicParams { get; set; } = null!;