public void GuardarVariablesBtn_Click(string paramsVars) { try { string loggeduser = LoggedUserHdn.Text; var VariablesDeEntorno = Ext.Net.JSON.Deserialize <Dictionary <string, string>[]>(paramsVars); Dictionary <string, string> variables = new Dictionary <string, string>(); foreach (Dictionary <string, string> validarVars in VariablesDeEntorno) { variables.Add(validarVars["VARIABLES_LLAVE"], validarVars["VARIABLES_VALOR"]); } if (this.ValidarTodasVariables(variables)) { VariablesDeEntornoLogic varenvlogic = new VariablesDeEntornoLogic(); varenvlogic.ActualizarVariablesDeEntorno(VariablesDeEntorno, loggeduser); } else { Ext.Net.ResourceManager.AjaxSuccess = false; Ext.Net.ResourceManager.AjaxErrorMessage = "Ocurrio un error al validar las variables."; } } catch (Exception ex) { log.Fatal("Error fatal al guardar variables de entorno.", ex); throw; } }
/// <summary> /// Obtiene las variables de entorno. /// </summary> /// <returns>Diccionario de variables de entorno.</returns> public Dictionary <string, string> GetVariables() { Dictionary <string, string> variablesDictionary = null; try { variablesDictionary = new Dictionary <string, string>(); XmlNodeList pagesNode = docEntorno.SelectNodes("paginas/pagina[Name[contains(text(), '" + pagename + "')]]"); VariablesDeEntornoLogic variablesLogic = new VariablesDeEntornoLogic(); using (var db = new colinasEntities()) { foreach (XmlNode pageNode in pagesNode) { XmlNodeList variablesNode = pageNode.SelectNodes("variables/variable"); foreach (XmlNode variableNode in variablesNode) { XmlNode keyNode = variableNode.SelectSingleNode("key"); string key = keyNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); variable_de_entorno varenv = variablesLogic.GetVariableDeEntorno(key, db); variablesDictionary[key] = varenv.VARIABLES_VALOR; } } } return(variablesDictionary); } catch (Exception ex) { log.Fatal("Error fatal al obtener variables de entorno.", ex); throw; } }