Exemplo n.º 1
0
        //Editar Datos del profesor
        static public bool EditarDatosProfesor(int id_profesor, PROFESOR profeEditar)
        {
            try
            {
                using (var datos = new bd_webEntities())
                {
                    PROFESOR profesor = datos.PROFESORs.Where(ss => ss.ID_PROFESOR == id_profesor).FirstOrDefault();
                    profesor.CORREO    = profeEditar.CORREO;
                    profesor.CELULAR   = profeEditar.CELULAR;
                    profesor.APELLIDOS = profeEditar.APELLIDOS;
                    profesor.NOMBRES   = profeEditar.NOMBRES;
                    profesor.PROFESION = profeEditar.PROFESION;
                    profesor.FECHA_MOD = profeEditar.FECHA_MOD;
                    profesor.DIRECCION = profeEditar.DIRECCION;


                    datos.SaveChanges();
                }
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 //Seleccionar o buscar a un profesor por su ID
 static public PROFESOR SelectProfesor(int id_profe)
 {
     try
     {
         PROFESOR profesorSelect = new PROFESOR();
         using (var datos = new bd_webEntities())
         {
             profesorSelect = datos.PROFESORs.Where(ss => ss.ID_PROFESOR == id_profe).FirstOrDefault();
         }
         return(profesorSelect);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemplo n.º 3
0
        //añadir  un nuevo curso del profesor
        static public bool AddCursoProfesor(CURSO cursoAdd)
        {
            try
            {
                using (var datos = new bd_webEntities())
                {
                    datos.CURSOes.Add(cursoAdd);
                    datos.SaveChanges();
                }

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Exemplo n.º 4
0
 //Eliminar al profesor por su id
 static public bool EliminarProfesor(int id_profesor)
 {
     try
     {
         using (var datos = new bd_webEntities())
         {
             PROFESOR profe = datos.PROFESORs.Where(ss => ss.ID_PROFESOR == id_profesor).FirstOrDefault();
             datos.PROFESORs.Remove(profe);
             datos.SaveChanges();
         }
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemplo n.º 5
0
        //Lista a todos los profesores
        static public List <PROFESOR> ListaProfesor()
        {
            try
            {
                List <PROFESOR> listaProfe = new List <PROFESOR>();
                using (var datos = new bd_webEntities())
                {
                    listaProfe = datos.PROFESORs.ToList();
                }

                return(listaProfe);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemplo n.º 6
0
 // Método para eliminar un curso del profesor
 static public bool EliminarCursoProfesor(int id_cursoProfe)
 {
     try
     {
         using (var datos = new bd_webEntities())
         {
             CURSO curso = datos.CURSOes.Where(ss => ss.ID_CURSO == id_cursoProfe).FirstOrDefault();
             datos.CURSOes.Remove(curso);
             datos.SaveChanges();
         }
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }
Exemplo n.º 7
0
        //Lista de los cursos del profesor
        static public List <CURSO> ListaCursoProfesor(int profesor_id)
        {
            try
            {
                List <CURSO> listacurso = new List <CURSO>();

                using (var datos = new bd_webEntities())
                {
                    listacurso = datos.CURSOes.Where(ss => ss.ID_PROFESOR == profesor_id).ToList();
                }
                return(listacurso);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(null);
            }
        }
Exemplo n.º 8
0
        //Agregar profesor
        static public bool AgregarProfesor(PROFESOR ProfesorAdd)
        {
            try
            {
                using (var datos = new bd_webEntities())
                {
                    datos.PROFESORs.Add(ProfesorAdd);
                    datos.SaveChanges();
                }

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
Exemplo n.º 9
0
 // Editar curso del profesor
 static public bool EditarCurso(int idCurso, string nombreCurso, int creditos, string descripcion, string horarioCurso)
 {
     try
     {
         using (var datos = new bd_webEntities())
         {
             CURSO cursoEditar = datos.CURSOes.Where(ss => ss.ID_CURSO == idCurso).FirstOrDefault();
             cursoEditar.NOMBRE      = nombreCurso;
             cursoEditar.CREDITOS    = creditos;
             cursoEditar.DESCRIPCION = descripcion;
             cursoEditar.HORARIO     = horarioCurso;
         }
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }