コード例 #1
0
        public int Inserir(Pessoa pessoa)
        {
            try
            {
                int result = pessoaDAL.Inserir(pessoa);

                return(result);
            }catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
        protected void BtnCadastrarPessoa(object sender, EventArgs e)
        {
            try
            {
                Pessoa p = new Pessoa();
                p.Nome     = txtNome.Text;
                p.Endereco = txtEndereco.Text;
                p.Email    = txtEmail.Text;

                PessoaDAL dal = new PessoaDAL();
                dal.Inserir(p);

                lblMensagem.Text = "Cadastrado com sucesso!";

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