Beispiel #1
0
        private void btnVisualizar_Click(object sender, EventArgs e)
        {
            try
            {
                vw_emprestimo_aluno locatario = dgvEmprestimo.CurrentRow.DataBoundItem as vw_emprestimo_aluno;

                frmCadastrar frm = new frmCadastrar();
                frm.PreencherCampos(locatario.id_emprestimo);
                ((frmPrincipal)this.ParentForm).CarregarPanel(frm);
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Referência de objeto não definida para uma instância de um objeto"))
                {
                    MessageBox.Show("Selecione um emprestimo!", "Biblioteca", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Beispiel #2
0
        private void btnRemover_Click(object sender, EventArgs e)
        {
            try
            {
                vw_emprestimo_aluno locatario = dgvEmprestimo.CurrentRow.DataBoundItem as vw_emprestimo_aluno;

                EmprestimoBusiness business = new EmprestimoBusiness();
                business.RemoverEmprestimo(locatario.id_emprestimo);

                MessageBox.Show("Emprestimo removido com sucesso!", "Biblioteca", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CarregarGrid();
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Referência de objeto não definida para uma instância de um objeto"))
                {
                    MessageBox.Show("Selecione um emprestimo!", "Biblioteca", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }