public List <Entidades.Cadastral.ResponseSearchTelefonePJ> PesquisaSearchPJ(Entidades.Cadastral.FiltroPesquisaSearchTelefonePJ filtro) { try { List <Entidades.Cadastral.ResponseSearchTelefonePJ> listRet = new List <Entidades.Cadastral.ResponseSearchTelefonePJ>(); DataSet ds = new DataSet(); Dados.Cadastral.WS.RastreamentoSearchTelefonePJ neg = new Dados.Cadastral.WS.RastreamentoSearchTelefonePJ(); neg.PesquisaSearchTelefonePJ(filtro, ref ds); if (ds != null && ds.Tables.Count > 0) { // Tabela 1 -> Resultado foreach (DataRow dr in ds.Tables[0].Rows) { Entidades.Cadastral.ResponseSearchTelefonePJ retResponse = new Entidades.Cadastral.ResponseSearchTelefonePJ(); retResponse.CNPJ = dr["CNPJ"].ToString(); retResponse.RazaoSocial = dr["RAZAO_SOCIAL"].ToString(); retResponse.NomeFantasia = dr["NOME_FANTASIA"].ToString(); retResponse.DDD = dr["DDD"].ToString(); retResponse.Telefone = dr["TELEFONE"].ToString(); listRet.Add(retResponse); } if (ds.Tables[0].Rows.Count == 0) { return(null); } else { return(listRet); } } return(null); } catch (Exception ex) { throw ex; } }
public void PesquisaSearchTelefonePJ(Entidades.Cadastral.FiltroPesquisaSearchTelefonePJ filtro, ref DataSet oDS) { try { ConexaoPersonalizada oConn = new ConexaoPersonalizada(); try { OracleParameter[] arParms = new OracleParameter[3]; arParms[0] = new OracleParameter(); arParms[0].ParameterName = "P_DDD"; arParms[0].OracleDbType = OracleDbType.Varchar2; arParms[0].Direction = ParameterDirection.Input; arParms[0].Value = filtro.DDD; arParms[1] = new OracleParameter(); arParms[1].ParameterName = "P_TEL"; arParms[1].OracleDbType = OracleDbType.Varchar2; arParms[1].Direction = ParameterDirection.Input; arParms[1].Value = filtro.NumeroTel; arParms[2] = new OracleParameter(); arParms[2].ParameterName = "R_CURSOR"; arParms[2].OracleDbType = OracleDbType.RefCursor; arParms[2].Direction = ParameterDirection.Output; oConn.Execute("DNAINFO.P_L_WS_RASTREA_SEARCH_TEL_PJ", arParms, ref oDS); } catch (Exception ex) { throw ex; } finally { oConn.CloseConnection(); oConn = null; } } catch (Exception ex) { throw ex; } }
public Entidades.Cadastral.ResponseSearchTelefonePJ_WS PesquisaSearchTelefonePF(Entidades.Cadastral.FiltroPesquisaSearchTelefonePJ filtro) { try { Entidades.Cadastral.ResponseSearchTelefonePJ_WS retResponse = new Entidades.Cadastral.ResponseSearchTelefonePJ_WS(); DataSet ds = new DataSet(); Dados.Cadastral.WS.RastreamentoSearchTelefonePJ neg = new Dados.Cadastral.WS.RastreamentoSearchTelefonePJ(); neg.PesquisaSearchTelefonePJ(filtro, ref ds); if (ds != null && ds.Tables.Count > 0) { // Tabela 1 -> Resultado foreach (DataRow dr in ds.Tables[0].Rows) { Entidades.Cadastral.ResponseSearchTelPJDadosEmpresa dadosE = new Entidades.Cadastral.ResponseSearchTelPJDadosEmpresa(); dadosE.CNPJ = dr["CNPJ"].ToString(); dadosE.RazaoSocial = dr["RAZAO_SOCIAL"].ToString(); dadosE.NomeFantasia = dr["NOME_FANTASIA"].ToString(); if (retResponse.ListResponseSearchTelPJDadosEmpresa == null) { retResponse.ListResponseSearchTelPJDadosEmpresa = new List <Entidades.Cadastral.ResponseSearchTelPJDadosEmpresa>(); } retResponse.ListResponseSearchTelPJDadosEmpresa.Add(dadosE); } if (ds.Tables[0].Rows.Count == 0) { return(null); } else { return(retResponse); } } return(null); } 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.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; } }