コード例 #1
0
        public PessoaEndereco GetAddr(string cep)
        {
            if (cep.Length != 8)
            {
                //Alert.Message("Opss", "CEP inválido.", Alert.AlertType.error);
                //MessageBox.Show("CEP inválido.");
                return(this);
            }

            var d = new CEP();

            d.SetCep(cep);

            if (d.ValidationCep())
            {
                Estado = d.GetRetornoCorreios().uf;
                Cidade = d.GetRetornoCorreios().cidade;
                Rua    = d.GetRetornoCorreios().end;
                Bairro = d.GetRetornoCorreios().bairro;
                IBGE   = d.GetIBGE();
            }
            else
            {
                Estado = "";
                Cidade = "";
                Rua    = "";
                Bairro = "";
                IBGE   = "";
            }

            return(this);
        }