Esempio n. 1
0
        protected void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                int Codigo = Convert.ToInt32(txtCodigo.Text);

                Pessoa p = new Pessoa();

                p.Codigo = Codigo;

                PessoaDal d = new PessoaDal();

                d.Excluir(p.Codigo);


                lblMessagem.Text = " Cliente excluido com sucesso!! ";

                txtCodigo.Text   = string.Empty;
                txtNome.Text     = string.Empty;
                txtEndereco.Text = string.Empty;
                txtEndereco.Text = string.Empty;
            }
            catch (Exception ex)
            {
                lblMessagem.Text = ex.Message;
            }
        }
        protected void ExcluirPessoa(object sender, EventArgs e)
        {
            try
            {
                int       idPessoa = Convert.ToInt32(txtIdPessoa.Text);
                PessoaDal d        = new PessoaDal();
                d.Excluir(idPessoa);

                painel.Visible   = false;
                lblMensagem.Text = "Pessoa excluida com sucesso !";
            }
            catch
            {
                painel.Visible       = true;
                lblMensagemFail.Text = "Erro ao tentar excluir pessoa !";
            }
        }
        protected void btnExcluirCliente(object sender, EventArgs e)
        {
            try
            {
                int       Codigo = Convert.ToInt32(txtCodigo.Text);
                Pessoa    p      = new Pessoa();
                PessoaDal d      = new PessoaDal();

                d.Excluir(Codigo);
                lblMensagem.Visible = true;
                lblMensagem.Text    = "Cliente Excluido com Sucesso!";

                txtCodigo.Text   = string.Empty;
                txtNome.Text     = string.Empty;
                txtEndereco.Text = string.Empty;
                txtEmail.Text    = string.Empty;
            }
            catch (Exception ex)
            {
                lblMensagemErro.Text = ex.Message;
            }
        }