Пример #1
0
        protected void btnCadA_Click(object sender, EventArgs e)
        {
            BLL.Atleta Atl = new BLL.Atleta();
            Atl.Nome          = txtNomeA.Text;
            Atl.RG            = txtRGA.Text;
            Atl.CPF           = txtCPFA.Text;
            Atl.DataNas       = DateTime.Parse(txtDataNascA.Text);
            Atl.Email         = txtEmailA.Text;
            Atl.Etec          = ddlETEC.SelectedValue;
            Atl.RM            = txtRMA.Text;
            Atl.Senha         = txtSenhaA.Text;
            Atl.Modalidade    = txtModalidade.Text;
            Atl.Portabilidade = ddlPortabilidade.SelectedValue;

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

            AtlDAL.Cadastrar(Atl);

            Response.Write("<script>alert('Cadastro Efetuado')</script>");

            Response.Redirect("Index.aspx");
        }
Пример #2
0
        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>");
            }
        }