public static void Eliminar(int Id)
        {
            var         db = new DetallesDb();
            Estudiantes e  = db.Estudiante.Find(Id);

            db.Estudiante.Remove(e);
            db.SaveChanges();
        }
        public static List <Grupos> GetLista()
        {
            var lista = new List <Grupos>();

            var db = new DetallesDb();

            lista = db.Grupo.ToList();

            return(lista);
        }
        public static List <Grupos> GetListaNombres(string aux)
        {
            List <Grupos> lista = new List <Grupos>();

            var db = new DetallesDb();

            lista = db.Grupo.Where(p => p.Nombre == aux).ToList();

            return(lista);
        }
        public static List <Grupos> GetListaGrupos(int id)
        {
            List <Grupos> lista = new List <Grupos>();

            var db = new DetallesDb();

            lista = db.Grupo.Where(p => p.GrupoId == id && p.Estudiante.Count > 0).ToList();

            return(lista);
        }
Example #5
0
        private void ListarEstudiantes()
        {
            DetallesDb Conexion = new DetallesDb();
            var        Lista    = Conexion.Estudiante.ToList();

            if (Lista.Count > 0)
            {
                NombreGrupocomboBox.DataSource    = Lista;
                NombreGrupocomboBox.ValueMember   = "EstudianteId";
                NombreGrupocomboBox.DisplayMember = "Nombres";
            }
        }
        public static void Guardad(int v)
        {
            DetallesDb db    = new DetallesDb();
            Grupos     grupo = db.Grupo.Find(v);

            try
            {
                db.Grupo.Add(grupo);
                db.SaveChanges();
            }catch (Exception ex)
            {
                throw ex;
            }
        }
 public static void Guardar(Estudiantes e)
 {
     try
     {
         DetallesDb db = new DetallesDb();
         {
             db.Estudiante.Add(e);
             db.SaveChanges();
             db.Dispose();
         }
     }catch (Exception ex)
     {
         throw ex;
     }
 }
        public static List <GrupoEstudiantes> Getlista(int idgrupo)
        {
            List <GrupoEstudiantes> lista = new List <GrupoEstudiantes>();

            using (DetallesDb conexion = new DetallesDb())
            {
                try
                {
                    lista = conexion.GrupoEstudiante.Where(gre => gre.GrupoId == idgrupo).ToList();
                }catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            return(lista);
        }
        public static Estudiantes Buscar(int IdEstudiante)
        {
            Estudiantes estudiante = new Estudiantes();

            using (DetallesDb db = new DetallesDb())
            {
                try
                {
                    estudiante = db.Estudiante.Find(IdEstudiante);
                }catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(estudiante);
        }
        public static List <Estudiantes> GetLista()
        {
            List <Estudiantes> lista = new List <Estudiantes>();

            using (DetallesDb conexion = new DetallesDb())
            {
                try
                {
                    lista = conexion.Estudiante.ToList();
                }catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            return(lista);
        }
Example #11
0
        public static List <Estudiantes> GetList()
        {
            var Lista = new List <Estudiantes>();

            using (var Conexion = new DetallesDb())
            {
                try
                {
                    Lista = Conexion.Estudiante.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                return(Lista);
            }
        }
Example #12
0
        public static bool Insertar(Estudiantes nuevo)
        {
            bool retorno = false;

            try
            {
                var db = new DetallesDb();
                db.Estudiante.Add(nuevo);
                db.SaveChanges();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Example #13
0
        public static List <GruposEstudiantes> GetListEsttudiantes(int estudianteId)
        {
            var Lista = new List <GruposEstudiantes>();

            using (var Conexion = new DetallesDb())
            {
                try
                {
                    Lista = Conexion.GruposEstudiantes.Where(ge => ge.EstudianteId == estudianteId).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(Lista);
        }
Example #14
0
        public static Estudiantes Buscar(int id)
        {
            var estudiante = new Estudiantes();

            using (var Conexion = new DetallesDb())
            {
                try
                {
                    estudiante = Conexion.Estudiante.Find(id);
                    estudiante.Grupo.Count();
                }
                catch (Exception)
                {
                    throw;
                }
                return(estudiante);
            }
        }
Example #15
0
        public static Grupos Buscar(int grupoId)
        {
            var grupo = new Grupos();

            using (var Conexion = new DetallesDb())
            {
                try
                {
                    grupo = Conexion.Grupo.Find(grupoId);
                    grupo.Estudiante.Count();
                }
                catch (Exception)
                {
                    throw;
                }
                return(grupo);
            }
        }
Example #16
0
        public static List <GruposEstudiantes> GetList(int grupoId)
        {
            var Lista = new List <GruposEstudiantes>();

            using (var Conexion = new DetallesDb())
            {
                try
                {
                    Lista = Conexion.GruposEstudiantes.Where(ge => ge.GrupoId == grupoId).ToList();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    //throw;
                }
                return(Lista);
            }
        }
        public static void Guardar(Grupos G)
        {
            try
            {
                DetallesDb db = new DetallesDb();

                db.Grupo.Add(G);
                foreach (var est in G.Estudiante)
                {
                    db.Entry(est).State = System.Data.Entity.EntityState.Unchanged;
                }
                db.SaveChanges();
                db.Dispose();
            }catch (Exception)
            {
                throw;
            }
        }
        public static Grupos Buscar(int id)
        {
            Grupos grupos = new Grupos();

            using (var db = new DetallesDb())
            {
                try
                {
                    grupos = db.Grupo.Find(id);
                    //grupos..Count();
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(grupos);
        }
Example #19
0
        public static List <Estudiantes> GetList(List <GruposEstudiantes> ge)
        {
            var Lista = new List <Estudiantes>();

            using (var Conexion = new DetallesDb())
            {
                try
                {
                    foreach (var Estudiante in ge)
                    {
                        Lista.Add(Conexion.Estudiante.Find(Estudiante.EstudianteId));
                    }
                    //Lista = Conexion.Estudiante.Where(p => p.EstudiantesId == ge.e);
                }
                catch (Exception)
                {
                    throw;
                }
                return(Lista);
            }
        }
Example #20
0
        public static bool Insertar(Grupos nuevo)
        {
            bool retorno = false;

            try
            {
                var db = new DetallesDb();

                db.Grupo.Add(nuevo);
                foreach (var estudiante in nuevo.Estudiante)
                {
                    db.Entry(nuevo).State = System.Data.Entity.EntityState.Unchanged;
                }
                db.SaveChanges();

                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Example #21
0
        public static bool Insertar(List <GruposEstudiantes> nuevo)
        {
            bool retorno = false;

            using (var Conexion = new DetallesDb())
            {
                try
                {
                    foreach (var Estudiante in nuevo)
                    {
                        Conexion.GruposEstudiantes.Add(Estudiante);
                    }
                    Conexion.SaveChanges();
                    retorno = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    //throw;
                }
                return(retorno);
            }
        }