Ejemplo n.º 1
0
        public static DetalleSeccion ObtenerDetalleSeccionesPorId(int pId)
        {
            DetalleSeccion DetalleSeccion = new DetalleSeccion();

            using (SqlConnection con = Conexion.Conectar())
            {
                con.Open();
                string     sentencia = "SELECT * FROM DetalleSecciones WHERE Id = {0}";
                string     ssql      = string.Format(sentencia, pId);
                SqlCommand comando   = new SqlCommand(ssql, con);
                comando.CommandType = CommandType.Text;
                IDataReader reader = comando.ExecuteReader();

                if (reader.Read())
                {
                    DetalleSeccion.Id         = reader.GetInt32(0);
                    DetalleSeccion.IdSeccion  = reader.GetInt32(1);
                    DetalleSeccion.IdMateria  = reader.GetInt32(2);
                    DetalleSeccion.IdProfesor = reader.GetInt32(3);
                }

                con.Close();
            }

            return(DetalleSeccion);
        }
Ejemplo n.º 2
0
        public int ModificarDetalleSecciones(DetalleSeccion pDetalleSeccion)
        {
            int resultado = 0;

            using (SqlConnection con = Conexion.Conectar())
            {
                con.Open();
                string     sentencia = "UPDATE DetalleSecciones SET IdSeccion = '{0}',IdMateria='{1}',IdProfesor='{2}',' WHERE Id ='{3}'";
                string     ssql      = string.Format(sentencia, pDetalleSeccion.IdSeccion, pDetalleSeccion.IdMateria, pDetalleSeccion.IdProfesor, pDetalleSeccion.Id);
                SqlCommand comando   = new SqlCommand(ssql, con);
                comando.CommandType = CommandType.Text;
                resultado           = comando.ExecuteNonQuery();

                con.Close();
            }

            return(resultado);
        }
Ejemplo n.º 3
0
        public int InsertarDetalleSecciones(DetalleSeccion pDetalleSeccion)
        {
            int resultado = 0;

            using (SqlConnection con = Conexion.Conectar())
            {
                con.Open();
                string     sentencia = "INSERT INTO DetalleSecciones (IdSeccion,IdMateria,IdProfesor) VALUES('{0}','{1}','{2}')";
                string     ssql      = string.Format(sentencia, pDetalleSeccion.IdSeccion, pDetalleSeccion.IdMateria, pDetalleSeccion.IdProfesor);
                SqlCommand comando   = new SqlCommand(ssql, con);
                comando.CommandType = CommandType.Text;
                resultado           = comando.ExecuteNonQuery();

                con.Close();
            }

            return(resultado);
        }
Ejemplo n.º 4
0
 public int ModificarDetalleSeccion(DetalleSeccion pDetalleSeccion)
 {
     return(detalleSeccionDAL.ModificarDetalleSecciones(pDetalleSeccion));
 }
Ejemplo n.º 5
0
 public int InsertarDetalleSeccion(DetalleSeccion pDetalleSeccion)
 {
     return(detalleSeccionDAL.InsertarDetalleSecciones(pDetalleSeccion));
 }