Esempio n. 1
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo);
                if (d.ToString() == "Yes")
                {
                    //obj para gravar dados no bd
                    ConexaoDAL     conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão);
                    AtendimentoBLL bll     = new AtendimentoBLL(conexao);

                    bll.Excluir(Convert.ToInt32(ate_idTextBox.Text));
                    this.LimpaTela();
                    this.AlterarBotoes(1);
                }
            }//try
            catch
            {
                MessageBox.Show("Impossível excluir o registro.\n O registro está sendo utilizado em outro local.");
                this.AlterarBotoes(3);
            }
        }