Exemple #1
0
 void cargar()
 {
     using (REGISTROEntities bd = new REGISTROEntities())
     {
         dgvMaterias.DataSource = bd.Materias.ToList();
     }
 }
Exemple #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text != "" && txtApellido.Text != "" && txtUsuario.Text != "" && txtContra.Text != "")
            {
                using (REGISTROEntities bd = new REGISTROEntities())
                {
                    Estudiante es = new Estudiante();

                    es.nombre_estudiante = txtNombre.Text;
                    es.apellido          = txtApellido.Text;
                    es.usuario           = txtUsuario.Text;
                    es.contraseña        = txtContra.Text;

                    bd.Estudiantes.Add(es);
                    bd.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("No se aceptan valores vacios");
            }

            cargar();
            limpiar();
        }
Exemple #3
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text != "" && txtApellido.Text != "" && txtUsuario.Text != "" && txtContra.Text != "")
            {
                using (REGISTROEntities bd = new REGISTROEntities())
                {
                    Estudiante es = new Estudiante();

                    string id  = dgvEstudiantes.CurrentRow.Cells[0].Value.ToString();
                    int    id2 = int.Parse(id);
                    es = bd.Estudiantes.Where(verificarId => verificarId.Id_estudiante == id2).First();
                    es.nombre_estudiante = txtNombre.Text;
                    es.apellido          = txtApellido.Text;
                    es.usuario           = txtUsuario.Text;
                    es.contraseña        = txtContra.Text;
                    bd.Entry(es).State   = System.Data.Entity.EntityState.Modified;
                    bd.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("No se aceptan valores vacios");
            }


            cargar();
            limpiar();
        }
 private void dgvNotas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     using (REGISTROEntities bd = new REGISTROEntities())
     {
         string id  = dgvNotas.CurrentRow.Cells[0].Value.ToString();
         int    id2 = int.Parse(id);
         no = bd.Calificaciones.Where(verificarId => verificarId.Id_notas == id2).First();
         txtIdEstudiante.Text = Convert.ToString(no.Id_estudiante);
         txtIdNotas.Text      = Convert.ToString(no.Id_notas);
         txtIdMateria.Text    = Convert.ToString(no.Id_materia);
         txtNota.Text         = Convert.ToString(no.nota);
     }
 }
Exemple #5
0
        private void dgvEstudiantes_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            using (REGISTROEntities bd = new REGISTROEntities())
            {
                string nombre   = dgvEstudiantes.CurrentRow.Cells[1].Value.ToString();
                string apellido = dgvEstudiantes.CurrentRow.Cells[2].Value.ToString();
                string usuario  = dgvEstudiantes.CurrentRow.Cells[3].Value.ToString();
                string contra   = dgvEstudiantes.CurrentRow.Cells[4].Value.ToString();

                txtNombre.Text   = nombre;
                txtApellido.Text = apellido;
                txtUsuario.Text  = usuario;
                txtContra.Text   = contra;
            }
        }
Exemple #6
0
        private void frmMaterias_Load(object sender, EventArgs e)
        {
            using (REGISTROEntities bd = new REGISTROEntities())
            {
                var lista = from materias in bd.Materias


                            select new
                {
                    ID     = materias.Id_materia,
                    NOMBRE = materias.nombre_materia
                };

                dgvMaterias.DataSource = lista.ToList();
            }
        }
Exemple #7
0
        void cargar()
        {
            using (REGISTROEntities bd = new REGISTROEntities())
            {
                var lista = from es in bd.Estudiantes

                            select new
                {
                    ID         = es.Id_estudiante,
                    NOMBRE     = es.nombre_estudiante,
                    APELLIDO   = es.apellido,
                    USUARIO    = es.usuario,
                    CONTRASEÑA = es.contraseña
                };

                dgvEstudiantes.DataSource = lista.ToList();
            }
        }
Exemple #8
0
        private void frmRegistro_Estudiantes_Load(object sender, EventArgs e)
        {
            using (REGISTROEntities bd = new REGISTROEntities())
            {
                var lista = from es in bd.Estudiantes

                            select new
                {
                    ID         = es.Id_estudiante,
                    NOMBRE     = es.nombre_estudiante,
                    APELLIDO   = es.apellido,
                    USUARIO    = es.usuario,
                    CONTRASEÑA = es.contraseña
                };

                dgvEstudiantes.DataSource = lista.ToList();
            }
            cargar();
        }
Exemple #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtNombreMateria.Text != "")
            {
                using (REGISTROEntities bd = new REGISTROEntities())
                {
                    Materia ma = new Materia();

                    ma.nombre_materia = txtNombreMateria.Text;
                    bd.Materias.Add(ma);
                    bd.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("No se aceptan valores vacios");
            }
            Limpiar();
            cargar();
        }
Exemple #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (REGISTROEntities bd = new REGISTROEntities()) {
                var acceso = from es in bd.Estudiantes
                             where es.usuario == txtUsuario.Text &&
                             es.contraseña == txtContra.Text
                             select es;

                if (acceso.Count() > 0)
                {
                    frmMenu menu = new frmMenu();
                    menu.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("  Datos ingresados\n" +
                                    "     no existentes");
                }
            }
        }
        private void frmNotas_Load(object sender, EventArgs e)
        {
            using (REGISTROEntities bd = new REGISTROEntities())
            {
                var union = from es in bd.Estudiantes
                            from no in bd.Calificaciones
                            from ma in bd.Materias
                            where es.Id_estudiante == no.Id_estudiante &&
                            ma.Id_materia == no.Id_materia


                            select new
                {
                    ID_NOTAS          = no.Id_notas,
                    NOMBRE_ESTUDIANTE = es.nombre_estudiante,
                    NOMBRE_MATERIA    = ma.nombre_materia,
                    NOTA = no.nota
                };
                dgvNotas.DataSource = union.ToList();
            }
            cargar();
        }
Exemple #12
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (txtNombreMateria.Text != "")
            {
                using (REGISTROEntities bd = new REGISTROEntities())
                {
                    Materia ma = new Materia();
                    string  id = dgvMaterias.CurrentRow.Cells[0].Value.ToString();

                    ma = bd.Materias.Find(int.Parse(id));
                    bd.Materias.Remove(ma);
                    bd.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("No se aceptan valores vacios");
            }

            Limpiar();
            cargar();
        }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (txtIdEstudiante.Text != "" && txtIdMateria.Text != "" && txtNota.Text != "")
            {
                using (REGISTROEntities bd = new REGISTROEntities())
                {
                    Calificacione no = new Calificacione();

                    string id  = dgvNotas.CurrentRow.Cells[0].Value.ToString();
                    int    id1 = int.Parse(id);
                    no = bd.Calificaciones.Where(verificarId => verificarId.Id_notas == id1).First();
                    bd.Entry(no).State = System.Data.Entity.EntityState.Deleted;
                    bd.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("No se aceptan valores vacios");
            }

            cargar();
            limpiar();
        }
Exemple #14
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (txtNombreMateria.Text != "")
            {
                using (REGISTROEntities bd = new REGISTROEntities())
                {
                    Materia ma  = new Materia();
                    string  id  = dgvMaterias.CurrentRow.Cells[0].Value.ToString();
                    int     idc = int.Parse(id);
                    ma = bd.Materias.Where(VerificarId => VerificarId.Id_materia == idc).First();
                    ma.nombre_materia  = txtNombreMateria.Text;
                    bd.Entry(ma).State = System.Data.Entity.EntityState.Modified;
                    bd.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("No se aceptan valores vacios");
            }

            Limpiar();
            cargar();
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtIdEstudiante.Text != "" && txtIdMateria.Text != "" && txtNota.Text != "")
            {
                using (REGISTROEntities bd = new REGISTROEntities())
                {
                    Calificacione no = new Calificacione();

                    no.nota          = int.Parse(txtNota.Text);
                    no.Id_estudiante = int.Parse(txtIdEstudiante.Text);
                    no.Id_materia    = int.Parse(txtIdMateria.Text);
                    bd.Calificaciones.Add(no);
                    bd.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("No se aceptan valores vacios");
            }


            cargar();
            limpiar();
        }