コード例 #1
0
        protected void CrearVariable_Click(object sender, EventArgs e)
        {
            if (!validar(nombreVariable.Value.ToString()) || !validar(descripcionNuevaVariable.Value.ToString()))
            {
                msj = "Valide los campos";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Confirm();", true);
                return;
            }

            VariableController obj = new VariableController(nombreVariable.Value.ToString(), tDato.Value,
                                                            descripcionNuevaVariable.Value.ToString());

            if (obj.Registrar())
            {
                msj = "Exitoso";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Confirm();", true);
                if (Session["pk_pro"] != null && proyecto.SelectedIndex >= 0)
                {
                    cargarVariables(Session["pk_pro"].ToString());
                }
            }
            else
            {
                msj = "Error al registrar";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Confirm();", true);
            }
        }