Esempio n. 1
0
 private void BtnAgregar_Click(object sender, EventArgs e)
 {
     if (ContarErrores(this) == 0)
     {
         try
         {
             ObjetoEntidadInstructor.Nombres   = Nombretxt.Text;
             ObjetoEntidadInstructor.Apellidos = Apellidotxt.Text;
             ObjetoEntidadInstructor.Idgrupo   = IdGrupo;
             ObjetoEntidadInstructor.Contacto  = contactotxt.Text;
             ObjetoEntidadInstructor.Correo    = Correotxt.Text;
             ObjetoNegocioInstructor.InsertInstructor(ObjetoEntidadInstructor);
             FrmSuccess.ConfirmacionForm("Registro Guardado!");
             Limpiar();
             MostrarBuscarTabla("");
             InstructoresData.ClearSelection();
         }
         catch (Exception ex)
         {
             MessageBox.Show("ERROR: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         FrmWarning.WarningForm("Verificar errores");
     }
 }
Esempio n. 2
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            if (IdInstructor != 0)
            {
                DialogResult result = new DialogResult();
                FrmDialog    frm    = new FrmDialog("Eliminar");
                result = frm.ShowDialog();

                if (result == DialogResult.OK)

                {
                    try
                    {
                        ObjetoEntidadInstructor.Idinstructor = IdInstructor;
                        ObjetoNegocioInstructor.DeletetInstructor(ObjetoEntidadInstructor);
                        FrmSuccess.ConfirmacionForm("Registro Eliminado!");
                        Limpiar();
                        MostrarBuscarTabla("");
                        InstructoresData.ClearSelection();
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show("ERROR: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else

            {
                FrmWarning.WarningForm("Seleccione un registro si desea eliminarlo");
            }
        }
Esempio n. 3
0
        private void BtnEditar_Click(object sender, EventArgs e)
        {
            if (ContarErrores(this) == 0)
            {
                if (InstructoresData.SelectedRows.Count > 0)
                {
                    DialogResult result = new DialogResult();
                    FrmDialog    frm    = new FrmDialog("Modificar");
                    result = frm.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        try
                        {
                            ObjetoEntidadInstructor.Idinstructor = IdInstructor;
                            ObjetoEntidadInstructor.Nombres      = Nombretxt.Text;
                            ObjetoEntidadInstructor.Apellidos    = Apellidotxt.Text;
                            ObjetoEntidadInstructor.Idgrupo      = IdGrupo;
                            ObjetoEntidadInstructor.Contacto     = contactotxt.Text;
                            ObjetoEntidadInstructor.Correo       = Correotxt.Text;

                            ObjetoNegocioInstructor.UpdatetInstructor(ObjetoEntidadInstructor);
                            FrmSuccess.ConfirmacionForm("Registro Modificado!");
                            Limpiar();
                            MostrarBuscarTabla("");
                            InstructoresData.ClearSelection();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("ERROR: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    FrmWarning.WarningForm("Seleccione una fila para modificar");
                }
            }
            else
            {
                FrmWarning.WarningForm("Verificar errores");
            }
        }
Esempio n. 4
0
        public static void WarningForm(string mensaje)
        {
            FrmWarning frm = new FrmWarning(mensaje);

            frm.ShowDialog();
        }