inizio definizione automatica door types

This commit is contained in:
zaccaria.majid
2023-03-29 13:04:47 +02:00
parent 0ed4fc5595
commit fcff424770
3 changed files with 47 additions and 0 deletions
@@ -507,6 +507,7 @@ namespace WebDoorCreator.Data.Controllers
}
return fatto;
}
/// <summary>
/// Adding a new graphic param
/// </summary>
@@ -534,5 +535,36 @@ namespace WebDoorCreator.Data.Controllers
}
#endregion Components Methods
#region Door Operationm Methods
/// <summary>
/// Adding a new DoorOpType
/// </summary>
/// <param name="addRec">Record to add</param>
/// <returns></returns>
public async Task<bool> DoorOpTypeAdd(DoorOpTypeModel addRec)
{
bool fatto = false;
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
localDbCtx
.DbSetDoorOpType
.Add(addRec);
await localDbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DoorOpTypeAdd: {Environment.NewLine}{exc}");
}
}
return fatto;
}
#endregion Door Operationm Methods
}
}
@@ -57,6 +57,8 @@ namespace WebDoorCreator.UI.Components.DoorDef
{
ListSwings = await WDService.ListValuesGetAll("Opening", "Swing");
ListEdges = await WDService.ListValuesGetAll("Edges", "EdgeType");
}
protected override async Task OnInitializedAsync()
@@ -9,6 +9,7 @@ using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Core;
using System.Security.AccessControl;
using WebDoorCreator.Data;
using Microsoft.EntityFrameworkCore;
namespace WebDoorCreator.UI.Data
{
@@ -678,6 +679,18 @@ namespace WebDoorCreator.UI.Data
listGraphicParams = await SetGraphicParams(file, match, n, i);
n++;
}
DoorOpTypeModel doorOpType = new DoorOpTypeModel()
{
Description = $"DOOR OPERATION TYPE FOR {compoNameSplit[1].ToString()}",
HasHw = true,
IsConcrete = true,
HwCode = compoNameSplit[0].ToString(),
DoorOpIdPathFromPatriarch = HierarchyId.Parse("/1/"),
JsoncConfig = JsonConvert.SerializeObject(listGraphicParams)
};
await dbController.DoorOpTypeAdd(doorOpType);
}
i++;
}