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;
        }
    }
    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");
        }
    }
    public static DataSet PesquisaPartida(string esporte, string cidade, Pef_Pessoa_Fisica pef)
    {
        DataSet       ds2 = new DataSet();
        IDbConnection objConnection;
        IDbCommand    objCommand;
        IDataAdapter  objDataDadapter;

        objConnection = Mapped.Connection();
        string sql = "select par_codigo, pef_codigo_adm , esp_nome, end_cidade, end_uf, end_rua, end_bairro, ";

        sql       += "par_nome, par_horario_inicio, par_data, par_nome_local from pef_pessoa_fisica pef ";
        sql       += "left join par_partidas par on par.pef_codigo_adm = pef.pef_codigo ";
        sql       += "left join end_endereco en on en.end_cep = par.end_cep ";
        sql       += "left join esp_esportes esp on esp.esp_codigo = par.esp_codigo ";
        sql       += "where en.end_cidade = ?end_cidade and esp.esp_nome = ?esp_nome and ";
        sql       += "par_codigo not in (select par_codigo from gpe_grupo_pessoas where pef_codigo = ?pef_codigo );";
        objCommand = Mapped.Command(sql, objConnection);

        objCommand.Parameters.Add(Mapped.Parameter("?end_cidade", cidade));
        objCommand.Parameters.Add(Mapped.Parameter("?esp_nome", esporte));
        objCommand.Parameters.Add(Mapped.Parameter("?pef_codigo", pef.Pef_codigo));

        objDataDadapter = Mapped.Adapter(objCommand);
        objDataDadapter.Fill(ds2);

        objConnection.Close();
        objCommand.Dispose();
        objConnection.Dispose();
        return(ds2);
    }
    public static int UpdateFoto(Pef_Pessoa_Fisica fisica)
    {
        int retorno = 0;

        try
        {
            IDbConnection objConnection;
            IDbCommand    objCommand;

            string sql = "update pef_pessoa_fisica set pef_foto_perfil = ?pef_foto_perfil where pef_codigo = ?pef_codigo ;";

            objConnection = Mapped.Connection();
            objCommand    = Mapped.Command(sql, objConnection);

            objCommand.Parameters.Add(Mapped.Parameter("?pef_codigo", fisica.Pef_codigo));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_foto_perfil", fisica.Pef_foto_perfil));

            objCommand.ExecuteNonQuery();

            objConnection.Close();
            objConnection.Dispose();
            objCommand.Dispose();
        }
        catch (Exception ex)
        {
            retorno = -2;
        }
        return(retorno);
    }
Exemple #5
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;
        }
    }
    public static int Update(Pef_Pessoa_Fisica fisica)
    {
        int retorno = 0;

        try
        {
            IDbConnection objConnection;
            IDbCommand    objCommand;

            string sql = "update pef_pessoa_fisica set pef_nome = ?pef_nome , pef_email = ?pef_email , ";
            sql          += "pef_senha = ?pef_senha , pef_genero = ?pef_genero , pef_data_nascimento = ?pef_data_nascimento , ";
            sql          += "end_cep = ?end_cep where pef_codigo = ?pef_codigo ; ";
            objConnection = Mapped.Connection();
            objCommand    = Mapped.Command(sql, objConnection);

            objCommand.Parameters.Add(Mapped.Parameter("?pef_nome", fisica.Pef_nome));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_email", fisica.Pef_email));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_senha", fisica.Pef_senha));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_genero", fisica.Pef_genero));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_data_nascimento", fisica.Pef_data_nascimento));

            objCommand.Parameters.Add(Mapped.Parameter("?end_cep", fisica.End_cep.End_cep));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_codigo", fisica.Pef_codigo));
            objCommand.ExecuteNonQuery();

            objConnection.Close();
            objConnection.Dispose();
            objCommand.Dispose();
        }
        catch (Exception ex)
        {
            retorno = -2;
        }
        return(retorno);
    }
Exemple #7
0
    protected void rptCard_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "VerMais1")
        {
            Button            btn = (Button)e.Item.FindControl("BtnVerMais1");
            DataSet           ds  = Par_PartidasBD.SelectVerMais(Convert.ToInt32(btn.CommandArgument));
            Pef_Pessoa_Fisica pef = (Pef_Pessoa_Fisica)Session["usuario"];

            ltlParCodigo1.Text   = Convert.ToString(ds.Tables[0].Rows[0]["par_codigo"]);
            ltlEsporte1.Text     = Convert.ToString(ds.Tables[0].Rows[0]["esp_nome"]);
            ltlNomePartida1.Text = Convert.ToString(ds.Tables[0].Rows[0]["par_nome"]);
            ltlLocal1.Text       = Convert.ToString(ds.Tables[0].Rows[0]["par_nome_local"]);
            ltlData1.Text        = Convert.ToString(ds.Tables[0].Rows[0]["par_data"]);
            ltlInicio1.Text      = Convert.ToString(ds.Tables[0].Rows[0]["par_horario_inicio"]);
            ltlTermino1.Text     = Convert.ToString(ds.Tables[0].Rows[0]["par_horario_termino"]);
            ltlIdadeMinima1.Text = Convert.ToString(ds.Tables[0].Rows[0]["par_idade_minima"]);
            ltlIdadeMaxima1.Text = Convert.ToString(ds.Tables[0].Rows[0]["par_idade_maxima"]);
            ltlGenero1.Text      = Convert.ToString(ds.Tables[0].Rows[0]["par_genero_permitido"]);
            string numIntegrantes = Convert.ToString(ds.Tables[0].Rows[0]["par_numero_integrantes"]);
            ltlNumeroIntegrantes1.Text = Convert.ToString(ds.Tables[0].Rows[0]["par_numero_integrantes"]);
            ltlPreco1.Text             = Convert.ToString(ds.Tables[0].Rows[0]["par_preco"]);
            ltlTipoEspaco1.Text        = Convert.ToString(ds.Tables[0].Rows[0]["par_tipo_espaco"]);
            ltlCep1.Text    = Convert.ToString(ds.Tables[0].Rows[0]["end_cep"]);
            ltlUf1.Text     = Convert.ToString(ds.Tables[0].Rows[0]["end_uf"]);
            ltlCidade1.Text = Convert.ToString(ds.Tables[0].Rows[0]["end_cidade"]);
            ltlBairro1.Text = Convert.ToString(ds.Tables[0].Rows[0]["end_bairro"]);
            ltlRua1.Text    = Convert.ToString(ds.Tables[0].Rows[0]["end_rua"]);

            if (Convert.ToInt32(ds.Tables[0].Rows[0]["pef_codigo_adm"]) == pef.Pef_codigo)
            {
                BtnEditar.Visible = true;
            }
            else
            {
                BtnEditar.Visible = false;
            }

            DataSet ds2 = Gpe_Grupo_PessoasBD.Select(ltlParCodigo1.Text);
            int     qtd = ds2.Tables[0].Rows.Count;

            if (qtd > 0)
            {
                RptIntegrantes.DataSource = ds2;
                RptIntegrantes.DataBind();
            }
            else
            {
            }

            ltlNumParticipantesAtual2.Text = "<i class='fas fa-user - friends'></i> " + Convert.ToString(qtd) + " / " + numIntegrantes;

            //ScriptManager.RegisterStartupScript(this, this.GetType(), "verMais", "$('#verMais1').modal('show')", true);
            lblScript.Text = @"<script> $(document).ready(function(){$('#verMais1').modal('show')})</script>";
        }
    }
Exemple #8
0
    protected void BtnSair_Click(object sender, EventArgs e)
    {
        Pef_Pessoa_Fisica pef = (Pef_Pessoa_Fisica)Session["usuario"];

        switch (Gpe_Grupo_PessoasBD.Delete(Convert.ToInt32(ltlParCodigo1.Text), pef.Pef_codigo))
        {
        case 0:
            Page.Response.Redirect(Page.Request.Url.ToString(), true);
            break;

        case -2:
            Response.Redirect("QuemSomos.aspx");
            break;
        }
    }
Exemple #9
0
    protected void BtnCriar_Click(object sender, EventArgs e)
    {
        Esp_Esportes esp = new Esp_Esportes();
        Par_Partida  par = new Par_Partida();

        esp.Esp_codigo     = Convert.ToInt32(ddlEsporte.SelectedValue);
        par.Esp_codigo     = esp;
        par.Par_nome       = txtNomePartida.Text;
        par.Par_nome_local = txtLocal.Text;
        par.Par_data       = txtData.Text;

        par.Par_tipo_espaco        = ddlTipoLocal.SelectedValue;
        par.Par_preco              = Convert.ToDouble(txtValor.Text);
        par.Par_horario_inicio     = txtInicio.Text;
        par.Par_horario_termino    = txtFim.Text;
        par.Par_genero_permitido   = ddlGenero.SelectedValue;
        par.Par_numero_integrantes = Convert.ToInt32(txtNumeroParticipantes.Text);
        par.Par_idade_minima       = Convert.ToInt32(txtIdadeMinima.Text);
        par.Par_idade_maxima       = Convert.ToInt32(txtIdadeMaxima.Text);
        par.Par_ativo              = true;

        End_Endereco end = new End_Endereco();

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

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

        par.Pef_codigo_adm = pef;

        //Gpe_Grupo_Pessoas gpe = new Gpe_Grupo_Pessoas();
        //gpe.Pef_codigo = pef;

        switch (Par_PartidasBD.Insert(par))
        {
        case 0:
            DataSet dsParCodigo = Par_PartidasBD.SelectUltimaPartidaCriada(pef);
            Gpe_Grupo_PessoasBD.Insert(Convert.ToInt32(dsParCodigo.Tables[0].Rows[0]["par_codigo"]), pef.Pef_codigo);
            Page.Response.Redirect(Page.Request.Url.ToString(), true);
            break;

        case -2:
            Response.Redirect("QuemSomos.aspx");
            break;
        }
    }
Exemple #10
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"];
        Pra_Pratica       pra = new Pra_Pratica();

        if (!IsPostBack)
        {
            pra.Pef_codigo = pef;

            DataSet ds  = Pra_PraticaBD.SelectNaoPraticados(pra);
            int     qtd = ds.Tables[0].Rows.Count;

            if (qtd > 0)
            {
                cardVazio.Visible  = false;
                rptCard.DataSource = ds;
                rptCard.DataBind();
            }
            else
            {
                cardVazio.Visible = true;
                cardCheio.Visible = false;
            }

            DataSet ds2  = Pra_PraticaBD.SelectPraticados(pra);
            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;
            }
        }
    }
Exemple #11
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)
        {
            txtNome.Text            = pef.Pef_nome;
            txtSenha.Text           = "1234";
            txtEmail.Text           = pef.Pef_email;
            txtCPF.Text             = Convert.ToString(pef.Pef_cpf);
            txtDataNascimento.Text  = pef.Pef_data_nascimento;
            ddlGenero.SelectedValue = pef.Pef_genero;

            End_Endereco end = new End_Endereco();
            cep.Text = Convert.ToString(pef.End_cep.End_cep);
        }
    }
    public static DataSet GetCidade(Pef_Pessoa_Fisica pef)
    {
        DataSet       ds2 = new DataSet();
        IDbConnection objConnection;
        IDbCommand    objCommand;
        IDataAdapter  objDataDadapter;

        objConnection = Mapped.Connection();
        string sql = "select end_cidade from end_endereco where end_cep = ?end_cep";

        objCommand = Mapped.Command(sql, objConnection);

        objCommand.Parameters.Add(Mapped.Parameter("?end_cep", pef.End_cep.End_cep));

        objDataDadapter = Mapped.Adapter(objCommand);
        objDataDadapter.Fill(ds2);

        objConnection.Close();
        objCommand.Dispose();
        objConnection.Dispose();
        return(ds2);
    }
Exemple #13
0
    protected void BtnAdicionar_Click(object sender, EventArgs e)
    {
        Button btn = (sender as Button);

        Pef_Pessoa_Fisica pef = (Pef_Pessoa_Fisica)Session["usuario"];
        Esp_Esportes      esp = new Esp_Esportes();
        Pra_Pratica       pra = new Pra_Pratica();

        pra.Pef_codigo = pef;
        esp.Esp_codigo = Convert.ToInt32(btn.CommandArgument.ToString());
        pra.Esp_codigo = esp;

        switch (Pra_PraticaBD.Insert(pra))
        {
        case 0:
            Page.Response.Redirect(Page.Request.Url.ToString(), true);
            break;

        case -2:
            break;
        }
    }
    public static DataSet Select(Pef_Pessoa_Fisica pef)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConnection;
        IDbCommand    objCommand;
        IDataAdapter  objDataDadapter;

        objConnection = Mapped.Connection();
        string sql = "select * from pef_pessoa_fisica where pef_codigo = ?pef_codigo ;";

        objCommand = Mapped.Command(sql, objConnection);

        objCommand.Parameters.Add(Mapped.Parameter("?pef_codigo", pef.Pef_codigo));

        objDataDadapter = Mapped.Adapter(objCommand);
        objDataDadapter.Fill(ds);

        objConnection.Close();
        objCommand.Dispose();
        objConnection.Dispose();
        return(ds);
    }
    public static DataSet SelectUltimaPartidaCriada(Pef_Pessoa_Fisica pef)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConnection;
        IDbCommand    objCommand;
        IDataAdapter  objDataDadapter;

        objConnection = Mapped.Connection();
        string sql = "select par_codigo from par_partidas where pef_codigo_adm = ?pef_codigo order by par_codigo desc;";

        objCommand = Mapped.Command(sql, objConnection);

        objCommand.Parameters.Add(Mapped.Parameter("?pef_codigo", pef.Pef_codigo));


        objDataDadapter = Mapped.Adapter(objCommand);
        objDataDadapter.Fill(ds);

        objConnection.Close();
        objCommand.Dispose();
        objConnection.Dispose();
        return(ds);
    }
Exemple #16
0
    protected void BtnPesquisar_Click(object sender, EventArgs e)
    {
        Pef_Pessoa_Fisica pef = (Pef_Pessoa_Fisica)Session["usuario"];
        DataSet           ds2 = Par_PartidasBD.PesquisaPartida(txtEsporte.Text, txtCidade.Text, pef);
        int qtd = ds2.Tables[0].Rows.Count;


        if (qtd > 0)
        {
            rptCard2.DataSource = ds2;
            rptCard2.DataBind();
            txtCidade.Text        = "";
            txtEsporte.Text       = "";
            PesquisaVazia.Visible = false;
            PesquisaCheia.Visible = true;
        }
        else
        {
            PesquisaCheia.Visible = false;
            PesquisaVazia.Visible = true;
            txtCidade.Text        = "";
            txtEsporte.Text       = "";
        }
    }
    public static int Insert(Pef_Pessoa_Fisica fisica)
    {
        int retorno = 0;

        try
        {
            IDbConnection objConnection;
            IDbCommand    objCommand;

            string sql = " insert into pef_pessoa_fisica(pef_foto_perfil, pef_cpf, pef_nome, pef_email, pef_senha, pef_genero, pef_data_nascimento, end_cep)";
            sql += " values ('../../img/Esportista.jpg', ?pef_cpf, ?pef_nome, ?pef_email, ?pef_senha, ?pef_genero, ?pef_data_nascimento, ?end_cep);";

            objConnection = Mapped.Connection();
            objCommand    = Mapped.Command(sql, objConnection);

            objCommand.Parameters.Add(Mapped.Parameter("?pef_cpf", fisica.Pef_cpf));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_nome", fisica.Pef_nome));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_email", fisica.Pef_email));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_senha", fisica.Pef_senha));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_genero", fisica.Pef_genero));
            objCommand.Parameters.Add(Mapped.Parameter("?pef_data_nascimento", fisica.Pef_data_nascimento));
            // FK
            objCommand.Parameters.Add(Mapped.Parameter("?end_cep", fisica.End_cep.End_cep));

            objCommand.ExecuteNonQuery();

            objConnection.Close();
            objConnection.Dispose();
            objCommand.Dispose();
        }
        catch (Exception ex)
        {
            retorno = -2;
        }
        return(retorno);
    }
Exemple #18
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
        {
        }
    }
Exemple #19
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";
        }
    }