Exemple #1
0
        protected void btngrabar_Click(object sender, EventArgs e)
        {
            Ecarrera c = new Ecarrera();

            //  c.descripcion = this.txtdescripcion.Text.ToUpper();
            c.idcarrera = (this.txtid.Text != "") ? int.Parse(this.txtid.Text) : 0;
            c.accion    = (editar) ? "U" : "I";
            try
            {
                int i = Ncarrera.Sentencia(c);
                if (c.accion == "I")
                {
                    this.txtid.Text = i.ToString();
                }

                Habilitar(false);
                Habilitar2(true);
                buscar();
                ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "  $.notify('Datos Grabados!', 'success');", true);
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        public int Sentencia(Ecarrera c)
        {
            int          id  = 0;
            MySqlCommand cmd = new MySqlCommand("SentenciaCarrera", con.con);

            cmd.Parameters.Add("id", MySqlDbType.Int32).Value         = c.idcarrera;
            cmd.Parameters.Add("descripcion", MySqlDbType.Text).Value = c.descripcion;
            cmd.Parameters.Add("accion", MySqlDbType.Text).Value      = c.accion;
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                con.Conectar();
                id = int.Parse(cmd.ExecuteScalar().ToString());
                con.Desconectar();
            }
            finally
            {
                con.Desconectar();
            }


            return(id);
        }
Exemple #3
0
        public static int Sentencia(Ecarrera c)
        {
            Dcarrera ca = new Dcarrera();

            return(ca.Sentencia(c));
        }