private void toolStripButton7_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedTab = tabPage1;
            SCOOPDataSet.EmpreteiraDataTable Dt = new EmpreteiraTableAdapter().GetDataBy2(Convert.ToInt32(dataGridView1.Rows[Convert.ToInt32(toolStripTextBox1.TextBox.Text) - 1].Cells[0].Value.ToString()));

            if (Dt.Count > 0)
            {
                foreach (SCOOPDataSet.EmpreteiraRow linha in Dt)
                {
                    TxtBoxCodigo.Text = linha.Codigo.ToString();
                    if (String.Empty != linha.CPF.Replace(".", "").Replace("-", "").Trim())
                    {
                        MskTxtBoxCPF.Text       = linha.CPF.ToString();
                        MskTxtBoxRG.Text        = linha.RG;
                        TxtBoxNome.Text         = linha.Nome;
                        comboBoxTipoPessoa.Text = "Pessoa Fisica";
                    }
                    else
                    {
                        MskTxtBoxCNPJ.Text           = linha.CNPJ;
                        TxtBoxInscricaoEstadual.Text = linha.InscricaoEstadual;
                        TxtBoxRazaoSocial.Text       = linha.Nome;
                        comboBoxTipoPessoa.Text      = "Pessoa Juridica";
                    }
                    comboBoxTipoPessoa_SelectedIndexChanged(null, null);
                    TxtBoxLogradouro.Text         = linha.Logradouro;
                    TxtBoxNumero.Text             = linha.Numero;
                    TxtBoxBairro.Text             = linha.Bairro;
                    TxtBoxCidade.Text             = linha.Cidade;
                    ComboBoxEstado.Text           = linha.Estado;
                    mskTxtBoxCEP.Text             = linha.CEP;
                    mskTxtBoxTelefone.Text        = linha.Telefone;
                    mskTxtBoxCelular.Text         = linha.Celular;
                    mskTxtBoxFAX.Text             = linha.FAX;
                    TxtBoxResponsavel.Text        = linha.Responsavel;
                    mskTxtBoxCPFResponsavel.Text  = linha.CPFResponsavel;
                    TxtBoxResponsavelTecnico.Text = linha.ResponsavelTecnico;
                    TxtBoxCREA.Text              = linha.CREA;
                    TxtBoxObservacao.Text        = linha.Observacao;
                    mskTxtBoxDataRecFederal.Text = linha.DataReceitaFederal.ToShortDateString();
                    mskTxtBoxCND.Text            = linha.DataCND.ToShortDateString();
                    mskTxtBoxDataFGTS.Text       = linha.DataFGTS.ToShortDateString();
                    BttAtulizar.Visible          = true;
                    BttCadastro.Visible          = false;
                }
            }
        }
Beispiel #2
0
        private void ComboBoxEmpreteira_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                SCOOPDataSet.EmpreteiraDataTable Dt = new EmpreteiraTableAdapter().GetDataBy2((int)ComboBoxEmpreteira.SelectedValue);

                foreach (SCOOPDataSet.EmpreteiraRow linha in Dt)
                {
                    if (string.Empty != LimprarMaskedTexto(linha.CNPJ.Trim()) || LimprarMaskedTexto(linha.CNPJ.Trim()) != "")
                    {
                        TxtBoxCGCCPF.Text    = linha.CNPJ;
                        TxtBoxCGCCPF.Visible = true;
                    }
                    else
                    {
                        TxtBoxCGCCPF.Text = linha.CPF;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao Obter Empresa.\n" + ex.Message);
            }
        }