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; } }
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; } }