protected void BtnLogin_Click(object sender, EventArgs e)
    {
        DataSet ds  = Pef_Pessoa_FisicaBD.SelectLogin(LoginID.Text, Pef_Pessoa_FisicaBD.PWD(SenhaID.Text));
        int     qtd = ds.Tables[0].Rows.Count;

        if (qtd == 1)
        {
            Pef_Pessoa_Fisica pef = new Pef_Pessoa_Fisica();
            pef.Pef_codigo          = Convert.ToInt32(ds.Tables[0].Rows[0]["pef_codigo"].ToString());
            pef.Pef_cpf             = Convert.ToInt64(ds.Tables[0].Rows[0]["pef_cpf"].ToString());
            pef.Pef_nome            = ds.Tables[0].Rows[0]["pef_nome"].ToString();
            pef.Pef_email           = ds.Tables[0].Rows[0]["pef_email"].ToString();
            pef.Pef_genero          = ds.Tables[0].Rows[0]["pef_genero"].ToString();
            pef.Pef_data_nascimento = ds.Tables[0].Rows[0]["pef_data_nascimento"].ToString();
            End_Endereco end = new End_Endereco();
            end.End_cep = Convert.ToInt32(ds.Tables[0].Rows[0]["end_cep"].ToString());
            pef.End_cep = end;

            Session["usuario"] = pef;

            Response.Redirect("Perfil/EsportistaPerfil.aspx");
        }
        else
        {
            Response.Redirect("Principal.aspx");
        }
    }
    protected void BtnCadastrar_Click(object sender, EventArgs e)
    {
        Pef_Pessoa_Fisica pef = new Pef_Pessoa_Fisica();

        pef.Pef_cpf             = Convert.ToInt64(txtCPF.Text);
        pef.Pef_nome            = txtNome.Text;
        pef.Pef_email           = txtEmail.Text;
        pef.Pef_senha           = Pef_Pessoa_FisicaBD.PWD(txtSenha.Text);
        pef.Pef_data_nascimento = txtDataNascimento.Text;
        pef.Pef_genero          = ddlGenero.SelectedValue;

        End_Endereco end = new End_Endereco();

        end.End_cep = Convert.ToInt32(cep.Text);
        pef.End_cep = end;

        switch (Pef_Pessoa_FisicaBD.Insert(pef))
        {
        case 0:
            Response.Redirect("LoginEsportista.aspx");
            break;

        case -2:
            break;
        }
    }
Exemplo n.º 3
0
    protected void BtnSalvar_Click(object sender, EventArgs e)
    {
        Pef_Pessoa_Fisica pef = (Pef_Pessoa_Fisica)Session["usuario"];

        pef.Pef_nome            = txtNome.Text;
        pef.Pef_senha           = Pef_Pessoa_FisicaBD.PWD(txtSenha.Text);
        pef.Pef_email           = txtEmail.Text;
        pef.Pef_cpf             = Convert.ToInt64(txtCPF.Text);
        pef.Pef_data_nascimento = txtDataNascimento.Text;
        pef.Pef_genero          = ddlGenero.SelectedValue;

        End_Endereco end = new End_Endereco();

        end.End_cep = pef.End_cep.End_cep;
        pef.End_cep = end;

        switch (Pef_Pessoa_FisicaBD.Update(pef))
        {
        case 0:
            Page.Response.Redirect("EsportistaPerfil.aspx");
            break;

        case -2:
            Response.Redirect("QuemSomos.aspx");
            break;
        }
    }
Exemplo n.º 4
0
    protected void BtnSalvar_Click(object sender, EventArgs e)
    {
        Pej_Pessoa_Juridica pej = (Pej_Pessoa_Juridica)Session["usuario"];

        pej.Pej_razao_social  = txtNomeEmpresa.Text;
        pej.Pej_nome_ficticio = txtNomeFantasia.Text;
        pej.Pej_cnpj          = Convert.ToInt64(txtCNPJ.Text);
        pej.Pej_email         = txtEmail.Text;
        pej.Pej_senha         = Pef_Pessoa_FisicaBD.PWD(txtSenha.Text);

        End_Endereco end = new End_Endereco();

        end.End_cep = pej.End_cep.End_cep;
        pej.End_cep = end;

        switch (Pej_Pessoa_JuridicaBD.Update(pej))
        {
        case 0:
            Page.Response.Redirect("EspacoPerfil.aspx");
            break;

        case -2:
            Response.Redirect("QuemSomos.aspx");
            break;
        }
    }
Exemplo n.º 5
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string foto = "";

        if (FileUploadControl.PostedFile.ContentLength < 8388608)
        {
            try
            {
                if (FileUploadControl.HasFile)
                {
                    try
                    {
                        //Aqui ele vai filtrar pelo tipo de arquivo
                        if (FileUploadControl.PostedFile.ContentType == "image/jpeg" ||
                            FileUploadControl.PostedFile.ContentType == "image/png" ||
                            FileUploadControl.PostedFile.ContentType == "image/gif" ||
                            FileUploadControl.PostedFile.ContentType == "image/bmp")
                        {
                            try
                            {
                                //Obtem o  HttpFileCollection
                                HttpFileCollection hfc = Request.Files;
                                for (int i = 0; i < hfc.Count; i++)
                                {
                                    HttpPostedFile hpf = hfc[i];
                                    if (hpf.ContentLength > 0)
                                    {
                                        //Pega o nome do arquivo
                                        string nome = System.IO.Path.GetFileName(hpf.FileName);
                                        //Pega a extensão do arquivo
                                        string extensao = Path.GetExtension(hpf.FileName);
                                        //Gera nome novo do Arquivo numericamente
                                        string filename = string.Format("{0:00000000000000}", GerarID());
                                        //Caminho a onde será salvo
                                        hpf.SaveAs(Server.MapPath("~/uploads/fotos/") + filename + i
                                                   + extensao);

                                        //Prefixo p/ img pequena
                                        var prefixoP = "-p";
                                        //Prefixo p/ img grande
                                        var prefixoG = "-g";

                                        //pega o arquivo já carregado
                                        string pth = Server.MapPath("~/uploads/fotos/")
                                                     + filename + i + extensao;
                                        foto = filename + "0" + extensao;

                                        //Redefine altura e largura da imagem e Salva o arquivo + prefixo
                                        Redefinir.resizeImageAndSave(pth, 70, 53, prefixoP);
                                        Redefinir.resizeImageAndSave(pth, 500, 331, prefixoG);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                            // Mensagem se tudo ocorreu bem
                            StatusLabel.Text = "Todas imagens carregadas com sucesso!";

                            Pef_Pessoa_Fisica pef = (Pef_Pessoa_Fisica)Session["usuario"];

                            pef.Pef_foto_perfil = foto;
                            switch (Pef_Pessoa_FisicaBD.UpdateFoto(pef))
                            {
                            case 0:
                                break;

                            case -2:
                                break;
                            }
                            Page.Response.Redirect(Page.Request.Url.ToString(), true);
                        }
                        else
                        {
                            // Mensagem notifica que é permitido carregar apenas
                            // as imagens definida la em cima.
                            StatusLabel.Text = "É permitido carregar apenas imagens!";
                        }
                    }
                    catch (Exception ex)
                    {
                        // Mensagem notifica quando ocorre erros
                        StatusLabel.Text = "O arquivo não pôde ser carregado.  O seguinte erro ocorreu: " + ex.Message;
                    }
                }
            }
            catch (Exception ex)
            {
                // Mensagem notifica quando ocorre erros
                StatusLabel.Text = "O arquivo não pôde ser carregado.  O seguinte erro ocorreu: " + ex.Message;
            }
        }
        else
        {
            // Mensagem notifica quando imagem é superior a 8 MB
            StatusLabel.Text = "Não é permitido carregar mais do que 8 MB";
        }
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["usuario"] == null)
        {
            Response.Redirect("../Erro.aspx");
        }

        Pef_Pessoa_Fisica pef = (Pef_Pessoa_Fisica)Session["usuario"];

        if (!IsPostBack)
        {
            CarregarDDL();

            //PESQUISA DEFAULT
            DataSet dsCidade = Pef_Pessoa_FisicaBD.GetCidade(pef);
            string  cidade   = Convert.ToString(dsCidade.Tables[0].Rows[0]["end_cidade"]);
            DataSet ds2      = Par_PartidasBD.PesquisaDefault(cidade, pef);
            int     qtd2     = ds2.Tables[0].Rows.Count;
            if (qtd2 > 0)
            {
                PesquisaVazia.Visible = false;
                rptCard2.DataSource   = ds2;
                rptCard2.DataBind();
            }
            else
            {
                PesquisaVazia.Visible = true;
                PesquisaCheia.Visible = false;
            }

            //PARTIDAS PARTICIPANDO
            DataSet ds  = Par_PartidasBD.Select(pef.Pef_codigo);
            int     qtd = ds.Tables[0].Rows.Count;
            try
            {
                int par_codigo = Convert.ToInt32(ds.Tables[0].Rows[0]["par_codigo"]);
                if (qtd > 0 && par_codigo != 0)
                {
                    cardVazio.Visible  = false;
                    rptCard.DataSource = ds;
                    rptCard.DataBind();
                }
            }
            catch (Exception ex)
            {
            }
        }
        // NOME -- DATA -- GENERO
        ltlNome.Text   = "<h3 class='nomePerfil'>" + pef.Pef_nome + "</h3>";
        ltlIdade.Text  = "<h5>" + getIdade(pef.Pef_data_nascimento) + "</h45>";
        ltlGenero.Text = "<h5>" + pef.Pef_genero + "<h5>";



        //FOTO DE PERFIL
        DataSet ds3  = Pef_Pessoa_FisicaBD.Select(pef);
        int     qtd3 = ds3.Tables[0].Rows.Count;

        if (qtd3 > 0)
        {
            RptImage.DataSource = ds3;
            RptImage.DataBind();
        }
        else
        {
        }

        //ESPORTES PRATICADOS
        Pra_Pratica pra = new Pra_Pratica();

        pra.Pef_codigo = pef;
        DataSet ds4  = Pra_PraticaBD.SelectPraticados(pra);
        int     qtd4 = ds4.Tables[0].Rows.Count;

        if (qtd4 > 0)
        {
            espVazio.Visible      = false;
            RptEsporte.DataSource = ds4;
            RptEsporte.DataBind();
        }
        else
        {
            espVazio.Visible = true;
        }

        //MODAL DE ATUALIZAÇÃO DA FOTO DE PERFIL
        DataSet ds5  = Pef_Pessoa_FisicaBD.Select(pef);
        int     qtd5 = ds5.Tables[0].Rows.Count;

        if (qtd5 > 0)
        {
            RptImageEdit.DataSource = ds5;
            RptImageEdit.DataBind();
        }
        else
        {
        }
    }