From 0ed4fc5595dc2a7dadf3d33d7b0bf009683b100d Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Wed, 29 Mar 2023 10:51:22 +0200 Subject: [PATCH] aggiunta gestione compo params --- .../Controllers/WebDoorCreatorController.cs | 25 +++++++++++++++++++ .../Data/WebDoorCreatorService.cs | 10 ++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs index f9aaf12..7e9fdfe 100644 --- a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs +++ b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs @@ -507,6 +507,31 @@ namespace WebDoorCreator.Data.Controllers } return fatto; } + /// + /// Adding a new graphic param + /// + /// Record to add + /// + public async Task ParamAdd(GraphicParamsModel addRec) + { + bool fatto = false; + using (WDCDataContext localDbCtx = new WDCDataContext(_configuration)) + { + try + { + localDbCtx + .DbSetGraphicParams + .Add(addRec); + await localDbCtx.SaveChangesAsync(); + fatto = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ParamAdd: {Environment.NewLine}{exc}"); + } + } + return fatto; + } #endregion Components Methods } diff --git a/WebDoorCreator.UI/Data/WebDoorCreatorService.cs b/WebDoorCreator.UI/Data/WebDoorCreatorService.cs index ba70266..385bdd3 100644 --- a/WebDoorCreator.UI/Data/WebDoorCreatorService.cs +++ b/WebDoorCreator.UI/Data/WebDoorCreatorService.cs @@ -587,10 +587,14 @@ namespace WebDoorCreator.UI.Data return listActiveCompo; } + /// - /// Getting a list of all the active components + /// Setting the graphic parameters for components /// - /// Path to start + /// + /// + /// + /// /// public async Task> SetGraphicParams(string file, string match, int n, int i) { @@ -612,11 +616,13 @@ namespace WebDoorCreator.UI.Data 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] }; listGraphicParams.Add(graphicParams); //creo nuovo oggetto parametro che conterrĂ  anche il nome del componente per creare relazione + 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 + await dbController.ParamAdd(graphicParams); } } }