private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (lblIdDetalle.Text != "")
            {
                DialogResult resultado = MessageBox.Show("¿Seguro que desea eliminar el registro numero " + lblIdDetalle.Text + "?", "SALIR", MessageBoxButtons.YesNo);
                if (resultado == DialogResult.Yes)
                {
                    DetalleGrupo detalle = new DetalleGrupo();

                    if (detalle.EliminarGrupo(int.Parse(lblIdDetalle.Text)) == true)
                    {
                        MessageBox.Show("El grupo ha sido eliminado correctamente", "¡Enhorabuena!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        ActualizarDataGrid();
                        lblIdDetalle.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("Error al eliminar registro", "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (resultado == DialogResult.No)
                {
                    dgvDetalles.ClearSelection();
                    lblIdDetalle.Text = "";
                }
            }
            else
            {
                MessageBox.Show("Seleccione una fila por favor", "¡Cuidado!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void cmbGrado_SelectedIndexChanged(object sender, EventArgs e)
        {
            string       grado   = cmbGrado.SelectedItem.ToString();
            DetalleGrupo detalle = new DetalleGrupo();

            detalle.obtenerCodigoGrado(lblIdGrado, grado);
        }
        private void cmbSeccion_SelectedIndexChanged(object sender, EventArgs e)
        {
            string       seccion = cmbSeccion.SelectedItem.ToString();
            DetalleGrupo detalle = new DetalleGrupo();

            detalle.obtenerCodigoSeccion(lblIdSeccion, seccion);
        }
Esempio n. 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            DetalleGrupo detalleGrupo = db.DetalleGrupo.Find(id);

            db.DetalleGrupo.Remove(detalleGrupo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        private void ActualizarDataGrid()
        {
            DetalleGrupo detalle = new DetalleGrupo();

            dgvDetalles.DataSource = null;
            dgvDetalles.DataSource = detalle.Mostrar();
            dgvDetalles.ClearSelection();
        }
        private void cmbProfesor_SelectedIndexChanged(object sender, EventArgs e)
        {
            string nombreProfesor = cmbProfesor.Text;


            DetalleGrupo detalle = new DetalleGrupo();

            detalle.obtenerCodigoProfesor(lblIdProfesor, nombreProfesor);
        }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "IdDetalleGrupo,IdGrupo,IdMiembro")] DetalleGrupo detalleGrupo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(detalleGrupo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdGrupo   = new SelectList(db.Grupo, "IdGrupo", "Nombre", detalleGrupo.IdGrupo);
     ViewBag.IdMiembro = new SelectList(db.Miembros, "IdMiembro", "Nombres", detalleGrupo.IdMiembro);
     return(View(detalleGrupo));
 }
Esempio n. 8
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DetalleGrupo detalleGrupo = db.DetalleGrupo.Find(id);

            if (detalleGrupo == null)
            {
                return(HttpNotFound());
            }
            return(View(detalleGrupo));
        }
 private void btnModificar_Click(object sender, EventArgs e)
 {
     if (lblIdDetalle.Text != "")
     {
         if (lblIdGrado.Text != "")
         {
             if (lblIdProfesor.Text != "")
             {
                 if (lblIdSeccion.Text != "")
                 {
                     try
                     {
                         DetalleGrupo detalle = new DetalleGrupo();
                         if (detalle.ModificarCurso(int.Parse(lblIdDetalle.Text), int.Parse(lblIdGrado.Text), int.Parse(lblIdSeccion.Text), int.Parse(lblIdProfesor.Text), int.Parse(dtpAnio.Text)) == true)
                         {
                             ActualizarDataGrid();
                             lblIdDetalle.Text = "";
                             MessageBox.Show("Grupo actualizado correctamente", "¡Enhorabuena!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                         else
                         {
                             MessageBox.Show("Error al actualizar el grupo", "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
                     }
                     catch (Exception ex)
                     {
                         MessageBox.Show("Error al actualizar el grupo " + ex.Message, "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Debe de seleccionar sección", "¡Cuidado!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             else
             {
                 MessageBox.Show("Debe de seleccionar profesor", "¡Cuidado!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Debe de seleccionar un grado", "¡Cuidado!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         MessageBox.Show("Seleccione registro para modificar", "¡Cuidado!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Esempio n. 10
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DetalleGrupo detalleGrupo = db.DetalleGrupo.Find(id);

            if (detalleGrupo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdGrupo   = new SelectList(db.Grupo, "IdGrupo", "Nombre", detalleGrupo.IdGrupo);
            ViewBag.IdMiembro = new SelectList(db.Miembros, "IdMiembro", "Nombres", detalleGrupo.IdMiembro);
            return(View(detalleGrupo));
        }
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     BorrarMensaje();
     if (validarCampos())
     {
         DetalleGrupo detalle = new DetalleGrupo();
         if (detalle.AgregarGrupo(int.Parse(lblIdGrado.Text), int.Parse(lblIdSeccion.Text), int.Parse(lblIdProfesor.Text), int.Parse(dtpAnio.Text)) == true)
         {
             MessageBox.Show("Los datos se han ingresado correctamente", "¡Enhorabuena!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             ActualizarDataGrid();
         }
         else
         {
             MessageBox.Show("Error al registrar grupo", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
 private void FrmDetalleGradoSeccion_Load(object sender, EventArgs e)
 {
     try
     {
         ActualizarDataGrid();
         DetalleGrupo detalle = new DetalleGrupo();
         detalle.llenarComboGrado(cmbGrado);
         detalle.llenarComboSeccion(cmbSeccion);
         detalle.llenarComboMaestros(cmbProfesor);
         lblIdDetalle.Text  = "";
         lblIdGrado.Text    = "";
         lblIdProfesor.Text = "";
         lblIdSeccion.Text  = "";
     }
     catch (Exception Ex)
     {
         MessageBox.Show("Error al mostrar datos " + Ex.Message, "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);;
     }
 }