Beispiel #1
0
 private void txtIdPessoa_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (txtIdPessoa.Text != "")
     {
         try
         {
             int        id  = Uteis.stringToInt(txtIdPessoa.Text.Trim());
             PessoaBean pes = PessoaDAO.getRecord(id);
             if (pes.idPessoa == 0)
             {
                 throw new Exception("Pessoa não encontrada.");
             }
             txtNomePessoa.Text = pes.ToString();
             bean.pessoa        = pes;
             txtSenha1.Select();
         }
         catch (Exception ex)
         {
             MessageBox.Show("ID de Pessoa inválido. (" + ex.Message + ")");
             txtIdPessoa.Select();
             txtNomePessoa.Text = "";
         }
     }
     else
     {
         txtNomePessoa.Text = "";
     }
 }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            FindPessoa f = new FindPessoa();

            f.ShowDialog();
            if (f.isSelected)
            {
                PessoaBean p = f.getSelectedPessoa();
                if (p != null)
                {
                    bean.pessoa        = p;
                    txtIdPessoa.Text   = p.idPessoa.ToString();
                    txtNomePessoa.Text = p.ToString();
                }
            }
        }