fix gestione hw params e dooroptype
This commit is contained in:
@@ -534,9 +534,34 @@ namespace WebDoorCreator.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// truncate tables
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool TablesTruncate()
|
||||
{
|
||||
bool dbResult = false;
|
||||
using (var dbCtx = new WDCDataContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC man.[stp_TruncTables]");
|
||||
|
||||
dbResult = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error in TablesTruncate:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#endregion Components Methods
|
||||
|
||||
#region Door Operationm Methods
|
||||
#region Door Operation Methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -565,6 +590,6 @@ namespace WebDoorCreator.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Door Operationm Methods
|
||||
#endregion Door Operation Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebDoorCreator.Data.DbModels
|
||||
{
|
||||
public class Edges
|
||||
{
|
||||
public string lockEdge { get; set; } = "BV";
|
||||
public string hingeEdge { get; set; } = "BV";
|
||||
public string topEdge { get; set; } = "SQ";
|
||||
public string bottomEdge { get; set; } = "SQ";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebDoorCreator.Data.DbModels
|
||||
{
|
||||
public class Opening
|
||||
{
|
||||
public string swing { get; set; } = "RH";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebDoorCreator.Data.DbModels
|
||||
{
|
||||
public class Sizing
|
||||
{
|
||||
public string width { get; set; } = "33.8125";
|
||||
public string height { get; set; } = "81.25";
|
||||
public string thickness { get; set; } = "1.75";
|
||||
}
|
||||
}
|
||||
@@ -610,12 +610,20 @@ namespace WebDoorCreator.UI.Data
|
||||
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];
|
||||
|
||||
GraphicParamsModel graphicParams = new GraphicParamsModel() { compoId = i, graphicParamsN = match.Substring(1, match.Length - 2), graphicParamKey = param.Split("=")[0], graphicParamName = compoParamsSplit[1], graphicParamAlias = compoParamsSplit[1], graphicParamType = compoParamsSplit[0], graphicParamDefaultVal = compoParamsSplit[2] };
|
||||
}
|
||||
|
||||
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
|
||||
await dbController.ParamAdd(graphicParams);
|
||||
}
|
||||
@@ -644,6 +652,9 @@ namespace WebDoorCreator.UI.Data
|
||||
int n = 1;
|
||||
int i = 1;
|
||||
List<GraphicParamsModel> listGraphicParams = new List<GraphicParamsModel>();
|
||||
|
||||
dbController.TablesTruncate();
|
||||
|
||||
List<string> listActiveCompo = await GetAllActiveCompo(Path.Combine(rootPath, @"Default.ini"));
|
||||
List<HardwareModel> listCompoS = new List<HardwareModel>();
|
||||
//estraggo tutte le sotto directory della cartella \EgtData\Doors\EgtCompoBase\Compo
|
||||
@@ -658,6 +669,7 @@ namespace WebDoorCreator.UI.Data
|
||||
{
|
||||
List<string> lines = File.ReadAllLines(file).ToList(); //leggo tutte le linee del file
|
||||
IniFile fIni = new IniFile(file);
|
||||
Guid opCode = Guid.NewGuid();
|
||||
compoName = fIni.ReadString("Compo", "Name", "COMPONAME"); //cerco la sezione del file ed estraggo il nome del componente
|
||||
var isActive = fIni.ReadString("Template", "IsActive", "1");//cerco la sezione del file ed estraggo se i template sono attivi per il seguente componente
|
||||
bool compoTemplateIsActive = true;
|
||||
@@ -669,7 +681,7 @@ namespace WebDoorCreator.UI.Data
|
||||
var compoNameSplit = compoName.Split("/"); // lo slash indica l'alias
|
||||
if (listActiveCompo.Contains(compoNameSplit[0].ToString()))
|
||||
{
|
||||
HardwareModel compoConfig = new HardwareModel() { compoName = compoNameSplit[0].ToString(), compoAlias = compoNameSplit[1].ToString(), compoTemplateIsActive = compoTemplateIsActive }; //creo il componente (padre)
|
||||
HardwareModel compoConfig = new HardwareModel() { compoName = compoNameSplit[0].ToString(), compoAlias = compoNameSplit[1].ToString(), compoLayerName = layerName, compoTemplateIsActive = compoTemplateIsActive }; //creo il componente (padre)
|
||||
await dbController.CompoAdd(compoConfig);
|
||||
listCompoS.Add(compoConfig);
|
||||
var lineToSearch = lines.Where(x => x.Contains("[Graphic")).ToList(); //cerco all'interno del file tutte le sezioni che contengono "[Graphic" così da poter prendere il nome della sezione ES: [Graphic parameters1] = Graphic parameters1
|
||||
@@ -682,7 +694,8 @@ namespace WebDoorCreator.UI.Data
|
||||
|
||||
DoorOpTypeModel doorOpType = new DoorOpTypeModel()
|
||||
{
|
||||
Description = $"DOOR OPERATION TYPE FOR {compoNameSplit[1].ToString()}",
|
||||
Description = $"DOOR OPERATION TYPE FOR {compoNameSplit[0].ToString()}",
|
||||
OpCode = opCode.ToString(),
|
||||
HasHw = true,
|
||||
IsConcrete = true,
|
||||
HwCode = compoNameSplit[0].ToString(),
|
||||
@@ -697,6 +710,46 @@ namespace WebDoorCreator.UI.Data
|
||||
|
||||
}
|
||||
|
||||
List<Edges> edges = new List<Edges>();
|
||||
edges.Add(new Edges());
|
||||
List<Sizing> sizing = new List<Sizing>();
|
||||
sizing.Add(new Sizing());
|
||||
List<Opening> opening = new List<Opening>();
|
||||
opening.Add(new Opening());
|
||||
Guid opCodeEdges = Guid.NewGuid();
|
||||
Guid opCodeSizing = Guid.NewGuid();
|
||||
Guid opCodeOpening = Guid.NewGuid();
|
||||
DoorOpTypeModel doorOpTypeEdges = new DoorOpTypeModel()
|
||||
{
|
||||
Description = "DOOR OPERATION TYPE FOR Edges",
|
||||
OpCode = opCodeEdges.ToString(),
|
||||
HasHw = false,
|
||||
IsConcrete = true,
|
||||
DoorOpIdPathFromPatriarch = HierarchyId.Parse("/1/"),
|
||||
JsoncConfig = JsonConvert.SerializeObject(edges)
|
||||
};
|
||||
DoorOpTypeModel doorOpTypeSizing = new DoorOpTypeModel()
|
||||
{
|
||||
Description = "DOOR OPERATION TYPE FOR Sizing",
|
||||
OpCode = opCodeSizing.ToString(),
|
||||
HasHw = false,
|
||||
IsConcrete = true,
|
||||
DoorOpIdPathFromPatriarch = HierarchyId.Parse("/1/"),
|
||||
JsoncConfig = JsonConvert.SerializeObject(sizing)
|
||||
};
|
||||
DoorOpTypeModel doorOpTypeOpening = new DoorOpTypeModel()
|
||||
{
|
||||
Description = "DOOR OPERATION TYPE FOR Opening",
|
||||
OpCode = opCodeOpening.ToString(),
|
||||
HasHw = false,
|
||||
IsConcrete = true,
|
||||
DoorOpIdPathFromPatriarch = HierarchyId.Parse("/1/"),
|
||||
JsoncConfig = JsonConvert.SerializeObject(opening)
|
||||
};
|
||||
|
||||
await dbController.DoorOpTypeAdd(doorOpTypeEdges);
|
||||
await dbController.DoorOpTypeAdd(doorOpTypeSizing);
|
||||
await dbController.DoorOpTypeAdd(doorOpTypeOpening);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user