inizio gestione nuova listvalues
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System.Diagnostics;
|
||||
@@ -155,6 +156,8 @@ namespace WebDoorCreator.UI.Data
|
||||
string compoName = "";
|
||||
int numHier = 1;
|
||||
List<GraphicParamsModel> listGraphicParams = new List<GraphicParamsModel>();
|
||||
List<ListValuesTempModel> listValues = new List<ListValuesTempModel>();
|
||||
ListValuesTempModel Values = new ListValuesTempModel();
|
||||
|
||||
dbController.TestTablesTruncate();
|
||||
|
||||
@@ -261,7 +264,13 @@ namespace WebDoorCreator.UI.Data
|
||||
numHead = 1;
|
||||
foreach (var match in lineToSearch)
|
||||
{
|
||||
listGraphicParams = await GraphicParamsGetAll(file, match, numHead, numPar);
|
||||
Values = await GraphicParamsGetAll(file, match, numHead, numPar, $"{compoNameSplit[1]}");
|
||||
|
||||
if (listValues.Where(x => x.TableName == Values.TableName && x.FieldName == Values.FieldName && x.Value == Values.Value).Count() == 0 && Values.TableName != "" && Values.FieldName != "" && Values.Value != "")
|
||||
{
|
||||
listValues.Add(Values);
|
||||
}
|
||||
|
||||
numHead++;
|
||||
}
|
||||
|
||||
@@ -286,7 +295,9 @@ namespace WebDoorCreator.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
fatto = await dbController.DoorOpTypeAddRange(ListObjDOT);
|
||||
fatto = await dbController.ListValuesAdd(listValues);
|
||||
//fatto = await dbController.DoorOpTypeAddRange(ListObjDOT);
|
||||
|
||||
|
||||
return fatto;
|
||||
}
|
||||
@@ -544,7 +555,7 @@ namespace WebDoorCreator.UI.Data
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public async Task<bool> ListValuesInsert(string rootPath)
|
||||
public async Task<bool> ListValuesLuaNgeInsert(string rootPath)
|
||||
{
|
||||
List<ListValuesTempModel> values = new List<ListValuesTempModel>();
|
||||
string[] dirs = Directory.GetDirectories(rootPath);
|
||||
@@ -577,9 +588,9 @@ namespace WebDoorCreator.UI.Data
|
||||
{
|
||||
TableName = $"{compoCode}".Replace(" ", "_"),
|
||||
FieldName = "Compo",
|
||||
value = @$"{tName[tName.Length - 1]}\{Path.GetFileName(templateFile)}".Replace(" ", "_"),
|
||||
label = Path.GetFileName(templateFile).Split(".")[0],
|
||||
ordinal = ordin
|
||||
Value = @$"{tName[tName.Length - 1]}\{Path.GetFileName(templateFile)}".Replace(" ", "_"),
|
||||
Label = Path.GetFileName(templateFile).Split(".")[0],
|
||||
Ordinal = ordin
|
||||
};
|
||||
|
||||
values.Add(temp);
|
||||
@@ -729,6 +740,7 @@ namespace WebDoorCreator.UI.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Setting the graphic parameters for components
|
||||
/// </summary>
|
||||
@@ -737,15 +749,16 @@ namespace WebDoorCreator.UI.Data
|
||||
/// <param name="n"></param>
|
||||
/// <param name="i"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<GraphicParamsModel>> GraphicParamsGetAll(string file, string match, int n, int i)
|
||||
public async Task<List<GraphicParamsModel>> GraphicParamsGetAll(string file, string match, int n, int i, string HwCode)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
List<GraphicParamsModel> listGraphicParams = new List<GraphicParamsModel>();
|
||||
|
||||
IniFile fIni = new IniFile(file);
|
||||
//estraggo la lista di componenti che sono attive per il cliente
|
||||
var graphicParamsName = fIni.ReadSection(match.Substring(1, match.Length - 2)); //cerco il contenuto delle sezioni
|
||||
if (int.Parse(match.Substring(match.Length - 2, 1)) == n) //controllo se tra numPar numeri di graphic params vi è un buco ES: Graphic parameters1 Graphic parameters3 se il buco c'è salto tutti numPar parametri che stanno dopo il buco ==> tengo conto solo di Graphic parameters1
|
||||
//cerco il contenuto delle sezioni
|
||||
var graphicParamsName = fIni.ReadSection(match.Substring(1, match.Length - 2));
|
||||
//controllo se tra numPar numeri di graphic params vi è un buco ES: Graphic parameters1 Graphic parameters3 se il buco c'è salto tutti numPar parametri che stanno dopo il buco ==> tengo conto solo di Graphic parameters1
|
||||
if (int.Parse(match.Substring(match.Length - 2, 1)) == n)
|
||||
{
|
||||
foreach (string param in graphicParamsName)
|
||||
{
|
||||
@@ -762,20 +775,103 @@ namespace WebDoorCreator.UI.Data
|
||||
CompoParamAlias = compoParamsSplit[1].Split("/")[1];
|
||||
}
|
||||
|
||||
//creo nuovo oggetto parametro che conterrà anche il nome del componente per creare relazione
|
||||
|
||||
ListValuesTempModel listValObj = new ListValuesTempModel()
|
||||
{
|
||||
TableName = HwCode,
|
||||
FieldName = match.Substring(1, match.Length - 2),
|
||||
Value = param.Split("=")[1].Split(";")[1].Split("/")[0],
|
||||
Label = param.Split("=")[1].Split(";")[1].Split("/")[1],
|
||||
DefaultVal = param.Split("=")[1].Split(";")[2],
|
||||
InputType = param.Split("=")[1].Split(";")[0]
|
||||
};
|
||||
|
||||
GraphicParamsModel graphicParams = new GraphicParamsModel() { compoId = i, graphicParamsN = match.Substring(1, match.Length - 2), graphicParamKey = param.Split("=")[0], graphicParamName = CompoParamName, graphicParamAlias = CompoParamAlias, graphicParamType = compoParamsSplit[0], graphicParamDefaultVal = compoParamsSplit[2] };
|
||||
listGraphicParams.Add(graphicParams); //creo nuovo oggetto parametro che conterrà anche il nome del componente per creare relazione
|
||||
listGraphicParams.Add(graphicParams);
|
||||
await dbController.ParamAdd(graphicParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
GraphicParamsModel graphicParams = new GraphicParamsModel() { compoId = i, graphicParamsN = match.Substring(1, match.Length - 2), graphicParamKey = param.Split("=")[0], graphicParamName = compoParams };
|
||||
listGraphicParams.Add(graphicParams); //creo nuovo oggetto parametro che conterrà anche il nome del componente per creare relazione
|
||||
listGraphicParams.Add(graphicParams);
|
||||
await dbController.ParamAdd(graphicParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return listGraphicParams;
|
||||
}
|
||||
#endif
|
||||
|
||||
public async Task<ListValuesTempModel> GraphicParamsGetAll(string file, string match, int n, int i, string HwCode)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
List<ListValuesTempModel> listValuesTemp = new List<ListValuesTempModel>();
|
||||
ListValuesTempModel listValObj = new ListValuesTempModel();
|
||||
|
||||
IniFile fIni = new IniFile(file);
|
||||
//cerco il contenuto delle sezioni
|
||||
var graphicParamsName = fIni.ReadSection(match.Substring(1, match.Length - 2));
|
||||
//controllo se tra numPar numeri di graphic params vi è un buco ES: Graphic parameters1 Graphic parameters3 se il buco c'è salto tutti numPar parametri che stanno dopo il buco ==> tengo conto solo di Graphic parameters1
|
||||
if (int.Parse(match.Substring(match.Length - 2, 1)) == n)
|
||||
{
|
||||
foreach (string param in graphicParamsName)
|
||||
{
|
||||
string compoParams = fIni.ReadString(match.Substring(1, match.Length - 2), $"{param.Split("=")[0]}", "CONFIG"); //cerco il parametro nella sezione
|
||||
var compoParamsSplit = compoParams.Split(";");
|
||||
|
||||
string CompoParamName = "";
|
||||
string CompoParamAlias = "";
|
||||
if (param.Split("=")[0].StartsWith("Param"))
|
||||
{
|
||||
if (compoParamsSplit[1].Contains("/"))
|
||||
{
|
||||
CompoParamName = compoParamsSplit[1].Split("/")[0];
|
||||
CompoParamAlias = compoParamsSplit[1].Split("/")[1];
|
||||
}
|
||||
else if (compoParamsSplit[1].Contains(" "))
|
||||
{
|
||||
CompoParamName = compoParamsSplit[1].Split(" ")[1];
|
||||
//CompoParamAlias = compoParamsSplit[1].Split(" ")[1];
|
||||
}
|
||||
|
||||
//creo nuovo oggetto parametro che conterrà anche il nome del componente per creare relazione
|
||||
|
||||
listValObj = new ListValuesTempModel()
|
||||
{
|
||||
TableName = $"{HwCode}_{n}",
|
||||
FieldName = match.Substring(1, match.Length - 2),
|
||||
Value = CompoParamName,
|
||||
Label = CompoParamAlias,
|
||||
Ordinal = n,
|
||||
DefaultVal = param.Split("=")[1].Split(";")[2],
|
||||
InputType = param.Split("=")[1].Split(";")[0]
|
||||
};
|
||||
|
||||
if (listValuesTemp.Where(x => x.TableName == listValObj.TableName && x.FieldName == listValObj.FieldName && x.Value == listValObj.Value).Count() == 0 && listValObj.TableName != "" && listValObj.FieldName != "" && listValObj.Value != "")
|
||||
{
|
||||
listValuesTemp.Add(listValObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"GraphicParamsGetAll | Duplicated key: {listValObj.TableName} {listValObj.FieldName} {listValObj.Value} ");
|
||||
}
|
||||
|
||||
//GraphicParamsModel graphicParams = new GraphicParamsModel() { compoId = i, graphicParamsN = match.Substring(1, match.Length - 2), graphicParamKey = param.Split("=")[0], graphicParamName = CompoParamName, graphicParamAlias = CompoParamAlias, graphicParamType = compoParamsSplit[0], graphicParamDefaultVal = compoParamsSplit[2] };
|
||||
//listGraphicParams.Add(graphicParams);
|
||||
//await dbController.ParamAdd(graphicParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
//GraphicParamsModel graphicParams = new GraphicParamsModel() { compoId = i, graphicParamsN = match.Substring(1, match.Length - 2), graphicParamKey = param.Split("=")[0], graphicParamName = compoParams };
|
||||
//listGraphicParams.Add(graphicParams);
|
||||
//await dbController.ParamAdd(graphicParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return listValObj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace WebDoorCreator.UI.Pages
|
||||
protected async Task refreshFiles()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await WDService.ListValuesInsert(@$"{defaultPath}");
|
||||
await WDService.ListValuesLuaNgeInsert(@$"{defaultPath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user