Пример #1
0
        private void Procesar()
        {
            CLS.Maestros_Secciones oEntidad = new CLS.Maestros_Secciones();
            oEntidad.IDMaestro_Seccion = txbIDMaestro_Seccion.Text;
            oEntidad.IDMaestro         = txbIDMaestro.Text;
            oEntidad.IDSeccion         = cbbSecciones.SelectedValue.ToString();

            try
            {
                if (oEntidad.Guardar())
                {
                    MessageBox.Show("Registro ingresado correctamente", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Close();
                }
                else
                {
                    MessageBox.Show("Ocurrió un problema al guardar", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
            }
        }
Пример #2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("¿Realmente desea ELIMINAR el registro seleccionado?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    CLS.Maestros_Secciones oEntidad = new CLS.Maestros_Secciones();
                    oEntidad.IDMaestro_Seccion = dtgMaestrosSecciones.CurrentRow.Cells["IDMaestro_Seccion"].Value.ToString();

                    if (oEntidad.Eliminar())
                    {
                        MessageBox.Show("Registro eliminado correctamente", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Cargar();
                    }
                    else
                    {
                        MessageBox.Show("Registro no pudo ser eliminado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch
            {
            }
        }