Пример #1
0
        private void btnProcura_Click(object sender, EventArgs e)
        {
            Aluno buscar = new Aluno()
            {
                AlunoID = int.Parse(txtID.Text)
            };
            AlunosController alunosController = new AlunosController();

            alunosController.BuscarPorID(buscar.AlunoID);
        }
Пример #2
0
        private void btnExcluirAluno_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Realmente deseja Excluir?", "AVISO", MessageBoxButtons.YesNo);

            if (d.ToString() == "Yes")
            {
                Aluno            aluno            = new Aluno();
                AlunosController alunosController = new AlunosController();
                aluno = alunosController.BuscarPorID(int.Parse(txtIDAluno.Text));
                alunosController.Excluir(aluno.AlunoID);
                this.LimparCampos();
                MessageBox.Show("Aluno excluído do sistema!", "AVISO");
            }
        }
Пример #3
0
        private void btnProcuraAluno_Click(object sender, EventArgs e)
        {
            Aluno idAluno = new Aluno();

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

            AlunosController alunosController = new AlunosController();

            idAluno = alunosController.BuscarPorID(idAluno.AlunoID);

            if (idAluno == null)
            {
                MessageBox.Show("ID não cadastrado, digitado: " + int.Parse(txtAlunoid.Text) + "\nO valor não pode ser Zero (0)" + "\nNumero digitado não pode estar negativo");
            }
            else if (idAluno.AlunoID >= 1)
            {
                txtNomeAtt.Text      = idAluno.Nome;
                txtMatriculaAtt.Text = idAluno.Matricula.ToString();
            }
        }
Пример #4
0
        private void btnLocalizarAluno_Click(object sender, EventArgs e)
        {
            frmListaAlunos f = new frmListaAlunos();

            f.ShowDialog();

            if (f.ID != 0)
            {
                Aluno            aluno            = new Aluno();
                AlunosController alunosController = new AlunosController();

                aluno = alunosController.BuscarPorID(f.ID);

                txtNomeAluno.Text  = aluno.Nome;
                txtMatricula.Text  = aluno.Matricula.ToString();
                txtIDAluno.Text    = aluno.AlunoID.ToString();
                txtEmailAluno.Text = aluno.EmailAluno.ToString();
                cmbAnoAluno.Text   = aluno.AnoAluno.ToString();
                txtFoneAluno.Text  = aluno.FoneAluno.ToString();

                this.AlterarBotoes(2);
            }
        }
Пример #5
0
        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");
            }
        }