コード例 #1
0
        protected void btnCadA_Click(object sender, EventArgs e)
        {
            BLL.Torcedor Torc = new BLL.Torcedor();
            Torc.Nome      = txtNomeT.Text;
            Torc.RG        = txtRGT.Text;
            Torc.CPF       = txtCPFT.Text;
            Torc.DataNas   = DateTime.Parse(txtDataNascT.Text);
            Torc.Email     = txtEmailT.Text;
            Torc.AnoLetivo = ddlAN.SelectedValue;
            Torc.Etec      = ddlETEC.SelectedValue;
            Torc.RM        = txtRMT.Text;
            Torc.Senha     = txtSenhaT.Text;

            DAL.TorcedorDAL TorcDAL = new DAL.TorcedorDAL();

            TorcDAL.Cadastrar(Torc);

            Response.Write("<script>alert('Cadastro Efetuado')</script>");
            Response.Redirect("Index.aspx");
        }
コード例 #2
0
ファイル: Registro.aspx.cs プロジェクト: NTEI-TCC/Tcc-Certo
        protected void btnEntrar_Click(object sender, EventArgs e)
        {
            BLL.Atleta    AT = new BLL.Atleta();
            BLL.Professor PF = new BLL.Professor();
            BLL.Torcedor  TO = new BLL.Torcedor();
            //FAZ UM DESSE DE ADMINISTRADOR

            string ca = ddlgn.SelectedValue;

            if (ca == "Professor")
            {
                BLL.Professor pro = new BLL.Professor();

                pro.Email = txtEmail.Text;
                pro.Senha = txtSenha.Text;

                DAL.ProfessorDAL proDAL = new DAL.ProfessorDAL();

                pro = proDAL.Login(pro);

                if (pro.CodProf == 0)
                {
                    Response.Write("<script>alert('Login inválido')</script>");

                    txtEmail.Text = "";
                    txtSenha.Text = "";
                    txtEmail.Focus();
                }
                else
                {
                    Response.Redirect("Home.aspx");
                }
            }
            else if (ca == "Atleta")
            {
                BLL.Atleta atl = new BLL.Atleta();

                atl.Email = txtEmail.Text;
                atl.Senha = txtSenha.Text;

                DAL.AtletaDAL atlDAL = new DAL.AtletaDAL();

                atl = atlDAL.Login(atl);

                if (atl.CodA == 0)
                {
                    Response.Write("<script>alert('Login inválido')</script>");

                    txtEmail.Text = "";
                    txtSenha.Text = "";
                    txtEmail.Focus();
                }
                else
                {
                    Response.Redirect("Home.aspx");
                }
            }
            else if (ca == "Torcedor")
            {
                BLL.Torcedor tor = new BLL.Torcedor();

                tor.Email = txtEmail.Text;
                tor.Senha = txtSenha.Text;

                DAL.TorcedorDAL torDAL = new DAL.TorcedorDAL();

                tor = torDAL.Login(tor);

                if (tor.CodT == 0)
                {
                    Response.Write("<script>alert('Login inválido')</script>");

                    txtEmail.Text = "";
                    txtSenha.Text = "";
                    txtEmail.Focus();
                }
                else
                {
                    Response.Redirect("Home.aspx");
                }
            }
            else if (ca == "Administrador")
            {
                //FAZER O MESMO QUE OS OUTROS SÓ QUE PARA ADMIN
            }
            else
            {
                Response.Write("<script>alert('Categoria inválida!')</script>");
            }
        }