Exemplo n.º 1
0
 public Endereco(GTI_Models.Models.Endereco reg, Endereco_Enable fields, int xPos = 200, int yPos = 200, string Title = "Cadastro de endereço")
 {
     InitializeComponent();
     Carrega_Endereco(reg);
     LogradouroText.Enabled       = fields.Endereco;
     LogradouroList.Enabled       = fields.Endereco;
     NumeroList.Enabled           = fields.Numero;
     ComplementoText.Enabled      = fields.Complemento;
     PaisList.Enabled             = fields.Pais;
     EmailText.Enabled            = fields.Email;
     UFList.Enabled               = fields.Uf;
     CidadeList.Enabled           = fields.Cidade;
     BairroList.Enabled           = fields.Bairro;
     BairroText.Enabled           = fields.Bairro;
     CepMask.Enabled              = fields.Endereco;
     PaisButton_Refresh.Enabled   = fields.Pais;
     BairroButton_Refresh.Enabled = fields.Bairro;
     _telefone             = fields.Telefone;
     TelefoneText.Enabled  = _telefone;
     TemFoneCheck.Enabled  = _telefone;
     WhatsAppCheck.Enabled = _telefone;
     StartLocationX        = xPos;
     StartLocationY        = yPos;
     _title = Title;
     Esconde_Bairro(reg.Sigla_uf, reg.Id_cidade);
 }
Exemplo n.º 2
0
        private void BtAddEnderecoC_Click(object sender, EventArgs e)
        {
            GTI_Models.Models.Endereco reg = new GTI_Models.Models.Endereco {
                Id_pais   = string.IsNullOrWhiteSpace(PaisCText.Text) ? 1 : Convert.ToInt32(PaisCText.Tag.ToString()),
                Sigla_uf  = UFCText.Text == "" ? "SP" : UFCText.Text,
                Id_cidade = string.IsNullOrWhiteSpace(CidadeCText.Text) ? 413 : Convert.ToInt32(CidadeCText.Tag.ToString()),
                Id_bairro = string.IsNullOrWhiteSpace(BairroCText.Text) ? 0 : Convert.ToInt32(BairroCText.Tag.ToString())
            };
            if (LogradouroCText.Tag == null)
            {
                LogradouroCText.Tag = "0";
            }
            if (string.IsNullOrWhiteSpace(LogradouroCText.Tag.ToString()))
            {
                LogradouroCText.Tag = "0";
            }
            reg.Id_logradouro   = string.IsNullOrWhiteSpace(LogradouroCText.Text) ? 0 : Convert.ToInt32(LogradouroCText.Tag.ToString());
            reg.Nome_logradouro = reg.Id_cidade != 413 ? LogradouroCText.Text : "";
            reg.Numero_imovel   = NumeroCText.Text == "" ? 0 : Convert.ToInt32(NumeroCText.Text);
            reg.Complemento     = ComplementoCText.Text;
            reg.Email           = EmailCText.Text;
            reg.Telefone        = FoneCText.Text;
            reg.Cep             = reg.Id_cidade != 413 ? CepCText.Text == "" ? 0 : Convert.ToInt32(gtiCore.ExtractNumber(CepCText.Text)) : 0;
            reg.TemFone         = TemFoneCCheck.Checked;
            reg.WhatsApp        = WhatsAppCCheck.Checked;
            int             _x      = Location.X + EndRPanel.Location.X + AddEnderecoCButton.Location.X;
            int             _y      = Location.Y + EndRPanel.Location.Y + AddEnderecoCButton.Location.Y;
            Endereco_Enable _fields = new Endereco_Enable()
            {
                Bairro = true, Cidade = true, Email = true, Endereco = true, Pais = true, Telefone = true, Uf = true, Complemento = true, Numero = true
            };
            Endereco f1 = new Endereco(reg, _fields, _x, _y - 20, "Cadastro de endereço comercial");

            f1.ShowDialog();
            if (!f1.EndRetorno.Cancelar)
            {
                PaisCText.Text         = f1.EndRetorno.Nome_pais;
                PaisCText.Tag          = f1.EndRetorno.Id_pais.ToString();
                UFCText.Text           = f1.EndRetorno.Sigla_uf;
                CidadeCText.Text       = f1.EndRetorno.Nome_cidade;
                CidadeCText.Tag        = f1.EndRetorno.Id_cidade.ToString();
                BairroCText.Text       = f1.EndRetorno.Nome_bairro;
                BairroCText.Tag        = f1.EndRetorno.Id_bairro.ToString();
                LogradouroCText.Text   = f1.EndRetorno.Nome_logradouro;
                LogradouroCText.Tag    = f1.EndRetorno.Id_logradouro.ToString();
                NumeroCText.Text       = f1.EndRetorno.Numero_imovel.ToString();
                ComplementoCText.Text  = f1.EndRetorno.Complemento;
                EmailCText.Text        = f1.EndRetorno.Email;
                CepCText.Text          = f1.EndRetorno.Cep.ToString("00000-000");
                FoneCText.Text         = f1.EndRetorno.Telefone;
                TemFoneCCheck.Checked  = (bool)f1.EndRetorno.TemFone;
                WhatsAppCCheck.Checked = (bool)f1.EndRetorno.WhatsApp;
            }
        }
Exemplo n.º 3
0
 private void BtCancel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Cancelar a edição do endereço?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         EndRetorno = new GTI_Models.Models.Endereco {
             Cancelar = true
         };
         Close();
         return;
     }
 }
Exemplo n.º 4
0
        private void BtAddEnderecoC_Click(object sender, EventArgs e)
        {
            GTI_Models.Models.Endereco reg = new GTI_Models.Models.Endereco {
                Id_pais   = string.IsNullOrWhiteSpace(PaisCText.Text) ? 1 : Convert.ToInt32(PaisCText.Tag.ToString()),
                Sigla_uf  = UFCText.Text == "" ? "SP" : UFCText.Text,
                Id_cidade = string.IsNullOrWhiteSpace(CidadeCText.Text) ? 413 : Convert.ToInt32(CidadeCText.Tag.ToString()),
                Id_bairro = string.IsNullOrWhiteSpace(BairroCText.Text) ? 0 : Convert.ToInt32(BairroCText.Tag.ToString())
            };
            if (LogradouroCText.Tag == null)
            {
                LogradouroCText.Tag = "0";
            }
            if (string.IsNullOrWhiteSpace(LogradouroCText.Tag.ToString()))
            {
                LogradouroCText.Tag = "0";
            }
            reg.Id_logradouro   = string.IsNullOrWhiteSpace(LogradouroCText.Text) ? 0 : Convert.ToInt32(LogradouroCText.Tag.ToString());
            reg.Nome_logradouro = reg.Id_cidade != 413 ? LogradouroCText.Text : "";
            reg.Numero_imovel   = NumeroCText.Text == "" ? 0 : Convert.ToInt32(NumeroCText.Text);
            reg.Complemento     = ComplementoCText.Text;
            reg.Email           = EmailCText.Text;
            reg.Telefone        = FoneCText.Text;
            reg.Cep             = reg.Id_cidade != 413 ? CepCText.Text == "" ? 0 : Convert.ToInt32(gtiCore.ExtractNumber(CepCText.Text)) : 0;
            reg.TemFone         = TemFoneCCheck.Checked;
            reg.WhatsApp        = WhatsAppCCheck.Checked;

            Forms.Endereco f1 = new Forms.Endereco(reg, false, true, true, true);
            f1.ShowDialog();
            if (!f1.EndRetorno.Cancelar)
            {
                PaisCText.Text         = f1.EndRetorno.Nome_pais;
                PaisCText.Tag          = f1.EndRetorno.Id_pais.ToString();
                UFCText.Text           = f1.EndRetorno.Sigla_uf;
                CidadeCText.Text       = f1.EndRetorno.Nome_cidade;
                CidadeCText.Tag        = f1.EndRetorno.Id_cidade.ToString();
                BairroCText.Text       = f1.EndRetorno.Nome_bairro;
                BairroCText.Tag        = f1.EndRetorno.Id_bairro.ToString();
                LogradouroCText.Text   = f1.EndRetorno.Nome_logradouro;
                LogradouroCText.Tag    = f1.EndRetorno.Id_logradouro.ToString();
                NumeroCText.Text       = f1.EndRetorno.Numero_imovel.ToString();
                ComplementoCText.Text  = f1.EndRetorno.Complemento;
                EmailCText.Text        = f1.EndRetorno.Email;
                CepCText.Text          = f1.EndRetorno.Cep.ToString("00000-000");
                FoneCText.Text         = f1.EndRetorno.Telefone;
                TemFoneCCheck.Checked  = (bool)f1.EndRetorno.TemFone;
                WhatsAppCCheck.Checked = (bool)f1.EndRetorno.WhatsApp;
            }
        }
Exemplo n.º 5
0
 public Endereco(GTI_Models.Models.Endereco reg, bool EnderecoLocal, bool EditarBairro, bool CamposObrigatorios, bool Telefone)
 {
     InitializeComponent();
     Carrega_Endereco(reg);
     PaisList.Enabled             = !EnderecoLocal;
     UFList.Enabled               = !EnderecoLocal;
     CidadeList.Enabled           = !EnderecoLocal;
     BairroList.Enabled           = EditarBairro;
     PaisButton_Refresh.Enabled   = !EnderecoLocal;
     BairroButton_Refresh.Enabled = !EnderecoLocal;
     _camposObrigatorios          = CamposObrigatorios;
     _telefone             = Telefone;
     TelefoneText.Enabled  = _telefone;
     TemFoneCheck.Enabled  = _telefone;
     WhatsAppCheck.Enabled = _telefone;
 }
Exemplo n.º 6
0
        private void EnderecoAddButton_Click(object sender, EventArgs e)
        {
            GTI_Models.Models.Endereco reg = new GTI_Models.Models.Endereco {
                Id_pais   = 1,
                Sigla_uf  = "SP",
                Id_cidade = 413,
            };
            if (Bairro.Tag == null)
            {
                Bairro.Tag = "0";
            }
            reg.Id_bairro = string.IsNullOrWhiteSpace(Bairro.Tag.ToString()) ? 0 : Convert.ToInt32(Bairro.Tag.ToString());
            if (Logradouro.Tag == null)
            {
                Logradouro.Tag = "0";
            }
            if (string.IsNullOrWhiteSpace(Logradouro.Tag.ToString()))
            {
                Logradouro.Tag = "0";
            }
            reg.Id_logradouro   = string.IsNullOrWhiteSpace(Logradouro.Text) ? 0 : Convert.ToInt32(Logradouro.Tag.ToString());
            reg.Nome_logradouro = Logradouro.Text;
            reg.Numero_imovel   = Numero.Text == "" ? 0 : Convert.ToInt32(Numero.Text);
            reg.Complemento     = "";
            reg.Email           = "";
            int             _x      = Location.X + 300;
            int             _y      = Location.Y + 100;
            Endereco_Enable _fields = new Endereco_Enable()
            {
                Bairro = true, Endereco = true, Numero = true
            };
            Endereco f1 = new Endereco(reg, _fields, _x, _y - 20, "Pesquisa endereço");

            f1.ShowDialog();
            if (!f1.EndRetorno.Cancelar)
            {
                Bairro.Text     = f1.EndRetorno.Nome_bairro;
                Bairro.Tag      = f1.EndRetorno.Id_bairro.ToString();
                Logradouro.Text = f1.EndRetorno.Nome_logradouro;
                Logradouro.Tag  = f1.EndRetorno.Id_logradouro.ToString();
                Numero.Text     = f1.EndRetorno.Numero_imovel.ToString();
            }
        }
Exemplo n.º 7
0
        private void EnderecoButton_Click(object sender, EventArgs e)
        {
            GTI_Models.Models.Endereco reg = new GTI_Models.Models.Endereco {
                Id_pais   = 1,
                Sigla_uf  = UF.Text == "" ? "SP" : UF.Text,
                Id_cidade = string.IsNullOrWhiteSpace(Cidade.Text) ? 413 : Convert.ToInt32(Cidade.Tag.ToString()),
                Id_bairro = string.IsNullOrWhiteSpace(Bairro.Text) ? 0 : Convert.ToInt32(Bairro.Tag.ToString())
            };
            if (Logradouro.Tag == null)
            {
                Logradouro.Tag = "0";
            }
            if (string.IsNullOrWhiteSpace(Logradouro.Tag.ToString()))
            {
                Logradouro.Tag = "0";
            }
            reg.Id_logradouro   = string.IsNullOrWhiteSpace(Logradouro.Text) ? 0 : Convert.ToInt32(Logradouro.Tag.ToString());
            reg.Nome_logradouro = reg.Id_cidade != 413 ? Logradouro.Text : "";
            reg.Numero_imovel   = Numero.Text == "" ? 0 : Convert.ToInt32(Numero.Text);
            reg.Complemento     = Complemento.Text;
            reg.Email           = Email.Text;
            reg.Cep             = reg.Id_cidade != 413 ? Cep.Text == "" ? 0 : Convert.ToInt32(gtiCore.ExtractNumber(Cep.Text)) : 0;

            Forms.Endereco f1 = new Forms.Endereco(reg, false, true, true, true);
            f1.ShowDialog();
            if (!f1.EndRetorno.Cancelar)
            {
                Pais.Text        = "BRASIL";
                Pais.Tag         = "1";
                UF.Text          = f1.EndRetorno.Sigla_uf;
                Cidade.Text      = f1.EndRetorno.Nome_cidade;
                Cidade.Tag       = f1.EndRetorno.Id_cidade.ToString();
                Bairro.Text      = f1.EndRetorno.Nome_bairro;
                Bairro.Tag       = f1.EndRetorno.Id_bairro.ToString();
                Logradouro.Text  = f1.EndRetorno.Nome_logradouro;
                Logradouro.Tag   = f1.EndRetorno.Id_logradouro.ToString();
                Numero.Text      = f1.EndRetorno.Numero_imovel.ToString();
                Complemento.Text = f1.EndRetorno.Complemento;
                Email.Text       = f1.EndRetorno.Email;
                Cep.Text         = f1.EndRetorno.Cep.ToString("00000-000");
            }
        }
Exemplo n.º 8
0
        private void EnderecoButton_Click(object sender, EventArgs e)
        {
            GTI_Models.Models.Endereco reg = new GTI_Models.Models.Endereco {
                Id_pais   = 1,
                Sigla_uf  = "SP",
                Id_cidade = 413,
                Id_bairro = string.IsNullOrWhiteSpace(Bairro.Text) ? 0 : Convert.ToInt32(Bairro.Tag.ToString())
            };
            if (Logradouro.Tag == null)
            {
                Logradouro.Tag = "0";
            }
            if (string.IsNullOrWhiteSpace(Logradouro.Tag.ToString()))
            {
                Logradouro.Tag = "0";
            }
            reg.Id_logradouro   = string.IsNullOrWhiteSpace(Logradouro.Text) ? 0 : Convert.ToInt32(Logradouro.Tag.ToString());
            reg.Nome_logradouro = reg.Id_cidade != 413 ? Logradouro.Text : "";
            reg.Numero_imovel   = Numero.Text == "" ? 0 : Convert.ToInt32(Numero.Text);
            reg.Complemento     = Complemento.Text;

            int             _x      = Location.X + 250;
            int             _y      = Location.Y + 300;
            Endereco_Enable _fields = new Endereco_Enable()
            {
                Numero = true, Complemento = true
            };
            Endereco f1 = new Endereco(reg, _fields, _x, _y, "Local do condomínio");

            f1.ShowDialog();
            if (!f1.EndRetorno.Cancelar)
            {
                Bairro.Text      = f1.EndRetorno.Nome_bairro;
                Bairro.Tag       = f1.EndRetorno.Id_bairro.ToString();
                Logradouro.Text  = f1.EndRetorno.Nome_logradouro;
                Logradouro.Tag   = f1.EndRetorno.Id_logradouro.ToString();
                Numero.Text      = f1.EndRetorno.Numero_imovel.ToString();
                Complemento.Text = f1.EndRetorno.Complemento;
                CEP.Text         = f1.EndRetorno.Cep.ToString("00000-000");
            }
        }
Exemplo n.º 9
0
        private void EnderecoAddButton_Click(object sender, EventArgs e)
        {
            GTI_Models.Models.Endereco reg = new GTI_Models.Models.Endereco {
                Id_pais   = 1,
                Sigla_uf  = "SP",
                Id_cidade = 413,
            };
            if (Bairro.Tag == null)
            {
                Bairro.Tag = "0";
            }
            reg.Id_bairro = string.IsNullOrWhiteSpace(Bairro.Tag.ToString()) ? 0 : Convert.ToInt32(Bairro.Tag.ToString());
            if (Logradouro.Tag == null)
            {
                Logradouro.Tag = "0";
            }
            if (string.IsNullOrWhiteSpace(Logradouro.Tag.ToString()))
            {
                Logradouro.Tag = "0";
            }
            reg.Id_logradouro   = string.IsNullOrWhiteSpace(Logradouro.Text) ? 0 : Convert.ToInt32(Logradouro.Tag.ToString());
            reg.Nome_logradouro = Logradouro.Text;
            reg.Numero_imovel   = Numero.Text == "" ? 0 : Convert.ToInt32(Numero.Text);
            reg.Complemento     = "";
            reg.Email           = "";

            Forms.Endereco f1 = new Forms.Endereco(reg, true, true, false, true);
            f1.ShowDialog();
            if (!f1.EndRetorno.Cancelar)
            {
                Bairro.Text     = f1.EndRetorno.Nome_bairro;
                Bairro.Tag      = f1.EndRetorno.Id_bairro.ToString();
                Logradouro.Text = f1.EndRetorno.Nome_logradouro;
                Logradouro.Tag  = f1.EndRetorno.Id_logradouro.ToString();
                Numero.Text     = f1.EndRetorno.Numero_imovel.ToString();
            }
        }
Exemplo n.º 10
0
        private void BtReturn_Click(object sender, EventArgs e)
        {
            if (_camposObrigatorios)
            {
                if (Convert.ToInt32(CidadeList.SelectedValue) == 413)
                {
                    if (LogradouroText.Tag.ToString() == "")
                    {
                        LogradouroText.Tag = "0";
                    }
                    if (Convert.ToInt32(LogradouroText.Tag.ToString()) == 0)
                    {
                        MessageBox.Show("Selecione um logradouro válido!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(LogradouroText.Text))
                    {
                        MessageBox.Show("Digite o nome do logradouro!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                if (CepMask.Text.Trim() != "-")
                {
                    if (!CepMask.MaskFull)
                    {
                        MessageBox.Show("Cep inválido!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }

                if (!string.IsNullOrWhiteSpace(EmailText.Text) & !gtiCore.Valida_Email(EmailText.Text))
                {
                    MessageBox.Show("Endereço de email inválido.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (TelefoneText.Text.Trim() == "" && WhatsAppCheck.Checked)
                {
                    MessageBox.Show("Digite o nº do WhatsApp, ou desmarque esta opção.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (TelefoneText.Text.Trim() != "" && TemFoneCheck.Checked)
                {
                    MessageBox.Show("Apague o número de telefone, ou desmarque a opção que não possui telefone.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }


            EndRetorno = new GTI_Models.Models.Endereco();
            if (PaisList.SelectedIndex > -1)
            {
                EndRetorno.Id_pais   = Convert.ToInt32(PaisList.SelectedValue);
                EndRetorno.Nome_pais = PaisList.Text;
            }
            else
            {
                EndRetorno.Id_pais   = 0;
                EndRetorno.Nome_pais = "";
            }


            if (UFList.SelectedIndex > -1)
            {
                EndRetorno.Sigla_uf = UFList.SelectedValue.ToString();
                EndRetorno.Nome_uf  = UFList.Text;
            }
            else
            {
                EndRetorno.Sigla_uf = "";
                EndRetorno.Nome_uf  = "";
            }

            if (EndRetorno.Id_pais == 1 && EndRetorno.Sigla_uf == "EX")
            {
                MessageBox.Show("Selecione a UF.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (EndRetorno.Id_pais != 1 && EndRetorno.Sigla_uf != "EX")
            {
                MessageBox.Show("Apenas o Brasil pode ter UF.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (CidadeList.SelectedIndex > -1)
            {
                EndRetorno.Id_cidade   = Convert.ToInt32(CidadeList.SelectedValue);
                EndRetorno.Nome_cidade = CidadeList.Text;
            }
            else
            {
                EndRetorno.Id_cidade   = 0;
                EndRetorno.Nome_cidade = "";
            }
            if (BairroList.SelectedIndex > -1)
            {
                EndRetorno.Id_bairro   = Convert.ToInt32(BairroList.SelectedValue);
                EndRetorno.Nome_bairro = BairroList.Text;
            }
            else
            {
                EndRetorno.Id_bairro   = 0;
                EndRetorno.Nome_bairro = "";
            }

            if (BairroText.Text != "")
            {
                EndRetorno.Id_bairro   = Convert.ToInt32(BairroText.Tag.ToString());
                EndRetorno.Nome_bairro = BairroText.Text;
            }

            if (string.IsNullOrEmpty(LogradouroText.Tag.ToString()))
            {
                LogradouroText.Tag = "0";
            }
            EndRetorno.Id_logradouro   = Convert.ToInt32(LogradouroText.Tag.ToString());
            EndRetorno.Nome_logradouro = LogradouroText.Text;
            if (string.IsNullOrEmpty(NumeroList.Text.ToString()))
            {
                NumeroList.Text = "0";
            }
            EndRetorno.Numero_imovel = Convert.ToInt32(NumeroList.Text);
            EndRetorno.Complemento   = ComplementoText.Text;
            EndRetorno.Email         = EmailText.Text;
            string _cep = gtiCore.ExtractNumber(CepMask.Text);

            EndRetorno.Cep      = _cep == "" ? 0 : Convert.ToInt32(_cep);
            EndRetorno.Cancelar = false;
            EndRetorno.Telefone = TelefoneText.Text;
            EndRetorno.TemFone  = TemFoneCheck.Checked;
            EndRetorno.WhatsApp = WhatsAppCheck.Checked;
            Close();
            return;
        }
Exemplo n.º 11
0
        private void Carrega_Endereco(GTI_Models.Models.Endereco reg)
        {
            Carrega_Pais();
            Carrega_UF();
            if (reg.Id_pais > 0)
            {
                PaisList.SelectedValue = reg.Id_pais;
            }
            if (!string.IsNullOrWhiteSpace(reg.Sigla_uf))
            {
                UFList.SelectedValue = reg.Sigla_uf;
                CmbUF_SelectedIndexChanged(null, null);
            }
            if (reg.Id_cidade > 0)
            {
                CidadeList.SelectedValue = Convert.ToInt32(reg.Id_cidade);
                CmbCidade_SelectedIndexChanged(null, null);
            }
            Endereco_bll enderecoRepository = new Endereco_bll(_connection);

            if (reg.Id_logradouro > 0)
            {
                LogradouroText.Text = enderecoRepository.Retorna_Logradouro(reg.Id_logradouro);
            }
            else
            {
                LogradouroText.Text = reg.Nome_logradouro;
            }
            LogradouroText.Tag   = reg.Id_logradouro;
            ComplementoText.Text = reg.Complemento;
            EmailText.Text       = reg.Email;
            NumeroList.Text      = reg.Numero_imovel > 0 ? reg.Numero_imovel.ToString() : "";

            if (reg.Id_bairro > 0)
            {
                if (reg.Sigla_uf == "SP" && reg.Id_cidade == 413)
                {
                    //GTI_Models.Models.Bairro _bairro = enderecoRepository.RetornaLogradouroBairro(reg.Id_logradouro, (short)reg.Numero_imovel);
                    //BairroText.Text = _bairro.Descbairro;
                    //BairroText.Tag = _bairro.Codbairro.ToString();
                }
                else
                {
                    BairroText.Text = enderecoRepository.Retorna_Bairro(reg.Sigla_uf, reg.Id_cidade, reg.Id_bairro);
                    BairroText.Tag  = reg.Id_bairro.ToString();
                }
                BairroList.SelectedValue = reg.Id_bairro;
            }

            if (reg.Cep > 0)
            {
                CepMask.Text = reg.Cep.ToString();
            }
            else
            {
                CarregaCep();
            }

            TelefoneText.Text = reg.Telefone ?? "";
            if (reg.TemFone == null)
            {
                TemFoneCheck.CheckState = CheckState.Unchecked;
            }
            else
            {
                if (reg.TemFone == true)
                {
                    TemFoneCheck.CheckState = CheckState.Checked;
                }
            }
            if (reg.WhatsApp == null)
            {
                WhatsAppCheck.CheckState = CheckState.Unchecked;
            }
            else
            {
                if (reg.WhatsApp == true)
                {
                    WhatsAppCheck.CheckState = CheckState.Checked;
                }
            }
            BairroList.Focus();
        }