Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         byte[] foto_to_byte = null;
         string CPF          = maskedTextBox2.Text;
         maskedTextBox3.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
         if (maskedTextBox3.Text == string.Empty)
         {
             throw new Exception("Campo Data vazio!");
         }
         maskedTextBox3.TextMaskFormat = MaskFormat.IncludeLiterals;
         string data    = maskedTextBox3.Text;
         string apelido = textBox4.Text;
         string chapa   = textBox1.Text;
         Image  img     = pictureBox1.Image;
         if (img == null)
         {
             throw new Exception("Preencher imagem");
         }
         MemoryStream foto = new MemoryStream();
         img.Save(foto, img.RawFormat);
         foto_to_byte = foto.ToArray();
         string msg = CadCandidato_BLL.ValidarCandidato(CPF, data, chapa, foto_to_byte, apelido);
         MessageBox.Show(msg, "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CadCandidato.ActiveForm.Refresh();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        public CadCandidato()
        {
            InitializeComponent();
            string data = CadCandidato_BLL.RetornaData();

            maskedTextBox3.Text = data;
        }
Пример #3
0
 private void button6_Click(object sender, EventArgs e)
 {
     try
     {
         string cpf = maskedTextBox2.Text;
         obj                 = CadCandidato_BLL.ValidaCPF(cpf);
         textBox3.Text       = obj.Nome;
         textBox2.Text       = obj.Turma;
         maskedTextBox1.Text = obj.Modulo;
         button1.Enabled     = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }