예제 #1
0
        public int eliminar(object eliminar)
        {
            alumnoBO   obje = (alumnoBO)eliminar;
            SqlCommand coma = new SqlCommand("delete from alumnos where id=@id");

            coma.Parameters.Add("id", SqlDbType.Int).Value = obje.Id;
            coma.CommandType = CommandType.Text;
            return(conectar.EjecutarComando(coma));
        }
예제 #2
0
        public alumnoBO  recuperar()
        {
            alumnoBO obj = new alumnoBO();
            int      id  = 0; int.TryParse(txtID.Text, out id);

            obj.Apellidos = txtapellidos.Text;
            obj.Nombres   = txtnombres.Text;
            obj.Id        = id;
            obj.Grado     = txtGrado.Text;
            obj.Grupo     = txtGrupo.Text;
            return(obj);
        }
예제 #3
0
        public int agregar(object agregar)
        {
            alumnoBO   obejto = (alumnoBO)agregar;
            SqlCommand dir    = new SqlCommand("INSERT INTO alumnos VALUES(@nom,@a,@gra,@gru)");

            dir.Parameters.Add("@nom", SqlDbType.VarChar).Value = obejto.Nombres;
            dir.Parameters.Add("@a", SqlDbType.VarChar).Value   = obejto.Apellidos;
            dir.Parameters.Add("@gra", SqlDbType.VarChar).Value = obejto.Grado;
            dir.Parameters.Add("@gru", SqlDbType.VarChar).Value = obejto.Grupo;
            dir.CommandType = CommandType.Text;
            return(conectar.EjecutarComando(dir));
        }
예제 #4
0
        public int actualizar(object actualizar)
        {
            alumnoBO   obejto = (alumnoBO)actualizar;
            SqlCommand dir    = new SqlCommand("update alumnos set nombres=@nom,apellidos=@apelido,grado=@gra,grupo=@gru where id=@id");

            dir.Parameters.Add("id", SqlDbType.Int).Value           = obejto.Id;
            dir.Parameters.Add("@nom", SqlDbType.VarChar).Value     = obejto.Nombres;//----
            dir.Parameters.Add("@apelido", SqlDbType.VarChar).Value = obejto.Apellidos;
            dir.Parameters.Add("@gra", SqlDbType.VarChar).Value     = obejto.Grado;
            dir.Parameters.Add("@gru", SqlDbType.VarChar).Value     = obejto.Grupo;
            dir.CommandType = CommandType.Text;
            return(conectar.EjecutarComando(dir));
        }