Exemplo n.º 1
0
 public FrmMantAlumno(AlumnoRoot alumnoRoot)
 {
     InitializeComponent();
     _alumnoRoot = alumnoRoot;
     alumnoRootBindingSource.DataSource = _alumnoRoot;
     alumnoRootBindingSource.ResetBindings(false);
 }
Exemplo n.º 2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                var seleccionado = alumnoInfoListBindingSource.Current as AlumnoInfo;
                if (seleccionado == null)
                {
                    return;
                }

                if (MessageBox.Show("¿Está seguro que desea eliminar el registro?", "Confirme", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    AlumnoRoot.DeleteEditableRoot(seleccionado.Id);
                    btnCargar.PerformClick();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Exemplo n.º 3
0
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     using (var frm = new FrmMantAlumno(AlumnoRoot.NewEditableRoot()))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             btnCargar.PerformClick();
         }
     }
 }
Exemplo n.º 4
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                alumnoRootBindingSource.EndEdit();

                _alumnoRoot = _alumnoRoot.Save();

                DialogResult = DialogResult.OK;
            }
            catch (ValidationException)
            {
                MessageBox.Show(_alumnoRoot.GetBrokenRules().ToString());
            }
            catch (DataPortalException ex)
            {
                MessageBox.Show(ex.BusinessException.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            try
            {
                var seleccionado = alumnoInfoListBindingSource.Current as AlumnoInfo;
                if (seleccionado == null)
                {
                    return;
                }

                using (var frm = new FrmMantAlumno(AlumnoRoot.GetEditableRoot(seleccionado.Id)))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        btnCargar.PerformClick();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }