private void btnRemoverBuscar_Click(object sender, EventArgs e)
        {
            if (this.controle.procurar(long.Parse(tbMatricula.Text)) == null)
            {
                avisoJanela("404", "O Aluno não existe!");
                btnRemover.Visible = false;

                tbNome.Text      = "";
                tbProfessor.Text = "";
                cbSerie.Items.Clear();
                cbTurma.Items.Clear();
                tbNota1.Text = "";
                tbNota2.Text = "";
                tbNota3.Text = "";
                tbNota4.Text = "";
            }
            else
            {
                Aluno aluno = this.controle.procurar(long.Parse(tbMatricula.Text));
                tbNome.Text      = aluno.getNome();
                tbProfessor.Text = aluno.getProfessor();
                cbSerie.Items.Insert(0, aluno.getSerie());
                cbSerie.Text = "" + aluno.getSerie();
                cbTurma.Items.Insert(0, aluno.getTurma());
                cbTurma.Text = "" + aluno.getTurma();
                tbNota1.Text = "" + aluno.getNota1();
                tbNota2.Text = "" + aluno.getNota2();
                tbNota3.Text = "" + aluno.getNota3();
                tbNota4.Text = "" + aluno.getNota4();

                btnRemover.Visible = true;
            }
        }
Esempio n. 2
0
        private void btnProcurar_Click(object sender, EventArgs e)
        {
            Validacao valida = new Validacao();

            if (!valida.campoVazio(tbProcurar.Text) && valida.validaNumero(tbProcurar.Text) && tbProcurar.TextLength == 9)
            {
                if (this.controle.procurar(long.Parse(tbProcurar.Text)) == null)
                {
                    avisoJanela("404", "Aluno não encontrado!");
                }
                else
                {
                    Aluno aluno = this.controle.procurar(long.Parse(tbProcurar.Text));
                    tbMain.Text = (
                        "\r\nNome:  " + aluno.getNome() +
                        "\r\nMatricula:  " + aluno.getMatricula() +
                        "\r\nSerie:  " + aluno.getSerie() +
                        "\r\nTurma:  " + aluno.getTurma() +
                        "\r\nProfessor:  " + aluno.getProfessor() +
                        "\r\nNota 1:  " + aluno.getNota1() +
                        "\r\nNota 2:  " + aluno.getNota2() +
                        "\r\nNota 3:  " + aluno.getNota3() +
                        "\r\nNota 4:  " + aluno.getNota4() +
                        "\r\nNota Final:  " + aluno.getNotaFinal()
                        );
                }
            }
            else
            {
                avisoJanela("Matrícula", "Formato de matrícula inválida!");
            }
        }
        public void atualizar(Aluno novoAluno)                        /*metodo para atualizar as informações de um anúnio.
                                                                       * recebe um Aluno por paramtro*/
        {
            foreach (Aluno aluno in this.repositorio)                 //loop para percorrer todo o array
            {
                if (aluno.getMatricula() == novoAluno.getMatricula()) //testo se o cpf para por parametro é igual ao de algum permitido
                {
                    int notaFinal = (novoAluno.getNota1() + novoAluno.getNota2() + novoAluno.getNota3() + novoAluno.getNota4()) / 4;

                    aluno.setNome(novoAluno.getNome());
                    aluno.setSerie(novoAluno.getSerie());
                    aluno.setTurma(novoAluno.getTurma());
                    aluno.setProfessor(novoAluno.getProfessor());
                    aluno.setNota1(novoAluno.getNota1());
                    aluno.setNota2(novoAluno.getNota2());
                    aluno.setNota3(novoAluno.getNota3());
                    aluno.setNota4(novoAluno.getNota4());
                    aluno.setNotaFinal(notaFinal);
                }
            }
        }