private Entidades.HistoricoPesquisa SalvarHistoricoPesquisa(string pesquisaSucesso, string codigoItemProduto, string Observacao, string parametroUsadoPesquisa, string tipoParametroUsadoPesquisa) { try { Entidades.HistoricoPesquisa hist = new Entidades.HistoricoPesquisa(); Negocios.HistoricoPesquisa n = new Negocios.HistoricoPesquisa(); hist.CodigoItemProduto = codigoItemProduto; hist.FiltroUtilizadoPesquisa = parametroUsadoPesquisa; hist.IpOrigemConsulta = HttpContext.Current.Request.UserHostAddress.ToString(); hist.IdUsuarioConsulta = ((Entidades.Usuario)Session["ws_siscom_acesso"]).IdUsuario; hist.Observacao = Observacao; hist.FlagSucesso = pesquisaSucesso; hist.TipoFiltroUtilizadoPesquisa = tipoParametroUsadoPesquisa; hist.DataConsulta = DataBR; return(n.Salvar(hist)); } catch (Exception ex) { Util.Log.Save("ex:" + ex.Message, "SalvarHistoricoPesquisa", "SiscomWS", HttpContext.Current.Server.MapPath(diretorioLog)); throw ex; } }
public Entidades.HistoricoPesquisa Salvar(Entidades.HistoricoPesquisa h) { try { Dados.HistoricoPesquisa negHistPesq = new Dados.HistoricoPesquisa(); DataTable dtRetorno = new DataTable(); negHistPesq.Salvar(h, ref dtRetorno); foreach (DataRow item in dtRetorno.Rows) { Entidades.HistoricoPesquisa hist = new Entidades.HistoricoPesquisa(); hist.IdHistoricoConsulta = int.Parse(item["ID_HISTORICO_CONSULTA"].ToString()); hist.ProtocoloRetorno = item["PROTOCOLO_RETORNO"].ToString(); return(hist); } return(new Entidades.HistoricoPesquisa()); } catch (Exception ex) { throw ex; } }
private void SalvarHistoricoFornecedor(string pesquisaSucesso, int IdHistoricoConsulta, string HTMLRetornado, string NomeProdutoFornecedor, string NomeFornecedor) { try { Entidades.FornecedorConsulta retFornecOrigemProd = new Entidades.FornecedorConsulta(); Entidades.HistoricoPesquisa h = new Entidades.HistoricoPesquisa(); Negocios.HistoricoPesquisa n = new Negocios.HistoricoPesquisa(); //Consultando origem da consulta para fins tarifário retFornecOrigemProd = ListarOrigemProdutoConsultado(NomeProdutoFornecedor, NomeFornecedor); h.IdHistoricoConsulta = IdHistoricoConsulta; h.IdOrigemProdutoConsultado = retFornecOrigemProd.Produtos.Where(p => p.NomeProduto.Trim().Equals(NomeProdutoFornecedor)).FirstOrDefault().IdOrigemProdutoConsultado; h.IdUsuarioConsulta = ((Entidades.Usuario)Session["ws_siscom_acesso"]).IdUsuario; h.HTMLRetornadoFornecedor = HTMLRetornado; h.FlagSucesso = pesquisaSucesso; h.DataConsulta = DataBR; n.SalvarHistoricoFornecedor(h); } catch (Exception ex) { Util.Log.Save("ex:" + ex.Message, "SalvarHistoricoFornecedor", "SiscomWS", HttpContext.Current.Server.MapPath(diretorioLog)); throw ex; } }
public void SalvarHistoricoFornecedor(Entidades.HistoricoPesquisa h) { try { Dados.HistoricoPesquisa negHistPesq = new Dados.HistoricoPesquisa(); DataTable dtRetorno = new DataTable(); negHistPesq.SalvarHistoricoFornecedor(h, ref dtRetorno); } catch (Exception ex) { throw ex; } }
//[return: XmlRoot(ElementName = "testeteste")] public Entidades.Cadastral.SISCOM.Response PesquisaPF(string loginUsuario, string senhaUsuario, string numeroCPF) { try { //Limpando pontos, barras e espaços do CPF numeroCPF = numeroCPF.Replace(".", "").Replace(".", "").Replace("-", "").Replace("/", ""); numeroCPF = numeroCPF.Trim(); numeroCPF = numeroCPF.PadLeft(11, '0'); Entidades.Cadastral.SISCOM.Response retResponse = new Entidades.Cadastral.SISCOM.Response(); #region Parametros de Entrada retResponse.Input = new List <Entidades.Cadastral.SISCOM.InputItem>(); //retResponse.Input.Add(new Entidades.Cadastral.SISCOM.InputItem() { Key = "loginUsuario", Value = loginUsuario }); //retResponse.Input.Add(new Entidades.Cadastral.SISCOM.InputItem() { Key = "senhaUsuario", Value = senhaUsuario }); retResponse.Input.Add(new Entidades.Cadastral.SISCOM.InputItem() { Key = "CPF", Value = numeroCPF }); #endregion #region Controle de Erros if (loginUsuario.Trim().Length == 0) { retResponse.ResponseError.ErrorCode = "400"; retResponse.ResponseError.Message = "HTTP/1.1 400 Bad Request"; retResponse.ResponseError.StackTrace = ""; Entidades.Cadastral.SISCOM.Error Erro = new Entidades.Cadastral.SISCOM.Error(); Erro.ErrorCode = "400"; Erro.FieldName = "loginUsuario"; Erro.Message = retResponse.ResponseError.Message; if (retResponse.ResponseError.Errors == null) { retResponse.ResponseError.Errors = new List <Entidades.Cadastral.SISCOM.Error>(); } retResponse.ResponseError.Errors.Add(Erro); retResponse.Status = new Entidades.Cadastral.SISCOM.Status(); retResponse.Status.Code = 400; retResponse.Status.DateTime = DataBR; retResponse.Status.Detail = "O login nao foi informado"; retResponse.Status.Message = Erro.Message; retResponse.Status.Source = string.Empty; retResponse.Status.Type = string.Empty; } if (senhaUsuario.Trim().Length == 0) { retResponse.ResponseError.ErrorCode = "400"; retResponse.ResponseError.Message = "HTTP/1.1 400 Bad Request"; retResponse.ResponseError.StackTrace = ""; Entidades.Cadastral.SISCOM.Error Erro = new Entidades.Cadastral.SISCOM.Error(); Erro.ErrorCode = "400"; Erro.FieldName = "senhaUsuario"; Erro.Message = retResponse.ResponseError.Message; if (retResponse.ResponseError.Errors == null) { retResponse.ResponseError.Errors = new List <Entidades.Cadastral.SISCOM.Error>(); } retResponse.ResponseError.Errors.Add(Erro); retResponse.Status = new Entidades.Cadastral.SISCOM.Status(); retResponse.Status.Code = 400; retResponse.Status.DateTime = DataBR; retResponse.Status.Detail = "A senha nao foi informada"; retResponse.Status.Message = Erro.Message; retResponse.Status.Source = string.Empty; retResponse.Status.Type = string.Empty; } if (numeroCPF.Trim().Length == 0) { retResponse.ResponseError.ErrorCode = "400"; retResponse.ResponseError.Message = "HTTP/1.1 400 Bad Request"; retResponse.ResponseError.StackTrace = ""; Entidades.Cadastral.SISCOM.Error Erro = new Entidades.Cadastral.SISCOM.Error(); Erro.ErrorCode = "400"; Erro.FieldName = "numeroCPF"; Erro.Message = retResponse.ResponseError.Message; if (retResponse.ResponseError.Errors == null) { retResponse.ResponseError.Errors = new List <Entidades.Cadastral.SISCOM.Error>(); } retResponse.ResponseError.Errors.Add(Erro); retResponse.Status = new Entidades.Cadastral.SISCOM.Status(); retResponse.Status.Code = 400; retResponse.Status.DateTime = DataBR; retResponse.Status.Detail = "O CPF nao foi informado"; retResponse.Status.Message = Erro.Message; retResponse.Status.Source = string.Empty; retResponse.Status.Type = string.Empty; } //Validando CPF if (!numeroCPF.Equals("00000000000") && (!Util.Format.ValidaCPFCNPJ(numeroCPF, false) || numeroCPF.Length != 11)) { retResponse.ResponseError.ErrorCode = "400"; retResponse.ResponseError.Message = "HTTP/1.1 400 Bad Request"; retResponse.ResponseError.StackTrace = ""; Entidades.Cadastral.SISCOM.Error Erro = new Entidades.Cadastral.SISCOM.Error(); Erro.ErrorCode = "400"; Erro.FieldName = "numeroCPF"; Erro.Message = retResponse.ResponseError.Message; if (retResponse.ResponseError.Errors == null) { retResponse.ResponseError.Errors = new List <Entidades.Cadastral.SISCOM.Error>(); } retResponse.ResponseError.Errors.Add(Erro); retResponse.Status = new Entidades.Cadastral.SISCOM.Status(); retResponse.Status.Code = 400; retResponse.Status.DateTime = DataBR; retResponse.Status.Detail = "CPF Invalido"; retResponse.Status.Message = Erro.Message; retResponse.Status.Source = string.Empty; retResponse.Status.Type = string.Empty; } if (retResponse.ResponseError.Errors != null && retResponse.ResponseError.Errors.Count > 0) { return(retResponse); } #endregion string NomeInternoProduto = "WEBSERVICE SISCOM PESQUISA PF"; if (Autenticacao(loginUsuario, senhaUsuario)) { //Verificando inicialmente se o usuário tem permissão ao produto List <Entidades.Produto> listProd = new List <Entidades.Produto>(); listProd = ListarProdutoSolicitadoByUsuario(((Entidades.Usuario)Session["ws_siscom_acesso"]).IdUsuario, NomeInternoProduto); if (listProd == null || listProd.Count == 0) { retResponse.ResponseError.ErrorCode = "401"; retResponse.ResponseError.Message = "HTTP/1.1 401 Unauthorized"; retResponse.ResponseError.StackTrace = ""; Entidades.Cadastral.SISCOM.Error Erro = new Entidades.Cadastral.SISCOM.Error(); Erro.ErrorCode = "401"; Erro.FieldName = ""; Erro.Message = retResponse.ResponseError.Message; if (retResponse.ResponseError.Errors == null) { retResponse.ResponseError.Errors = new List <Entidades.Cadastral.SISCOM.Error>(); } retResponse.ResponseError.Errors.Add(Erro); retResponse.Status = new Entidades.Cadastral.SISCOM.Status(); retResponse.Status.Code = 401; retResponse.Status.DateTime = DataBR; retResponse.Status.Detail = "Voce nao tem permissao para utilizar este produto"; retResponse.Status.Message = Erro.Message; retResponse.Status.Source = string.Empty; retResponse.Status.Type = string.Empty; return(retResponse); } else { if (numeroCPF.Trim().Equals("00000000000")) { return(TestesDeIntegracao()); } else { Negocios.Cadastral.WS.SISCOM n = new Negocios.Cadastral.WS.SISCOM(); Entidades.Cadastral.SISCOM.Response retorno = new Entidades.Cadastral.SISCOM.Response(); retorno = n.SISCOMPesquisaPF(numeroCPF); if (retorno.Output.DadosCadastrais.Nome.Trim().Equals("") && retorno.Output.Emails.Count == 0 && retorno.Output.Enderecos.Count == 0 && retorno.Output.Telefones.Count == 0) { string codigoItemProduto = listProd.FirstOrDefault().CodigoProduto; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("N", codigoItemProduto, "", numeroCPF, "CPF"); retorno.Input = retResponse.Input; retorno.ResponseError = retResponse.ResponseError; retorno.Status = new Entidades.Cadastral.SISCOM.Status(); retorno.Status.Code = 204; retorno.Status.DateTime = DataBR; retorno.Status.Detail = "SOLICITACAO PROCESSADA COM SUCESSO"; retorno.Status.Message = "No Content"; retorno.Status.Source = ((Entidades.Usuario)Session["ws_siscom_acesso"]).Cliente.NomeFantasia; retorno.Status.Type = "Consulta Siscom PF"; retorno.Status.Protocol = hist.ProtocoloRetorno; var xns = new XmlSerializerNamespaces(); xns.Add(string.Empty, string.Empty); var xs = new XmlSerializer(retorno.GetType()); var xml = new StringWriter(); xs.Serialize(xml, retorno, xns); SalvarHistoricoFornecedor("N", hist.IdHistoricoConsulta, xml.ToString(), NomeInternoProduto, "DNA"); } else { string codigoItemProduto = listProd.FirstOrDefault().CodigoItemProduto; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("S", codigoItemProduto, "", numeroCPF, "CPF"); retorno.Input = retResponse.Input; retorno.ResponseError = retResponse.ResponseError; retorno.Status = new Entidades.Cadastral.SISCOM.Status(); retorno.Status.Code = 200; retorno.Status.DateTime = DataBR; retorno.Status.Detail = "SOLICITACAO PROCESSADA COM SUCESSO"; retorno.Status.Message = "OK"; retorno.Status.Source = ((Entidades.Usuario)Session["ws_siscom_acesso"]).Cliente.NomeFantasia; retorno.Status.Type = "Consulta Siscom PF"; retorno.Status.Protocol = hist.ProtocoloRetorno; var xns = new XmlSerializerNamespaces(); xns.Add(string.Empty, string.Empty); var xs = new XmlSerializer(retorno.GetType()); var xml = new StringWriter(); xs.Serialize(xml, retorno, xns); SalvarHistoricoFornecedor("S", hist.IdHistoricoConsulta, xml.ToString(), NomeInternoProduto, "DNA"); } return(retorno); } } } else { retResponse.ResponseError.ErrorCode = "401"; retResponse.ResponseError.Message = "HTTP/1.1 401 Unauthorized"; retResponse.ResponseError.StackTrace = ""; Entidades.Cadastral.SISCOM.Error Erro = new Entidades.Cadastral.SISCOM.Error(); Erro.ErrorCode = "401"; Erro.FieldName = ""; Erro.Message = "O LOGIN OU A SENHA INSERIDOS ESTAO INCORRETOS."; if (retResponse.ResponseError.Errors == null) { retResponse.ResponseError.Errors = new List <Entidades.Cadastral.SISCOM.Error>(); } retResponse.Status = new Entidades.Cadastral.SISCOM.Status(); retResponse.Status.Code = 401; retResponse.Status.DateTime = DataBR; retResponse.Status.Detail = string.Empty; retResponse.Status.Message = Erro.Message; retResponse.Status.Source = string.Empty; retResponse.Status.Type = string.Empty; retResponse.ResponseError.Errors.Add(Erro); return(retResponse); } } catch (Exception ex) { throw ex; } }
private void Consultar() { try { string HTMLRetornado = string.Empty; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Visible = false; divEspacoBranco.Visible = false; divResultado.Visible = false; divImprimirMensagemErro.Attributes.Add("style", "display:none;"); Negocios.Cadastral.WEB.RastreamentoMoradoresMesmoEndereco n = new Negocios.Cadastral.WEB.RastreamentoMoradoresMesmoEndereco(); List <Entidades.Cadastral.ResponseMoradoresMesmoEndereco> listRet = new List <Entidades.Cadastral.ResponseMoradoresMesmoEndereco>(); Entidades.Cadastral.FiltroPesquisaMoradoresMesmoEndereco filtro = new Entidades.Cadastral.FiltroPesquisaMoradoresMesmoEndereco(); filtro.Cep = txtCEP.Text.ToUpper().Replace("-", ""); if (ddlUF.SelectedItem.Text == "SELECIONE...") { filtro.UF = hdnUfEstado.Value.Trim(); } else { filtro.UF = ddlUF.SelectedItem.Text.Split(new Char[] { '-' })[0].ToString().Trim(); } if (ddlCidade.SelectedItem.Text == "SELECIONE...") { filtro.Cidade = hdnCidade.Value.Trim(); } else { filtro.Cidade = Util.Format.RemoverAcentos(ddlCidade.SelectedItem.Text); } string strLogradouro = Util.Format.RemoverAcentos(txtLogradouro.Text); strLogradouro = strLogradouro.Substring(strLogradouro.IndexOf(" "), strLogradouro.Length - strLogradouro.IndexOf(" ")).Trim(); filtro.Bairro = Util.Format.RemoverAcentos(txtBairro.Text); filtro.Logradouro = strLogradouro; filtro.Numero = txtNumero.Text; listRet = n.PesquisaMoradoresMesmoEndereco(filtro); hdnUfEstado.Value = ""; hdnCidade.Value = ""; if (listRet != null) { divResultado.Visible = true; if (listRet.Count > 0) { gridResultMoradores.DataSource = listRet; gridResultMoradores.DataBind(); Util.Format.OcultaColunaEspecificaGrid(ref gridResultMoradores, 1); } else { gridResultMoradores.DataSource = null; gridResultMoradores.EmptyDataText = "NENHUM REGISTRO ENCONTRADO."; gridResultMoradores.DataBind(); } //Transformando o Retorno em XML para gravar no banco var xns = new XmlSerializerNamespaces(); xns.Add(string.Empty, string.Empty); var xs = new XmlSerializer(listRet.GetType()); var xml = new StringWriter(); xs.Serialize(xml, listRet, xns); HTMLRetornado = xml.ToString(); string parametrosPesquisado = ""; string valorParametrosPesquisado = ""; if (!filtro.Cep.Trim().Equals("")) { parametrosPesquisado = "CEP | "; valorParametrosPesquisado = filtro.Cep + " | "; } parametrosPesquisado += "UF | CIDADE | BAIRRO | LOGRADOURO | NUMERO"; valorParametrosPesquisado += ddlUF.SelectedItem.Text + " | " + ddlCidade.SelectedItem.Text + " | " + txtBairro.Text + " | " + txtLogradouro.Text + " | " + txtNumero.Text; string NomeInternoProduto = "WEB RASTREAMENTO MORADORES MESMO ENDERECO"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("S", codigoItemProduto, "", valorParametrosPesquisado, parametrosPesquisado); SalvarHistoricoFornecedor("S", hist.IdHistoricoConsulta, xml.ToString(), NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); } else { lblMensagemRetorno.Visible = true; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Text = "NENHUM REGISTRO ENCONTRADO.<br/><br/>"; string mensagemExibir = "<span id='lblTexto30DiasTexto1' class='texto' style='display:inline-block;font-weight:normal'>"; //mensagemExibir += ddlFiltro.Value.Trim().ToUpper() + ": <b>" + txtParametroInformado.Text + "</b>"; mensagemExibir += " </span><br/><br/>"; lblMensagemRetorno.Text += mensagemExibir; //divImprimirMensagemErro.Attributes.Add("style", "display:block;"); divEspacoBranco.Visible = true; divResultado.Visible = false; LimparCampos(); string parametrosPesquisado = ""; string valorParametrosPesquisado = ""; if (!filtro.Cep.Trim().Equals("")) { parametrosPesquisado = "CEP | "; valorParametrosPesquisado = filtro.Cep + " | "; } parametrosPesquisado += "UF | CIDADE | BAIRRO | LOGRADOURO | NUMERO"; valorParametrosPesquisado += ddlUF.SelectedItem.Text + " | " + ddlCidade.SelectedItem.Text + " | " + txtBairro.Text + " | " + txtLogradouro.Text + " | " + txtNumero.Text; string NomeInternoProduto = "WEB RASTREAMENTO MORADORES MESMO ENDERECO"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("N", codigoItemProduto, "", valorParametrosPesquisado, parametrosPesquisado); SalvarHistoricoFornecedor("N", hist.IdHistoricoConsulta, "NENHUM REGISTRO ENCONTRADO.", NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); //Page.ClientScript.RegisterStartupScript(this.GetType(), "Mensagem", "<script>alert('Veículo não encontrado.')</script>", false); } } catch (Exception ex) { Util.Log.Save("ex:" + ex.Message, "Consultar", "ConsultaWebRastreamentoMoradoresMesmoEndereco", HttpContext.Current.Server.MapPath(diretorioLog)); throw ex; } }
private void Consultar(string numeroCNPJ) { try { string HTMLRetornado = string.Empty; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Visible = false; divEspacoBranco.Visible = false; divResultado.Visible = false; divImprimirMensagemErro.Attributes.Add("style", "display:none;"); Negocios.Cadastral.WEB.RastreamentoPJPrata n = new Negocios.Cadastral.WEB.RastreamentoPJPrata(); Entidades.Cadastral.ResponsePJPrata retorno = new Entidades.Cadastral.ResponsePJPrata(); LimparCampos(); retorno = n.PesquisaPJPrata(numeroCNPJ); if (retorno != null) { divResultado.Visible = true; if (retorno.DadosCadastrais.CNPJ.Trim().Equals("")) { lblCNPJ.Text = "INDISPONÍVEL"; } else { lblCNPJ.Text = Util.Format.FormatString(retorno.DadosCadastrais.CNPJ.PadLeft(14, '0'), Util.Format.TypeString.CNPJ); } lblRazaoSocial.Text = retorno.DadosCadastrais.RazaoSocial.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.RazaoSocial; lblMatrizFilial.Text = retorno.DadosCadastrais.MatrizFilial.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.MatrizFilial; if (!retorno.DadosCadastrais.DataAbertura.Trim().Equals("")) { try { lblDataAbertura.Text = DateTime.Parse(retorno.DadosCadastrais.DataAbertura).ToString("dd/MM/yyyy"); } catch { lblDataAbertura.Text = "INDISPONÍVEL"; } } else { lblDataSituacaoCadastral.Text = "INDISPONÍVEL"; } lblNomeFantasia.Text = retorno.DadosCadastrais.NomeFantasia.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.NomeFantasia; lblNaturezaJuridica.Text = retorno.DadosCadastrais.NaturezaJuridica.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.NaturezaJuridica; lblSituacaoCadastral.Text = retorno.DadosCadastrais.SituacaoCadastral.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.SituacaoCadastral; if (!retorno.DadosCadastrais.DataSituacaoDastral.Trim().Equals("")) { try { lblDataSituacaoCadastral.Text = DateTime.Parse(retorno.DadosCadastrais.DataSituacaoDastral).ToString("dd/MM/yyyy"); } catch { lblDataSituacaoCadastral.Text = "INDISPONÍVEL"; } } else { lblDataSituacaoCadastral.Text = "INDISPONÍVEL"; } if (retorno.Enderecos != null || retorno.Enderecos.Count > 0) { gridResultEnderecos.DataSource = retorno.Enderecos; gridResultEnderecos.DataBind(); } else { gridResultEnderecos.DataSource = null; gridResultEnderecos.EmptyDataText = "NÃO HÁ INFORMAÇÕES SOBRE ENDEREÇO."; gridResultEnderecos.DataBind(); } if (retorno.Telefones != null || retorno.Telefones.Count > 0) { gridResultTelefones.DataSource = retorno.Telefones; gridResultTelefones.DataBind(); } else { gridResultTelefones.DataSource = null; gridResultTelefones.EmptyDataText = "NÃO HÁ INFORMAÇÕES SOBRE TELEFONE."; gridResultTelefones.DataBind(); } if (retorno.CNAE != null || retorno.CNAE.Count > 0) { gridResultCNAEs.DataSource = retorno.CNAE; gridResultCNAEs.DataBind(); } else { gridResultCNAEs.DataSource = null; gridResultCNAEs.EmptyDataText = "NÃO HÁ INFORMAÇÕES SOBRE CNAE."; gridResultCNAEs.DataBind(); } if (retorno.QSA != null && retorno.QSA.Count > 0) { gridResultQSA.DataSource = retorno.QSA; gridResultQSA.DataBind(); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 5); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 6); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 7); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 8); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 9); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 10); } else { gridResultQSA.DataSource = null; gridResultQSA.EmptyDataText = "NENHUM REGISTRO ENCONTRADO."; gridResultQSA.DataBind(); } //Transformando o Retorno em XML para gravar no banco var xns = new XmlSerializerNamespaces(); xns.Add(string.Empty, string.Empty); var xs = new XmlSerializer(retorno.GetType()); var xml = new StringWriter(); xs.Serialize(xml, retorno, xns); HTMLRetornado = xml.ToString(); string NomeInternoProduto = "WEB RASTREAMENTO PJ PRATA"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("S", codigoItemProduto, "", numeroCNPJ, "CNPJ"); SalvarHistoricoFornecedor("S", hist.IdHistoricoConsulta, xml.ToString(), NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); } else { lblMensagemRetorno.Visible = true; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Text = "CNPJ NÃO LOCALIZADO.<br/><br/>"; string mensagemExibir = "<span id='lblTexto30DiasTexto1' class='texto' style='display:inline-block;font-weight:normal'>"; mensagemExibir += ddlFiltro.Value.Trim().ToUpper() + ": <b>" + txtParametroInformado.Text + "</b>"; mensagemExibir += " </span><br/><br/>"; lblMensagemRetorno.Text += mensagemExibir; divImprimirMensagemErro.Attributes.Add("style", "display:block;"); divEspacoBranco.Visible = true; divResultado.Visible = false; LimparCampos(); string NomeInternoProduto = "WEB RASTREAMENTO PJ PRATA"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("N", codigoItemProduto, "", numeroCNPJ, "CNPJ"); SalvarHistoricoFornecedor("N", hist.IdHistoricoConsulta, "CNPJ NÃO LOCALIZADO.", NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); //Page.ClientScript.RegisterStartupScript(this.GetType(), "Mensagem", "<script>alert('Veículo não encontrado.')</script>", false); } } catch (Exception ex) { Util.Log.Save("ex:" + ex.Message, "Consultar", "ConsultaWebRastreamentoPJPrata", HttpContext.Current.Server.MapPath(diretorioLog)); throw ex; } }
private void Consultar() { try { string HTMLRetornado = string.Empty; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Visible = false; divEspacoBranco.Visible = false; divResultado.Visible = false; divImprimirMensagemErro.Attributes.Add("style", "display:none;"); Negocios.Cadastral.WEB.RastreamentoSearchTelefonePJ n = new Negocios.Cadastral.WEB.RastreamentoSearchTelefonePJ(); List <Entidades.Cadastral.ResponseSearchTelefonePJ> listRet = new List <Entidades.Cadastral.ResponseSearchTelefonePJ>(); Entidades.Cadastral.FiltroPesquisaSearchTelefonePJ filtro = new Entidades.Cadastral.FiltroPesquisaSearchTelefonePJ(); filtro.DDD = txtDDD.Text.Trim(); filtro.NumeroTel = txtTelefone.Text.Trim().Replace("-", ""); listRet = n.PesquisaSearchPJ(filtro); if (listRet != null) { divResultado.Visible = true; if (listRet.Count > 0) { gridResult.DataSource = listRet; gridResult.DataBind(); Util.Format.OcultaColunaEspecificaGrid(ref gridResult, 3); Util.Format.OcultaColunaEspecificaGrid(ref gridResult, 4); Util.Format.OcultaColunaEspecificaGrid(ref gridResult, 5); } else { gridResult.DataSource = null; gridResult.EmptyDataText = "NENHUM REGISTRO ENCONTRADO."; gridResult.DataBind(); } //Transformando o Retorno em XML para gravar no banco var xns = new XmlSerializerNamespaces(); xns.Add(string.Empty, string.Empty); var xs = new XmlSerializer(listRet.GetType()); var xml = new StringWriter(); xs.Serialize(xml, listRet, xns); HTMLRetornado = xml.ToString(); string parametrosPesquisado = "(" + filtro.DDD + ") " + filtro.NumeroTel; string NomeInternoProduto = "WEB RASTREAMENTO SEARCH TELEFONE PJ"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("S", codigoItemProduto, "", parametrosPesquisado, "TELEFONE"); SalvarHistoricoFornecedor("S", hist.IdHistoricoConsulta, xml.ToString(), NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); } else { lblMensagemRetorno.Visible = true; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Text = "NENHUM REGISTRO ENCONTRADO.<br/><br/>"; string mensagemExibir = "<span id='lblTexto30DiasTexto1' class='texto' style='display:inline-block;font-weight:normal'>"; //mensagemExibir += ddlFiltro.Value.Trim().ToUpper() + ": <b>" + txtParametroInformado.Text + "</b>"; mensagemExibir += " </span><br/><br/>"; lblMensagemRetorno.Text += mensagemExibir; //divImprimirMensagemErro.Attributes.Add("style", "display:block;"); divEspacoBranco.Visible = true; divResultado.Visible = false; LimparCampos(); string parametrosPesquisado = "(" + filtro.DDD + ") " + filtro.NumeroTel; string NomeInternoProduto = "WEB RASTREAMENTO SEARCH TELEFONE PJ"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("N", codigoItemProduto, "", parametrosPesquisado, "TELEFONE"); SalvarHistoricoFornecedor("N", hist.IdHistoricoConsulta, "CNENHUM REGISTRO ENCONTRADO.", NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); //Page.ClientScript.RegisterStartupScript(this.GetType(), "Mensagem", "<script>alert('Veículo não encontrado.')</script>", false); } } catch (Exception ex) { Util.Log.Save("ex:" + ex.Message, "Consultar", "ConsultaWebRastreamentoSearchTelefonePJ", HttpContext.Current.Server.MapPath(diretorioLog)); throw ex; } }
private void Consultar(string numeroCPF) { try { string HTMLRetornado = string.Empty; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Visible = false; divEspacoBranco.Visible = false; divResultado.Visible = false; divImprimirMensagemErro.Attributes.Add("style", "display:none;"); Negocios.Cadastral.WEB.RastreamentoPFPrata n = new Negocios.Cadastral.WEB.RastreamentoPFPrata(); Entidades.Cadastral.ResponsePFPrata retorno = new Entidades.Cadastral.ResponsePFPrata(); LimparCampos(); retorno = n.PesquisaPFPrata(numeroCPF); if (retorno != null) { divResultado.Visible = true; lblNomeCompleto.Text = retorno.DadosCadastrais.Nome; lblNomeMae.Text = retorno.DadosCadastrais.NomeMae.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.NomeMae; lblCPF.Text = retorno.DadosCadastrais.CPF.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.CPF; if (retorno.DadosCadastrais.CPF.Trim().Equals("")) { lblCPF.Text = "INDISPONÍVEL"; } else { lblCPF.Text = Util.Format.FormatString(retorno.DadosCadastrais.CPF.PadLeft(11, '0'), Util.Format.TypeString.CPF); } lblStatusCPF.Text = retorno.DadosCadastrais.StatusCPF.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.StatusCPF; lblRG.Text = retorno.DadosCadastrais.RG.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.RG; lblTituloEleitor.Text = retorno.DadosCadastrais.TituloEleitoral.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.TituloEleitoral; lblIdade.Text = retorno.DadosCadastrais.Idade.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.Idade; lblSexo.Text = retorno.DadosCadastrais.Sexo.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.Sexo; lblSexo.Text = lblSexo.Text.Trim().Equals("M") ? "MASCULINO" : "FEMININO"; lblSigno.Text = retorno.DadosCadastrais.Signo.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.Signo; lblEscolaridade.Text = retorno.DadosCadastrais.Escolaridade.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.Escolaridade; lblRendaEstimada.Text = retorno.DadosCadastrais.RendaEstimada.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.RendaEstimada; lblEstadoCivil.Text = retorno.DadosCadastrais.EstadoCivil.Replace("0", "").Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.EstadoCivil; lblClasseSocial.Text = retorno.DadosCadastrais.ClasseSocial.Trim().Equals("") ? "INDISPONÍVEL" : retorno.DadosCadastrais.ClasseSocial; lblObito.Text = retorno.DadosCadastrais.Obito.Trim().Equals("") ? " - " : retorno.DadosCadastrais.Obito; lblDtObito.Text = retorno.DadosCadastrais.DataObito.Trim().Equals("") ? " - " : retorno.DadosCadastrais.DataObito; if (!retorno.DadosCadastrais.DataObito.Trim().Equals("")) { try { lblDtObito.Text = DateTime.Parse(retorno.DadosCadastrais.DataObito).ToString("dd/MM/yyyy"); } catch { lblDtObito.Text = " - "; } } else { lblDtObito.Text = " - "; } if (!retorno.DadosCadastrais.DataNascimento.Trim().Equals("")) { try { lblDataNascimento.Text = DateTime.Parse(retorno.DadosCadastrais.DataNascimento).ToString("dd/MM/yyyy"); } catch { lblDataNascimento.Text = "INDISPONÍVEL"; } } else { lblDataNascimento.Text = "INDISPONÍVEL"; } if (retorno.Enderecos != null || retorno.Enderecos.Count > 0) { gridResultEnderecos.DataSource = retorno.Enderecos; gridResultEnderecos.DataBind(); } else { gridResultEnderecos.DataSource = null; gridResultEnderecos.EmptyDataText = "NÃO HÁ INFORMAÇÕES SOBRE ENDEREÇO."; gridResultEnderecos.DataBind(); } if (retorno.Telefones != null || retorno.Telefones.Count > 0) { gridResultTelefones.DataSource = retorno.Telefones; gridResultTelefones.DataBind(); } else { gridResultTelefones.DataSource = null; gridResultTelefones.EmptyDataText = "NÃO HÁ INFORMAÇÕES SOBRE TELEFONE."; gridResultTelefones.DataBind(); } if (retorno.Emails != null || retorno.Emails.Count > 0) { gridResultEmails.DataSource = retorno.Emails; gridResultEmails.DataBind(); } else { gridResultEmails.DataSource = null; gridResultEmails.EmptyDataText = "NÃO HÁ INFORMAÇÕES SOBRE EMAIL."; gridResultEmails.DataBind(); } if (retorno.QSA != null && retorno.QSA.Count > 0) { gridResultQSA.DataSource = retorno.QSA; gridResultQSA.DataBind(); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 3); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 4); Util.Format.OcultaColunaEspecificaGrid(ref gridResultQSA, 5); } else { gridResultQSA.DataSource = null; gridResultQSA.EmptyDataText = "NENHUM REGISTRO ENCONTRADO."; gridResultQSA.DataBind(); } //Transformando o Retorno em XML para gravar no banco var xns = new XmlSerializerNamespaces(); xns.Add(string.Empty, string.Empty); var xs = new XmlSerializer(retorno.GetType()); var xml = new StringWriter(); xs.Serialize(xml, retorno, xns); HTMLRetornado = xml.ToString(); string NomeInternoProduto = "WEB RASTREAMENTO PF PRATA"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("S", codigoItemProduto, "", numeroCPF, "CPF"); SalvarHistoricoFornecedor("S", hist.IdHistoricoConsulta, xml.ToString(), NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); } else { lblMensagemRetorno.Visible = true; lblMensagemRetorno.Text = ""; lblMensagemRetorno.Text = "CPF NÃO LOCALIZADO.<br/><br/>"; string mensagemExibir = "<span id='lblTexto30DiasTexto1' class='texto' style='display:inline-block;font-weight:normal'>"; mensagemExibir += ddlFiltro.Value.Trim().ToUpper() + ": <b>" + txtParametroInformado.Text + "</b>"; mensagemExibir += " </span><br/><br/>"; lblMensagemRetorno.Text += mensagemExibir; divImprimirMensagemErro.Attributes.Add("style", "display:block;"); divEspacoBranco.Visible = true; divResultado.Visible = false; LimparCampos(); string NomeInternoProduto = "WEB RASTREAMENTO PF PRATA"; Entidades.HistoricoPesquisa hist = SalvarHistoricoPesquisa("N", codigoItemProduto, "", numeroCPF, "CPF"); SalvarHistoricoFornecedor("N", hist.IdHistoricoConsulta, "CPF NÃO LOCALIZADO.", NomeInternoProduto, "DNA"); lblDataConsulta.Text = DataBR.ToString("dd/MM/yyyy") + " às " + DataBR.ToString("HH:mm"); lblNumeroConsulta.Text = hist.IdHistoricoConsulta.ToString().PadLeft(5, '0'); //Page.ClientScript.RegisterStartupScript(this.GetType(), "Mensagem", "<script>alert('Veículo não encontrado.')</script>", false); } } catch (Exception ex) { Util.Log.Save("ex:" + ex.Message, "Consultar", "ConsultaWebRastreamentoPFPrata", HttpContext.Current.Server.MapPath(diretorioLog)); throw ex; } }