diff --git a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs index e227521..f9aaf12 100644 --- a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs +++ b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs @@ -479,5 +479,35 @@ namespace WebDoorCreator.Data.Controllers } #endregion ListValues Methods + + #region Components Methods + + /// + /// Adding a new Compo + /// + /// Record to add + /// + public async Task 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 } } \ No newline at end of file diff --git a/WebDoorCreator.Data/WDCDataContext.cs b/WebDoorCreator.Data/WDCDataContext.cs index 4b2bc3b..0bfda7c 100644 --- a/WebDoorCreator.Data/WDCDataContext.cs +++ b/WebDoorCreator.Data/WDCDataContext.cs @@ -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 { diff --git a/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs b/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs index 11f2992..67b55b2 100644 --- a/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs +++ b/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs @@ -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; } diff --git a/WebDoorCreator.UI/Data/WebDoorCreatorService.cs b/WebDoorCreator.UI/Data/WebDoorCreatorService.cs index a8b560d..ba70266 100644 --- a/WebDoorCreator.UI/Data/WebDoorCreatorService.cs +++ b/WebDoorCreator.UI/Data/WebDoorCreatorService.cs @@ -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; diff --git a/WebDoorCreator.UI/Pages/SuperAdmin.razor b/WebDoorCreator.UI/Pages/SuperAdmin.razor index 91f9863..29dd330 100644 --- a/WebDoorCreator.UI/Pages/SuperAdmin.razor +++ b/WebDoorCreator.UI/Pages/SuperAdmin.razor @@ -4,13 +4,21 @@
-
-
- Company management +
+
+
+ Company management +
+
+ Users Management +
-
- Users Management +
+
+ + +
diff --git a/WebDoorCreator.UI/Pages/SuperAdmin.razor.cs b/WebDoorCreator.UI/Pages/SuperAdmin.razor.cs index d6c91b3..a164025 100644 --- a/WebDoorCreator.UI/Pages/SuperAdmin.razor.cs +++ b/WebDoorCreator.UI/Pages/SuperAdmin.razor.cs @@ -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}"); + } } } \ No newline at end of file