protected void btnCrear_Click(object sender, EventArgs e)
        {
            if (validarCampos())
            {
                RestClient client = new RestClient(ConfigurationManager.AppSettings.Get("endpoint"));
                RestRequest request = new RestRequest("kpis/", Method.POST);

                List<DetalleFormula> formulaCompleta = new List<DetalleFormula>();

                for (int i = 0; i < formula.Count; i++)
                {
                    formulaCompleta.Add(new DetalleFormula(i, variables[i], formula[i]));
                }

                KPI kpiNuevo = new KPI(0, txtDescripcion.Text, ddlFormato.Text, Convert.ToDouble(txtObjetivo.Text), ddlPeriodicidad.Text, new ParametroKPI(Convert.ToInt32(ddlLimiteInf.Text), Convert.ToInt32(ddlLimiteSup.Text)), formulaCompleta);

                request.AddJsonBody(kpiNuevo);

                var response = client.Execute(request);

                formula = new List<string>();
                variables = new List<string>();
                operador = false;

                Response.Redirect("indicadoresKPI.aspx");
            }
            else
            {
                //"error"
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            RestClient client = new RestClient(ConfigurationManager.AppSettings.Get("endpoint"));
            RestRequest request = new RestRequest("kpis/{id}", Method.PUT);

            request.AddUrlSegment("id", (string)Session["idIndicador"]);

            KPI kpi = new KPI(Convert.ToInt32(Session["idIndicador"]),txtDescripcion.Text,ddlFormato.Text,Convert.ToDouble(txtObjetivo.Text),ddlPeriodicidad.Text,new ParametroKPI(),null);
            kpi.Estado = true;
            request.AddJsonBody(kpi);

            var response = client.Execute(request);

            string json = response.Content;

            Response.Redirect("indicadoresKPI.aspx");
        }