コード例 #1
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;
            }
        }
コード例 #2
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");
            }
        }
コード例 #3
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();
            }
        }