示例#1
0
 private void BtnExcluir_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Tem certeza que deseja excluir?", "Atenção",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         leitorBLL.ExcluirLeitor(leitor.ID);
         AtualizarGrid();
         txtLeitor.Clear();
         btnExcluir.Enabled = false;
         btnAlterar.Enabled = false;
     }
 }
示例#2
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     try
     {
         LeitorBLL leitorBLL = new LeitorBLL();
         leitorBLL.ExcluirLeitor(int.Parse(txtIdLeitor.Text));
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro: " + ex.Message.ToString());
     }
 }
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIdLeitor.Text == "")
                {
                    throw new Exception("Digite o id do Leitor antes de exclui-lo");
                }

                Leitor leitor = new Leitor(int.Parse(txtIdLeitor.Text), "", "", "", "");

                LeitorBLL leitorBLL = new LeitorBLL();
                leitorBLL.ExcluirLeitor(leitor);
                btnLimpar.PerformClick();
                MessageBox.Show("Leitor excluido com sucesso");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message.ToString());
            }
        }