Exemple #1
0
 private void BtLocalizarEntidade_Click(object sender, EventArgs e)
 {
     try
     {
         var cpf_cnpj_tratado = Cpf_Cnpj.Text.Replace(".", "").Replace(",", "").Replace("-", "").Replace("/", "").Replace("_", "");
         if (ClassEntidade.RetornaEntidade(cpf_cnpj_tratado, Grupo.Text.ToUpper()))
         {
             if (!string.IsNullOrEmpty(ClassEntidade.Cod))
             {
                 PreencheCampoTela();
                 CalculaIdade();
             }
             else
             {
                 LimpaCamposTela();
             }
             Cursor = Cursors.Default;
         }
         else
         {
             Cursor = Cursors.Default;
             MessageBox.Show("Erro: " + ClassEntidade.Erro, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro: " + ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #2
0
 private void Cpf_Cnpj_Leave(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         if (string.IsNullOrEmpty(Cpf_Cnpj.Text.ToString().Replace("/", "").Replace(".", "").Replace("-", "").Replace("_", "").Replace(",", "")))
         {
             Cursor = Cursors.Default;
             MessageBox.Show("CPF / CNPJ não pode estrar em branco", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             if (ClassEstrategia.RetornaValorParametro("ACOES", "VALIDA_CPF_CNPJ"))
             {
                 if (ClassEstrategia.Parametro.Equals("1"))
                 {
                     if (!ClassEntidade.ValidaCnpjCpf(Cpf_Cnpj.Text, Cpf_Cnpj))
                     {
                         Cursor = Cursors.Default;
                         MessageBox.Show("Erro: " + ClassEntidade.Erro, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         return;
                     }
                     else
                     {
                         Cursor = Cursors.Default;
                     }
                 }
                 else
                 {
                     Cursor = Cursors.Default;
                 }
             }
             Cursor = Cursors.WaitCursor;
             if (ClassEstrategia.RetornaValorParametro("ACOES", "LOCALIZA_ENTIDADE"))
             {
                 if (ClassEstrategia.Parametro.Equals("1"))
                 {
                     var cpf_cnpj_tratado = Cpf_Cnpj.Text.Replace(".", "").Replace(",", "").Replace("-", "").Replace("/", "").Replace("_", "");
                     if (ClassEntidade.RetornaEntidade(cpf_cnpj_tratado, Grupo.Text.ToUpper()))
                     {
                         if (!string.IsNullOrEmpty(ClassEntidade.Cod))
                         {
                             PreencheCampoTela();
                             CalculaIdade();
                         }
                         else
                         {
                             LimpaCamposTela();
                         }
                         Cursor = Cursors.Default;
                     }
                     else
                     {
                         Cursor = Cursors.Default;
                         MessageBox.Show("Erro: " + ClassEntidade.Erro, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         return;
                     }
                 }
                 else
                 {
                     Cursor = Cursors.Default;
                 }
             }
             else
             {
                 Cursor = Cursors.Default;
             }
         }
     }
     catch (Exception ex)
     {
         Cursor = Cursors.Default;
         MessageBox.Show("Erro: " + ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }