Exemplo n.º 1
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
        {
        }
    }