예제 #1
0
    private void CarregaDadosAtleta(decimal pCodigo)
    {
        DataTable lTabela = PessoaModelo.CarregaDadosPessoaAtleta(pCodigo);

        if (lTabela.Rows.Count > 0)
        {
            ImgFoto.ImageUrl = "../administracao/foto.aspx?p=" + pCodigo + "";

            hfCodigoPessoa.Value = lTabela.Rows[0]["CODIGO"].ToString();
            hfCodigoAtleta.Value = lTabela.Rows[0]["CODIGO_ATLETA"].ToString();

            txtNome.Text                  = lTabela.Rows[0]["NOME"].ToString();
            txtNascimento.Text            = lTabela.Rows[0]["NASCIMENTO"].ToString();
            txtProfissao.Text             = lTabela.Rows[0]["PROFISSAO"].ToString();
            txtEmail.Text                 = lTabela.Rows[0]["EMAIL"].ToString();
            txtTelefone.Text              = lTabela.Rows[0]["TELEFONE"].ToString();
            ddlEscolaridade.SelectedValue = lTabela.Rows[0]["ESCOLARIDADE"].ToString();
            txtCpf.Text        = lTabela.Rows[0]["CPF"].ToString();
            txtRg.Text         = lTabela.Rows[0]["RG"].ToString();
            TxtCelular.Text    = lTabela.Rows[0]["CELULAR"].ToString();
            txtPlanoSaude.Text = lTabela.Rows[0]["PLANOSAUDE"].ToString();
            txtContato.Text    = lTabela.Rows[0]["CONTATO"].ToString();

            if (hfCodigoAtleta.Value != "")
            {
                DataTable lTabelaAtleta = AtletaModelo.CarregaDadosAtleta(decimal.Parse(hfCodigoAtleta.Value));

                if (lTabelaAtleta.Rows.Count > 0)
                {
                    ddlAtletaStatus.SelectedValue = lTabelaAtleta.Rows[0]["ATLETASTATUS"].ToString();
                    ddlPosicao.SelectedValue      = lTabelaAtleta.Rows[0]["POSICAO"].ToString();

                    NumeracaoIncluir.Visible    = false;
                    NumeracaoVisualizar.Visible = true;

                    txtNumeracao.Text = lTabelaAtleta.Rows[0]["NUMERO"].ToString() + "|" + lTabelaAtleta.Rows[0]["CONTADOR"].ToString();
                    hfNumeracao.Value = lTabelaAtleta.Rows[0]["NUMERO"].ToString();
                    hfContador.Value  = lTabelaAtleta.Rows[0]["CONTADOR"].ToString();

                    txtAltura.Text      = lTabelaAtleta.Rows[0]["ALTURA"].ToString();
                    txtPeso.Text        = lTabelaAtleta.Rows[0]["PESO"].ToString();
                    txtTamUniforme.Text = lTabelaAtleta.Rows[0]["TAMANHOUNIFORME"].ToString();
                }


                ViewState["VW_ATLETAANEXO"] = AtletaAnexoModelo.AtletaAnexoLista();
                gvArquivos.DataSource       = ViewState["VW_ATLETAANEXO"];
                gvArquivos.DataBind();
            }

            divConsulta.Visible = false;
            divCadastro.Visible = true;
        }
    }
예제 #2
0
    private void Update()
    {
        string  pRetorno    = "";
        decimal pRetornoInc = 0;

        try
        {
            PessoaEntidade.codigo            = decimal.Parse(hfCodigoPessoa.Value);
            PessoaEntidade.codigo_tipopessoa = decimal.Parse("2");
            PessoaEntidade.nome      = txtNome.Text.ToUpper();
            PessoaEntidade.nacimento = DateTime.Parse(txtNascimento.Text);
            if (fuImagem.FileName != "")
            {
                PessoaEntidade.foto = fuImagem.FileBytes;
            }
            else
            {
                PessoaEntidade.codigo = decimal.Parse(hfCodigoPessoa.Value);
                DataTable lFoto = PessoaModelo.Foto();
                foreach (DataRow ors in lFoto.Rows)
                {
                    PessoaEntidade.foto = (byte[])ors[0];
                }
            }

            PessoaEntidade.email        = txtEmail.Text;
            PessoaEntidade.cpf          = txtCpf.Text;
            PessoaEntidade.rg           = txtRg.Text;
            PessoaEntidade.profissao    = txtProfissao.Text.ToUpper();
            PessoaEntidade.escolaridade = ddlEscolaridade.SelectedItem.Text;
            PessoaEntidade.planosaude   = txtPlanoSaude.Text.ToUpper();
            PessoaEntidade.contato      = txtContato.Text.ToUpper();
            PessoaEntidade.telefone     = txtTelefone.Text;
            PessoaEntidade.celular      = TxtCelular.Text;

            pRetorno = PessoaModelo.Update();

            if (pRetorno == "")
            {
                if (hfCodigoAtleta.Value != "")
                {
                    AtletaEntidade.codigo              = decimal.Parse(hfCodigoAtleta.Value);
                    AtletaEntidade.codigo_posicao      = decimal.Parse(ddlPosicao.SelectedValue);
                    AtletaEntidade.codigo_atletastatus = decimal.Parse(ddlAtletaStatus.SelectedValue);
                    AtletaEntidade.altura              = txtAltura.Text;
                    AtletaEntidade.peso    = txtPeso.Text;
                    AtletaEntidade.apelido = txtApelido.Text;
                    if ((ddlNumeracao.SelectedValue == hfNumeracao.Value) && (int.Parse(hfContador.Value) < 1))
                    {
                        AtletaEntidade.numeracao = int.Parse(hfNumeracao.Value);
                    }
                    else
                    {
                        AtletaEntidade.numeracao = int.Parse(ddlNumeracao.SelectedValue);
                        UpdateNumeracaoMenos(int.Parse(hfContador.Value), decimal.Parse(hfNumeracao.Value));
                        UpdateNumeracaoMais(ddlNumeracao.SelectedItem.Text, decimal.Parse(ddlNumeracao.SelectedValue));
                    }
                    AtletaEntidade.tamanhouniforme = txtTamUniforme.Text;

                    pRetorno = AtletaModelo.Update();
                }
                else
                {
                    AtletaEntidade.codigo_pessoa       = decimal.Parse(hfCodigoPessoa.Value);
                    AtletaEntidade.codigo_posicao      = decimal.Parse(ddlPosicao.SelectedValue);
                    AtletaEntidade.codigo_atletastatus = decimal.Parse(ddlAtletaStatus.SelectedValue);
                    AtletaEntidade.altura    = txtAltura.Text;
                    AtletaEntidade.peso      = txtPeso.Text;
                    AtletaEntidade.apelido   = txtApelido.Text;
                    AtletaEntidade.numeracao = int.Parse(ddlNumeracao.SelectedValue);
                    UpdateNumeracaoMais(ddlNumeracao.SelectedItem.Text, decimal.Parse(ddlNumeracao.SelectedValue));
                    AtletaEntidade.tamanhouniforme = txtTamUniforme.Text;

                    pRetornoInc = AtletaModelo.Include();
                }
            }

            if (hfCodigoAnexo.Value != "")
            {
                AtletaAnexoEntidade.codigo    = decimal.Parse(hfCodigoAnexo.Value);
                AtletaAnexoEntidade.descricao = txtDescricaoArquivos.Text.ToUpper();

                pRetorno = AtletaAnexoModelo.Update();

                txtDescricaoArquivos.Text = "";
            }
            else
            {
                DataTable lTabela = (DataTable)ViewState["ANEXAARQUIVO"];
                byte[]    arquivo = new byte[0];

                if (lTabela != null)
                {
                    for (int i = 0; i < lTabela.Rows.Count; i++)
                    {
                        arquivo = (byte[])lTabela.Rows[i]["ARQUIVO"];
                        IncludeAnexo(decimal.Parse(hfCodigoAtleta.Value), lTabela.Rows[i]["DESCRICAO"].ToString(), lTabela.Rows[i]["TIPOARQUIVO"].ToString().ToUpper(), arquivo);
                    }
                    ExcluiAnexo("");
                }

                txtDescricaoArquivos.Text = "";
                gvArquivoAdd.DataSource   = null;
                gvArquivoAdd.DataBind();
            }

            Log("PAG: ATLETA, ATUALIZAÇÃO DE REGISTRO: " + hfCodigoPessoa.Value + ", USUARIO: " + Session["SE_USUARIO"].ToString() + "");
            exibirMensagem("Ok", "Cadastro atualizado com sucesso", "ok");
            divConsulta.Visible = false;
            divCadastro.Visible = true;

            ViewState["VW_ATLETAANEXO"] = AtletaAnexoModelo.AtletaAnexoLista();
            gvArquivos.DataSource       = ViewState["VW_ATLETAANEXO"];
            gvArquivos.DataBind();
        }
        catch (Exception err)
        {
            exibirMensagem("Erro", err.Message.ToString(), "erro");
        }
    }
예제 #3
0
    private void Include()
    {
        decimal pRetorno = 0;

        try
        {
            PessoaEntidade.codigo_tipopessoa = decimal.Parse("2");
            PessoaEntidade.nome         = txtNome.Text.ToUpper();
            PessoaEntidade.nacimento    = DateTime.Parse(txtNascimento.Text);
            PessoaEntidade.foto         = fuImagem.FileBytes;
            PessoaEntidade.email        = txtEmail.Text;
            PessoaEntidade.cpf          = txtCpf.Text;
            PessoaEntidade.rg           = txtRg.Text;
            PessoaEntidade.profissao    = txtProfissao.Text.ToUpper();
            PessoaEntidade.escolaridade = ddlEscolaridade.SelectedItem.Text;
            PessoaEntidade.planosaude   = txtPlanoSaude.Text.ToUpper();
            PessoaEntidade.contato      = txtContato.Text.ToUpper();
            PessoaEntidade.telefone     = txtTelefone.Text;
            PessoaEntidade.celular      = TxtCelular.Text;

            pRetorno = PessoaModelo.Include();

            if (pRetorno != 0)
            {
                if (cbDadosAtleta.Checked)
                {
                    AtletaEntidade.codigo_pessoa       = pRetorno;
                    AtletaEntidade.codigo_posicao      = decimal.Parse(ddlPosicao.SelectedValue);
                    AtletaEntidade.codigo_atletastatus = decimal.Parse(ddlAtletaStatus.SelectedValue);
                    AtletaEntidade.altura    = txtAltura.Text;
                    AtletaEntidade.peso      = txtPeso.Text;
                    AtletaEntidade.apelido   = txtApelido.Text;
                    AtletaEntidade.numeracao = int.Parse(ddlNumeracao.SelectedValue);
                    UpdateNumeracaoMais(ddlNumeracao.SelectedItem.Text, decimal.Parse(ddlNumeracao.SelectedItem.Text));
                    AtletaEntidade.tamanhouniforme = txtTamUniforme.Text;

                    pRetorno = AtletaModelo.Include();

                    DataTable lTabela = (DataTable)ViewState["ANEXAARQUIVO"];
                    byte[]    arquivo = new byte[0];

                    if (lTabela != null)
                    {
                        for (int i = 0; i < lTabela.Rows.Count; i++)
                        {
                            arquivo = (byte[])lTabela.Rows[i]["ARQUIVO"];
                            IncludeAnexo(pRetorno, lTabela.Rows[i]["DESCRICAO"].ToString(), lTabela.Rows[i]["TIPOARQUIVO"].ToString().ToUpper(), arquivo);
                        }

                        ExcluiAnexo("");
                    }
                }
                Log("PAG: ATLETA, INCLUSÃO DE REGISTRO: " + pRetorno + ", USUARIO: " + Session["SE_USUARIO"].ToString() + "");
                LimparCampos();
                exibirMensagem("Ok", "Cadastro efetuado com sucesso", "ok");
            }
            else
            {
                exibirMensagem("Erro", Conexao.excecao.Replace("@", "").Replace("'", ""), "erro");
            }
        }
        catch (Exception err)
        {
            exibirMensagem("Erro", err.Message.ToString(), "erro");
        }
    }