private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                if ((txtNomeChapa.Text == "") ||
                    (txtNumeroChapa.Text == "") ||
                    (txtNomePresidente.Text == "") ||
                    (txtNomeVice.Text == "") ||
                    (txtDescricaoChapa.Text == "") ||
                    (txtCaminhoFoto.Text == ""))
                {
                    MessageBox.Show("Todos os campos são obrigatórios", "AVISO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtNomeChapa.Focus();
                }
                else
                {
                    Cln_inserir Inserir = new Cln_inserir();
                    Inserir.Nome_Chapa          = txtNomeChapa.Text;
                    Inserir.Numero_Chapa        = txtNumeroChapa.Text;
                    Inserir.Presidente_Chapa    = txtNomePresidente.Text;
                    Inserir.VicePresidenteChapa = txtNomeVice.Text;
                    Inserir.DescricaoChapa      = txtDescricaoChapa.Text;
                    Inserir.Caminho_Foto        = txtCaminhoFoto.Text;
                    Inserir.SalvarChapa();
                    //{ MessageBox.Show("A Chapa "+ txtNomeChapa.Text +" foi gravada."); }
                    MessageBox.Show("A Chapa " + txtNomeChapa.Text + " foi gravada.", " Item Salvo ",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //{ MessageBox.Show("A chapa foi salva."); }


                    //insere data e hora de inserção da chapa
                    try
                    {
                        Cln_inserir i = new Cln_inserir();
                        i.Nome_Chapa = txtNomeChapa.Text;
                        i.SalvarComData();
                        { MessageBox.Show("Data e hora inseridos!!"); }
                    }
                    catch (Exception error) {
                        MessageBox.Show("Erro:" + error);
                    }
                    txtNomeChapa.Clear();
                    txtNumeroChapa.Clear();
                    txtNomePresidente.Clear();
                    txtNomeVice.Clear();
                    txtDescricaoChapa.Clear();
                    txtCaminhoFoto.Clear();
                    //Close();
                }
            }catch (Exception Error)
            { Error.ToString(); }
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if ((txtNome.Text == "") ||
                (txtID_Mesario.Text == "") ||
                (txtSenha.Text == ""))
            {
                MessageBox.Show("Todos os campos são obrigatórios", " AVISO! ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtNome.Focus();
            }
            else
            {
                Cln_inserir Inserir = new Cln_inserir();
                Inserir.NomeMesario   = txtNome.Text;
                Inserir.Id_Mesario    = txtID_Mesario.Text;
                Inserir.Senha_Mesario = txtSenha.Text;
                Inserir.SalvarMesario();
                txtNome.Clear();
                txtID_Mesario.Clear();
                txtSenha.Clear();

                { MessageBox.Show("O Mesário foi salvo!",
                                  "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); }
            }
        }
Esempio n. 3
0
 private void btnSalvar_Click(object sender, EventArgs e)
 {
     if ((txtNomeAluno.Text == "") ||
         (txtRM.Text == "") ||
         (txtSenhaDoAluno.Text == ""))
     {
         MessageBox.Show("Todos os campos são obrigatórios.", " A V I S O ! ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtNomeAluno.Focus();
     }
     else
     {
         Cln_inserir Inserir = new Cln_inserir();
         Inserir.Nome_Aluno  = txtNomeAluno.Text;
         Inserir.RM          = txtRM.Text;
         Inserir.Senha_Aluno = txtSenhaDoAluno.Text;
         Inserir.SalvarAluno();
         { MessageBox.Show("O aluno foi salvo!",
                           "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); }
         txtNomeAluno.Clear();
         txtRM.Clear();
         txtSenhaDoAluno.Clear();
         //Close();
     }
 }