private void btnRemover_Click(object sender, EventArgs e) { CAMADAS.BLL.Livros bllLivros = new CAMADAS.BLL.Livros(); string msg = "Não há livros para remover"; string titBox = "Remover"; if (lblID.Text != "") { msg = "Deseja remover o livro: " + txtTitulo.Text; DialogResult resposta = MessageBox.Show(msg, titBox, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (resposta == DialogResult.Yes) { int id = Convert.ToInt32(lblID.Text); bllLivros.Delete(id); } } else { MessageBox.Show(msg, titBox, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } limpaControles(); dtgLivros.DataSource = ""; dtgLivros.DataSource = bllLivros.Select(); }
private void btnRemover_Click(object sender, EventArgs e) { CAMADAS.BLL.Livros bllLivro = new CAMADAS.BLL.Livros(); if (lblID.Text != "-1") { string msg = "Deseja Remover o atual livro?"; DialogResult resp = MessageBox.Show(msg, "Remover", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2); if (resp == DialogResult.Yes) { int idLivro = Convert.ToInt32(lblID.Text); bllLivro.Delete(idLivro); } } else { MessageBox.Show("Não há dados para Remover", "Remover", MessageBoxButtons.OK, MessageBoxIcon.Hand); } dgvLivros.DataSource = ""; dgvLivros.DataSource = bllLivro.Select(); limparControles(); }