Пример #1
0
        public static (string, bool) ConsultaCorreios(string cep)
        {
            try
            {
                AtendeClienteClient ws       = new AtendeClienteClient();
                enderecoERP         response = ws.consultaCEPAsync(cep).GetAwaiter().GetResult().@return;


                string ibge = IBGE.RetornaIdMunicipioIBGE(response.cidade, response.uf);



                object retorno = new
                {
                    cep         = response.cep,
                    logradouro  = response.end,
                    complemento = response.complemento2,
                    bairro      = response.bairro,
                    localidade  = response.cidade,
                    uf          = response.uf,
                    unidade     = response.unidadesPostagem,
                    ibge        = ibge
                };

                return(JsonConvert.SerializeObject(retorno), true);
            }
            catch (System.Exception ex)
            {
                object msg = new { msg = "CEP Inválido" };
                return(JsonConvert.SerializeObject(msg), false);
            }
        }
Пример #2
0
 public Pais(int id, int codigo, string nome, int bacen, bool ativo)
 {
     Id     = id;
     Codigo = codigo;
     Nome   = nome;
     BACEN  = new IBGE(bacen);
     Ativo  = ativo;
 }
Пример #3
0
        /// <summary>
        /// Returns the hash code of the CEP object.
        /// </summary>
        /// <returns>The CEP's hash code.</returns>
        public override int GetHashCode()
        {
            unchecked
            {
                int hashcode;

                const int baseHash       = 63689;
                const int baseMultiplier = 378551;

                hashcode = (baseHash * baseMultiplier) ^ ZipCode.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Address.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Complement.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Neighborhood.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ City.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ State.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Unity.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ IBGE.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ GIA.GetHashCode();

                return(hashcode);
            }
        }
Пример #4
0
        public JsonResult GetNoticia()
        {
            IBGE noticia = new IBGE();

            return(Json(noticia.getNoticia(), JsonRequestBehavior.AllowGet));
        }