コード例 #1
0
        protected void btnCadP_Click(object sender, EventArgs e)
        {
            BLL.Professor Prof = new BLL.Professor();

            Prof.Nome  = txtNomeP.Text;
            Prof.RG    = txtRGP.Text;
            Prof.CPF   = txtCPFP.Text;
            Prof.CREF  = txtCref.Text;
            Prof.Email = txtEmailP.Text;
            Prof.Etec  = ddlETEC.SelectedValue;
            Prof.Senha = txtSenhaP.Text;

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

            ProfDAL.Cadastrar(Prof);

            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>");
            }
        }