Exemple #1
0
        /*protected void btnLogin_Click(object sender, EventArgs e)
         * {
         *  Response.Redirect("Login.aspx");
         * }*/

        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            BLL.Aluno alu = new BLL.Aluno();

            lo.Usuario = txtUsuario.Text;
            lo.Senha   = BLL.Criptografia.getMdIHash(txtSenha.Text);
            lo.Tipo    = 1;



            alu.Nome       = txtNome.Text;
            alu.Cpf        = txtCpf.Text;
            alu.Rg         = txtRg.Text;
            alu.Nascimento = DateTime.Parse(txtNasc.Text);
            alu.Cep        = txtCep.Text;
            alu.Estado     = DropDownList.SelectedValue;
            alu.Bairro     = txtBairro.Text;
            alu.Cidade     = txtCidade.Text;
            alu.RuaAv      = txtRuaAv.Text;
            alu.Numero     = txtNum.Text;
            alu.Email      = txtEmail.Text;
            alu.Telefone   = txtTelefone.Text;

            if (CheckBox1.Checked == true)
            {
                alu.IdLogin = loDAL.Cadastrar(lo);

                DAL.AlunoDAL aluDAL = new DAL.AlunoDAL();

                aluDAL.Cadastrar(alu);

                txtUsuario.Text            = "";
                txtNome.Text               = "";
                txtCpf.Text                = "";
                txtSenha.Text              = "";
                txtRg.Text                 = "";
                txtNasc.Text               = "";
                txtCep.Text                = "";
                DropDownList.SelectedIndex = 1;
                txtBairro.Text             = "";
                txtCidade.Text             = "";
                txtRuaAv.Text              = "";
                txtNum.Text                = "";
                txtEmail.Text              = "";
                txtTelefone.Text           = "";
                txtNome.Focus();

                Response.Write("<script>alert('Cadastro efetuado!')</script>");
            }
            else
            {
                litAviso.Text = "Você deve concordar com termos para continuar!";
            }


            //btnLogin_Click(null, null);
        }
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                BLL.Aluno aluno = new BLL.Aluno();
                aluno.Nome = txtNome.Text;
                aluno.Cpf  = txtCpf.Text;

                DAL.AlunoDAL alunoDAL = new DAL.AlunoDAL();

                alunoDAL.Cadastrar(aluno);

                lblMsg.Text  = "Aluno cadastrado";
                txtCpf.Text  = "";
                txtNome.Text = "";
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;
            }
        }