private void btnDeletar_Click(object sender, EventArgs e)
        {
            var bll = new LivrosBLL();

            bll.DeletarLivro(mgLivros);
            bll.CarregarGrid(mgLivros);
            bll.LimparCampos(txtTitulo, txtAutor, txtCategoria, txtLancamento, txtExemplares);
        }
示例#2
0
        private void BtnExcluir_Click(object sender, EventArgs e)
        {
            string erro = "Erro Não Previsto!";

            try
            {
                int id_livro = Convert.ToInt32(lblId.Text);

                livrosBLL.DeletarLivro(id_livro);
                MessageBox.Show("O livro " + txtNome.Text + " foi excluído com sucesso!");
                AtualizaGrid();
                BtnLimpar_Click(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
                erro = "Erro Não Previsto!";
            }
        }