private void Include() { decimal pRetorno = 0; try { if (ValidaDados() == "") { 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) { LimparCampos(); exibirMensagem("Ok", "Cadastro efetuado com sucesso", "ok"); } } else { exibirMensagem("Aviso", ValidaDados(), "alerta"); } } catch (Exception err) { exibirMensagem("Erro", err.Message.ToString(), "erro"); } }
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"); } }