Ejemplo n.º 1
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            var novoAluno = new Models.pessoa();

            novoAluno.nome  = txtNome.Text;
            novoAluno.email = txtEmail.Text;
            novoAluno.curso = txtCurs.Text;
            novoAluno.ra    = txtRa.Text;
            novoAluno.chave = l1.Text;
            novoAluno.senha = txtSenha.Text;


            bool cadastrado = DAO.Aluno.Cadastrar(novoAluno);

            if (cadastrado)
            {
                Response.Write(ltMensagem1.Text = novoAluno.nome + " foi cadastrado com sucesso, guarde a sua chave --> " + novoAluno.chave + " <--");

                txtNome.Text  = "";
                txtEmail.Text = "";
                txtCurs.Text  = "";
                txtRa.Text    = "";
                txtSenha.Text = "";
                l1.Text       = "";
            }
            else
            {
                ltMensagem1.Text = " Ocorreu um erro ao tentar cadastrar " + novoAluno.nome;
            }
        }
Ejemplo n.º 2
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            var novoVisitante = new Models.pessoa();

            novoVisitante.nome  = txtNome.Text;
            novoVisitante.email = txtEmail.Text;
            novoVisitante.rg    = txtRg.Text;
            novoVisitante.senha = txtSenha.Text;
            novoVisitante.chave = l1.Text;

            bool cadastrado = DAO.Visitante.Cadastrar(novoVisitante);

            if (cadastrado)
            {
                ltMensagem.Text = novoVisitante.nome + " Foi cadastrado com sucesso ";
                txtNome.Text    = "";
                txtEmail.Text   = "";
                txtRg.Text      = "";
                txtSenha.Text   = "";
                l1.Text         = "";
            }
            else
            {
                ltMensagem.Text = " Ocorreu um erro ao tentar cadastrar " + novoVisitante.nome;
            }
        }