Example #1
0
        private async void validaCep()
        {
            SplashScreenManager.ShowForm(typeof(XFrmWait));

            XFrmWait.ShowSplashScreen("Procurando CEP");

            string cep = txtCep.Text;

            FindCepIts find = new FindCepIts();

            var result = await find.FindAdress(txtCep.Text);

            if (result)
            {
                txtCidade.Enabled  = false;
                txtUf.Enabled      = false;
                lblFlagCep.Visible = true;
            }
            else
            {
                txtCidade.Enabled  = true;
                txtUf.Enabled      = true;
                lblFlagCep.Visible = false;
            }

            txtCep.Text        = find.Cep;
            txtCidade.Text     = find.Cidade;
            txtUf.Text         = find.UF;
            txtBairro.Text     = find.Bairro;
            txtLogradouro.Text = find.Endereco;

            SplashScreenManager.CloseForm();
        }
Example #2
0
        private async Task findCep()
        {
            string cep = txtCep.Text;

            if (!String.IsNullOrWhiteSpace(cep))
            {
                FindCepIts find = new FindCepIts();

                try
                {
                    bool result = await find.FindAdress(cep);

                    this.CEP      = find.Cep;
                    this.Cidade   = find.Cidade;
                    this.UF       = find.UF;
                    this.Bairro   = find.Bairro;
                    this.Endereco = find.Endereco;

                    this.txtCep.Text        = CEP;
                    this.txtCidade.Text     = Cidade;
                    this.txtUF.Text         = UF;
                    this.txtBairro.Text     = Bairro;
                    this.txtLogradouro.Text = Endereco;

                    if (result)
                    {
                        this.lblFlagCep.Visible = true;
                    }
                    else
                    {
                        this.lblFlagCep.Visible = false;
                    }
                }
                catch (Exception ex) { LoggerUtilIts.GenerateLogs(ex); }
            }
        }
Example #3
0
        private async void validaCep()
        {
            if (chValidacaoOnline.Checked)
            {
                XFrmWait.ShowSplashScreen("Validando CEP...");

                //SplashScreenManager.ShowForm(typeof(XFrmWait));

                FindCepIts find = new FindCepIts();

                var result = await find.FindAdress(txtCep.Text);

                this.lblFlagCep.Visible = true;

                if (result)
                {
                    //atualiza o cep
                    this.txtCep.Text = find.Cep;

                    this.Cep = txtCep.Text;


                    if (!string.IsNullOrEmpty(find.Bairro))
                    {
                        this.txtBairro.Text = find.Bairro;
                    }

                    if (!string.IsNullOrEmpty(find.Endereco))
                    {
                        this.txtEndereco.Text = find.Endereco;
                    }

                    if (!string.IsNullOrEmpty(find.Complemento))
                    {
                        this.txtComplemento.Text = find.Complemento;
                    }

                    if (!string.IsNullOrEmpty(find.Cidade))
                    {
                        this.txtCidade.Text = find.Cidade;
                    }

                    if (!string.IsNullOrEmpty(find.UF))
                    {
                        this.txtUf.Text = find.UF;
                    }


                    if (!string.IsNullOrEmpty(find.Cidade))
                    {
                        this.comboCidade.Properties.Items.Clear();
                        this.comboCidade.Properties.Items.Add(find.Cidade);
                        this.comboCidade.SelectedIndex = 0;
                    }

                    if (!string.IsNullOrEmpty(find.UF))
                    {
                        this.comboUf.Properties.Items.Clear();
                        this.comboUf.Properties.Items.Add(find.UF);
                        this.comboUf.SelectedIndex = 0;
                    }

                    //Flag ok
                    this.lblFlagCep.Appearance.Image = Properties.Resources.apply_16x16;
                }
                else
                {
                    //Flag nao encontrado
                    this.lblFlagCep.Appearance.Image = Properties.Resources.cancel_16x16;
                }

                XFrmWait.CloseSplashScreen();
                //SplashScreenManager.CloseForm();
            }
        }