Example #1
0
        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            Aluno attAluno = new Aluno();

            attAluno.AlunoID = int.Parse(txtAlunoid.Text);

            if (attAluno.AlunoID >= 1)
            {
                attAluno.Nome      = txtNomeAtt.Text;
                attAluno.Matricula = int.Parse(txtMatriculaAtt.Text);

                AlunosController alunosController = new AlunosController();
                alunosController.Atualizar(attAluno);
                MessageBox.Show("Aluno atualizado com sucesso");
                txtAlunoid.Clear(); txtNomeAtt.Clear(); txtMatriculaAtt.Clear();
            }
        }
        private void btnAlterarAluno_Click(object sender, EventArgs e)
        {
            if (txtNomeAluno.Text != "" && txtMatricula.Text != "")
            {
                Aluno            aluno            = new Aluno();
                AlunosController alunosController = new AlunosController();
                aluno = alunosController.BuscarPorID(int.Parse(txtIDAluno.Text));

                aluno.Nome       = txtNomeAluno.Text;
                aluno.Matricula  = int.Parse(txtMatricula.Text);
                aluno.EmailAluno = txtEmailAluno.Text;
                aluno.AnoAluno   = cmbAnoAluno.Text;
                aluno.FoneAluno  = txtFoneAluno.Text;

                alunosController.Atualizar(aluno);
                this.LimparCampos();
                MessageBox.Show("Dados do Aluno Alterados com sucesso", "AVISO");
            }
            else
            {
                MessageBox.Show("Obrigatório digitar um nome e uma matrícula", "AVISO");
            }
        }