Beispiel #1
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNombres.Text == "" || txtApellidos.Text == "" || txtUsuario.Text == "" || txtPassword.Text == "")
                {
                    MessageBox.Show("No se permiten incersiones en blanco, \ncomplete todos los campos.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    using (notasEstudiantesEntities bd = new notasEstudiantesEntities())
                    {
                        student.nombresEstudiante = txtNombres.Text;
                        student.apellidos         = txtApellidos.Text;
                        student.usuario           = txtUsuario.Text;
                        student.contrasenia       = txtPassword.Text;

                        bd.estudiante.Add(student);
                        bd.SaveChanges();
                    }

                    dtvEstudiantes.Rows.Clear();
                    CargarDatos();
                    LimpiarDatos();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al Insertar: \n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIdEstudiante.Text == "" || txtIdMateria.Text == "" || txtNota.Text == "")
                {
                    MessageBox.Show("Para eliminar, primero seleccione \nun id en específico.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    using (notasEstudiantesEntities bd = new notasEstudiantesEntities())
                    {
                        String id = dtvNotas.CurrentRow.Cells[0].Value.ToString();

                        grade = bd.notas.Find(int.Parse(id));
                        bd.notas.Remove(grade);
                        bd.SaveChanges();
                    }

                    dtvNotas.Rows.Clear();
                    CargarDatos();
                    LimpiarDatos();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al Eliminar: \n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtMateria.Text == "")
                {
                    MessageBox.Show("No se permiten incersiones en blanco, \ncomplete todos los campos.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    using (notasEstudiantesEntities bd = new notasEstudiantesEntities())
                    {
                        subject.nombreMateria = txtMateria.Text;

                        bd.materia.Add(subject);
                        bd.SaveChanges();
                    }

                    dtvMateria.Rows.Clear();
                    CargarDatos();
                    LimpiarDatos();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al Insertar: \n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #4
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtMateria.Text == "")
                {
                    MessageBox.Show("Para actualizar, primero seleccione \nuna materia en específica.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    using (notasEstudiantesEntities bd = new notasEstudiantesEntities())
                    {
                        String id = dtvMateria.CurrentRow.Cells[0].Value.ToString();

                        int idC = int.Parse(id);

                        subject = bd.materia.Where(VerificarId => VerificarId.idMateria == idC).First();
                        subject.nombreMateria = txtMateria.Text;

                        bd.Entry(subject).State = System.Data.Entity.EntityState.Modified;
                        bd.SaveChanges();
                    }

                    dtvMateria.Rows.Clear();
                    CargarDatos();
                    LimpiarDatos();
                    this.btnRegistrar.Enabled = true;
                    //this.btnActualizar.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al Actualizar: \n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #5
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIdEstudiante.Text == "" || txtIdMateria.Text == "" || txtNota.Text == "")
                {
                    MessageBox.Show("No se permiten incersiones en blanco, \ncomplete todos los campos.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    using (notasEstudiantesEntities bd = new notasEstudiantesEntities())
                    {
                        grade.idEstudiante = int.Parse(txtIdEstudiante.Text);
                        grade.idMateria    = int.Parse(txtIdMateria.Text);
                        grade.nota         = double.Parse(txtNota.Text);

                        bd.notas.Add(grade);
                        bd.SaveChanges();
                    }

                    dtvNotas.Rows.Clear();
                    CargarDatos();
                    LimpiarDatos();

                    this.btnNuevo.Enabled      = true;
                    this.btnRegistrar.Enabled  = false;
                    this.btnActualizar.Enabled = false;
                    this.btnEliminar.Enabled   = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al Insertar: \n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #6
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIdEstudiante.Text == "" || txtIdMateria.Text == "" || txtNota.Text == "")
                {
                    MessageBox.Show("Para actualizar, primero seleccione \nun id en específico.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    using (notasEstudiantesEntities bd = new notasEstudiantesEntities())
                    {
                        String id = dtvNotas.CurrentRow.Cells[0].Value.ToString();

                        int idC = int.Parse(id);

                        grade = bd.notas.Where(VerificarId => VerificarId.idNotas == idC).First();
                        grade.idEstudiante = int.Parse(txtIdEstudiante.Text);
                        grade.idMateria    = int.Parse(txtIdMateria.Text);
                        grade.nota         = double.Parse(txtNota.Text);

                        bd.Entry(grade).State = System.Data.Entity.EntityState.Modified;
                        bd.SaveChanges();
                    }

                    dtvNotas.Rows.Clear();
                    CargarDatos();
                    LimpiarDatos();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al Actualizar: \n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #7
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (txtNombres.Text == "" || txtApellidos.Text == "" || txtUsuario.Text == "" || txtPassword.Text == "" || txtVerifyPass.Text == "")
            {
                MessageBox.Show("Todos los campos son requeridos.", "Completar", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (txtPassword.Text == txtVerifyPass.Text)
                {
                    using (notasEstudiantesEntities bd = new notasEstudiantesEntities())
                    {
                        student.nombresEstudiante = txtNombres.Text;
                        student.apellidos         = txtApellidos.Text;
                        student.usuario           = txtUsuario.Text;
                        student.contrasenia       = txtPassword.Text;

                        bd.estudiante.Add(student);
                        bd.SaveChanges();
                    }

                    Limpiar();
                    FrmMenuPrincipal log = new FrmMenuPrincipal();
                    MessageBox.Show("¡Te Damos la Bienvenida!");
                    log.Show();
                    this.Hide();
                    //Preguntar como validar
                }
                else
                {
                    MessageBox.Show("¡Las contraseñas no coinciden!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Beispiel #8
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (notasEstudiantesEntities db = new notasEstudiantesEntities())
     {
         mate.nombre_materia = txtNombreMat.Text;
         db.materia.Add(mate);
         db.SaveChanges();
     }
     MessageBox.Show("Guardado con exito");
 }
Beispiel #9
0
 private void button3_Click(object sender, EventArgs e)
 {
     using (notasEstudiantesEntities db = new notasEstudiantesEntities())
     {
         String id = dtvNota.CurrentRow.Cells[0].Value.ToString();
         n = db.notas.Find(int.Parse(id));
         db.notas.Remove(n);
         db.SaveChanges();
     }
     CargarDatos();
 }
Beispiel #10
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            materia M = new materia();

            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                M.nombre_materia = txtMateria.Text;
                db.materias.Add(M);
                db.SaveChanges();
            }
            cargardatos();
            limpiardatos();
        }
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     using (notasEstudiantesEntities db = new notasEstudiantesEntities())
     {
         string id = dtvNotas.CurrentRow.Cells[0].Value.ToString();
         nots = db.notas.Find(int.Parse(id));
         db.notas.Remove(nots);
         db.SaveChanges();
     }
     dtvNotas.Rows.Clear();
     limpiar();
     CargarDatos();
 }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                mat.nombre_materia = txtNombreMateria.Text;

                db.materia.Add(mat);
                db.SaveChanges();
            }
            dtvMateria.Rows.Clear();
            limpiar();
            CargarDatos();
        }
Beispiel #13
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (notasEstudiantesEntities db = new notasEstudiantesEntities())
     {
         n.id_estudiante = Convert.ToInt32(txtEstudiante.Text);
         n.id_materia    = Convert.ToInt32(txtMateria.Text);
         n.notas1        = Convert.ToInt32(txtNota.Text);
         db.notas.Add(n);
         db.SaveChanges();
     }
     MessageBox.Show("Guardado con exito");
     CargarDatos();
 }
 private void button1_Click(object sender, EventArgs e)
 {
     using (notasEstudiantesEntities db = new notasEstudiantesEntities())
     {
         estud.nombre_estudiante = txtEstudiante.Text;
         estud.apellido          = txtApellido.Text;
         estud.usuario           = txtUsuario.Text;
         estud.contraseña        = txtContraseña.Text;
         db.estudiante.Add(estud);
         db.SaveChanges();
     }
     MessageBox.Show("Guardado con exito");
 }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            nota note = new nota();

            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                note.id_estudiante = Convert.ToInt32(txtIdA.Text);
                note.id_materia    = Convert.ToInt32(txtIdM.Text);
                note.nota1         = Convert.ToInt32(txtNota.Text);
                db.notas.Add(note);
                db.SaveChanges();
            }
            cargardatos();
            limpiardatos();
        }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            nota note = new nota();

            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                string Id = dvgNotas.CurrentRow.Cells[0].Value.ToString();

                note = db.notas.Find(int.Parse(Id));
                db.notas.Remove(note);
                db.SaveChanges();
            }
            cargardatos();
            limpiardatos();
        }
Beispiel #17
0
 private void button2_Click(object sender, EventArgs e)
 {
     using (notasEstudiantesEntities db = new notasEstudiantesEntities())
     {
         String Id  = dtvNota.CurrentRow.Cells[0].Value.ToString();
         int    IdC = int.Parse(Id);
         n = db.notas.Where(VerificarID => VerificarID.id_notas == IdC).First();
         n.id_estudiante   = Convert.ToInt32(txtEstudiante.Text);
         n.id_materia      = Convert.ToInt32(txtMateria.Text);
         n.notas1          = Convert.ToInt32(txtNota.Text);
         db.Entry(n).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     CargarDatos();
 }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                est.nombre_estudiante = txtNombreEstudiante.Text;
                est.apellido          = txtApellido.Text;
                est.contraseña        = txtContraseña.Text;
                est.usuario           = txtUsuario.Text;

                db.estudiante.Add(est);
                db.SaveChanges();
            }
            dtvEstudiantes.Rows.Clear();
            limpiar();
            CargarDatos();
        }
Beispiel #19
0
        private void button2_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                String id  = dtvMat.CurrentRow.Cells[1].Value.ToString();
                int    idC = int.Parse(id);
                mate = db.materia.Where(VerificarID => VerificarID.id_materia == idC).First();


                mate.nombre_materia = txtNombreMat.Text;

                db.Entry(mate).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            CargarDatos();
        }
Beispiel #20
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            materia M = new materia();

            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                string Id  = dvgMaterias.CurrentRow.Cells[0].Value.ToString();
                int    IdC = int.Parse(Id);
                M = db.materias.Where(VerificarId => VerificarId.id_materia == IdC).First();
                M.nombre_materia  = txtMateria.Text;
                db.Entry(M).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            cargardatos();
            limpiardatos();
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            estudiante Student = new estudiante();

            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                Student.nombre_estudiante = txtNombre.Text;
                Student.apellido          = txtApellido.Text;
                Student.usuario           = txtUsuario.Text;
                Student.contrasena        = txtPass.Text;
                db.estudiantes.Add(Student);
                db.SaveChanges();
            }
            cargardatos();
            limpiardatos();
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                nots.id_estudiante = int.Parse(txtIdEstudiante.Text);
                nots.id_materia    = int.Parse(txtIdMateria.Text);
                nots.notas1        = double.Parse(txtNota.Text);


                db.notas.Add(nots);
                db.SaveChanges();
            }
            dtvNotas.Rows.Clear();
            limpiar();
            CargarDatos();
        }
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                string Notas = dtvNotas.CurrentRow.Cells[0].Value.ToString();
                int    Idc   = int.Parse(Notas);
                nots        = db.notas.Where(verificarId => verificarId.id_notas == Idc).First();
                nots.notas1 = double.Parse(txtNota.Text);


                db.Entry(nots).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            dtvNotas.Rows.Clear();
            limpiar();
            CargarDatos();
        }
Beispiel #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                String id  = dtvAct.CurrentRow.Cells[0].Value.ToString();
                int    idC = int.Parse(id);
                estud = db.estudiante.Where(VerificarID => VerificarID.id_estudiante == idC).First();

                estud.nombre_estudiante = txtEstudiante.Text;
                estud.apellido          = txtApellido.Text;
                estud.usuario           = txtUsuario.Text;
                estud.contraseña        = txtContraseña.Text;
                db.Entry(estud).State   = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            CargarDatos();
        }
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                string Id  = dtvMateria.CurrentRow.Cells[0].Value.ToString();
                int    Idc = int.Parse(Id);
                mat = db.materia.Where(verificarId => verificarId.id_materia == Idc).First();
                mat.nombre_materia = txtNombreMateria.Text;


                db.Entry(mat).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            dtvMateria.Rows.Clear();
            limpiar();
            CargarDatos();
        }
        private void btnEditar_Click(object sender, EventArgs e)
        {
            nota note = new nota();

            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                string Id  = dvgNotas.CurrentRow.Cells[0].Value.ToString();
                int    IdC = int.Parse(Id);
                note = db.notas.Where(VerificarId => VerificarId.id_notas == IdC).First();
                note.id_estudiante   = Convert.ToInt32(txtIdA.Text);
                note.id_materia      = Convert.ToInt32(txtIdM.Text);
                note.nota1           = Convert.ToInt32(txtNota.Text);
                db.Entry(note).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            cargardatos();
            limpiardatos();
        }
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                string Id  = dtvEstudiantes.CurrentRow.Cells[0].Value.ToString();
                int    Idc = int.Parse(Id);
                est = db.estudiante.Where(verificarId => verificarId.id_estudiante == Idc).First();
                est.nombre_estudiante = txtNombreEstudiante.Text;
                est.apellido          = txtApellido.Text;
                est.contraseña        = txtContraseña.Text;
                est.usuario           = txtUsuario.Text;

                db.Entry(est).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            dtvEstudiantes.Rows.Clear();
            limpiar();
            CargarDatos();
        }
        private void btnEditar_Click(object sender, EventArgs e)
        {
            estudiante Student = new estudiante();

            using (notasEstudiantesEntities db = new notasEstudiantesEntities())
            {
                string Id  = dvgEstudiantes.CurrentRow.Cells[0].Value.ToString();
                int    IdC = int.Parse(Id);
                Student = db.estudiantes.Where(VerificarId => VerificarId.id_estudiante == IdC).First();
                Student.nombre_estudiante = txtNombre.Text;
                Student.apellido          = txtApellido.Text;
                Student.usuario           = txtUsuario.Text;
                Student.contrasena        = txtPass.Text;
                db.Entry(Student).State   = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            cargardatos();
            limpiardatos();
        }