fix gestione refresh componenti

This commit is contained in:
zaccaria.majid
2023-03-29 10:40:24 +02:00
parent 38b5412230
commit 3c2a59215a
6 changed files with 56 additions and 7 deletions
@@ -479,5 +479,35 @@ namespace WebDoorCreator.Data.Controllers
}
#endregion ListValues Methods
#region Components Methods
/// <summary>
/// Adding a new Compo
/// </summary>
/// <param name="addRec">Record to add</param>
/// <returns></returns>
public async Task<bool> CompoAdd(HardwareModel addRec)
{
bool fatto = false;
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
localDbCtx
.DbSetHardware
.Add(addRec);
await localDbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante CompoAdd: {Environment.NewLine}{exc}");
}
}
return fatto;
}
#endregion Components Methods
}
}
+1 -1
View File
@@ -106,7 +106,7 @@ namespace WebDoorCreator.Data
string connString = _configuration.GetConnectionString("WDC.DB");
if (!string.IsNullOrEmpty(connString))
{
optionsBuilder.UseSqlServer(connString);
optionsBuilder.UseSqlServer(connString, e => e.UseHierarchyId());
}
else
{
@@ -145,10 +145,10 @@ namespace WebDoorCreator.UI.Components.Gen
userCurrCompany = compToShow.CompanyId;
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
await WDCService.SetAllCompoList(@"C:\EgtData\Doors\EgtCompoBase\Compo");
WDCUService.EA_UserClaims += OnNewUserClaims;
WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
}
@@ -8,6 +8,7 @@ using WebDoorCreator.Data.Controllers;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Core;
using System.Security.AccessControl;
using WebDoorCreator.Data;
namespace WebDoorCreator.UI.Data
{
@@ -662,6 +663,7 @@ namespace WebDoorCreator.UI.Data
if (listActiveCompo.Contains(compoNameSplit[0].ToString()))
{
HardwareModel compoConfig = new HardwareModel() { compoName = compoNameSplit[0].ToString(), compoAlias = compoNameSplit[1].ToString(), 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
n = 1;
+13 -5
View File
@@ -4,13 +4,21 @@
<AuthorizeView>
<Authorized>
<div class="">
<div class="pb-0 d-flex justify-content-start">
<div class="fs-5 @selectedComp" @onclick="()=>doShowComp()">
Company management
<div class="d-flex justify-content-between">
<div class="pb-0 d-flex justify-content-start">
<div class="fs-5 @selectedComp" @onclick="()=>doShowComp()">
Company management
</div>
<div class="fs-5 @selectedUser" @onclick="()=>doShowUser()">
Users Management
</div>
</div>
<div class="fs-5 @selectedUser" @onclick="()=>doShowUser()">
Users Management
<div>
<button class="btn btn-warning" @onclick="()=>refreshHw()">HARDWARE REFRESH</button>
</div>
<!--NON USO TYPE FILE PERCHE' NON PRENDE IL PATH DEL FILE MA RESTITUISCE C:\\fakepath-->
<input @bind-value="@defaultPath" />
</div>
<div class="listContainer">
<!-- Button trigger modal -->
@@ -132,6 +132,10 @@ namespace WebDoorCreator.UI.Pages
set { _passwordConfirm = value; }
}
protected string _defaultPath = "";
protected string defaultPath { get; set; } = "";
protected bool isCompShow { get; set; } = true;
protected async Task addModNewCompany()
@@ -285,5 +289,10 @@ namespace WebDoorCreator.UI.Pages
await Task.Delay(1);
isCompShow = false;
}
protected async Task refreshHw()
{
await Task.Delay(1);
await WDService.SetAllCompoList(@$"{defaultPath}");
}
}
}