Beispiel #1
0
        private void FrmListaAlunos_Load(object sender, EventArgs e)
        {
            // Preencher lista ao carregar a tela (LOAD)
            AlunosController alunosController = new AlunosController();

            dgvAlunos.DataSource = alunosController.ListarTodos();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var alunos = new AlunosController();

            var resp = int.MinValue;

            while (resp != 0)
            {
                switch (resp)
                {
                case 1:
                    Console.WriteLine("Informe o nome da criatura para adicionar na lista!");
                    alunos.AddAluno(new Aluno()
                    {
                        Nome = Console.ReadLine().ToString()
                    });
                    break;

                default:
                    break;
                }

                Console.WriteLine("Deseja adicionar mais um ?");
                Console.WriteLine("Digite 1 para sim e 0 para não!");
                resp = int.Parse(Console.ReadLine());
            }

            alunos.GetAlunos().ToList <Aluno>().ForEach(x => Console.WriteLine(x.Nome));
            Console.WriteLine("Digite algo para sair..");
            Console.ReadKey();
        }
Beispiel #3
0
        private void frmListaAlunos_Load(object sender, EventArgs e)
        {
            // preencher a lista ao carregar a tela (LOAD)
            AlunosController alunosController = new AlunosController();

            dgvAlunos.DataSource         = alunosController.ListarTodos();
            dgvAlunos.Columns[0].Visible = false;
        }
Beispiel #4
0
        private void CarregaLista(Aluno a)
        {
            AlunosController alunosController = new AlunosController();
            Aluno            aluno            = new Aluno();

            listAluno.ItemsSource = new List <Aluno>();
            listAluno.ItemsSource = alunosController.BuscarPorNome(txtConsulta.Text);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            ProfessoresController professorController = new ProfessoresController();

            // Cadastrando professores
            Professor p = CadastrarProfessor();

            professorController.Inserir(p);


            DisciplinasController disciplinaController = new DisciplinasController();

            //Cadastro disciplinas

            Disciplina d = CadastrarDisciplina();

            disciplinaController.Inserir(d);


            AlunosController alunosController = new AlunosController();

            // Cadastrando alunos
            Aluno a = CadastrarAluno();

            alunosController.Inserir(a);

            Aluno b = CadastrarAluno();

            alunosController.Inserir(b);

            Aluno c = CadastrarAluno();

            alunosController.Inserir(c);

            Console.Clear();

            foreach (Professor professor in professorController.ListarTodos())
            {
                ImprimirDadosProfessor(professor);
            }

            foreach (Disciplina disciplina in disciplinaController.ListarTodos())
            {
                ImprimirDadosDisciplina(disciplina);
            }

            foreach (Aluno aluno in alunosController.ListarTodos())
            {
                ImprimirDadosAluno(aluno);
            }



            // ImprimirDadosAluno(a);

            Console.ReadKey();
        }
Beispiel #6
0
        public void CreateAluno_ShouldReturnSameAluno()
        {
            var controller = new AlunosController(new TestUniversityContext());

            var item = GetDemoAluno();

            var result = controller.Create(item);

            Assert.IsNotNull(result);
        }
Beispiel #7
0
        public void EditAluno_ShouldReturnStatusCode()
        {
            var controller = new AlunosController(new TestUniversityContext());

            var item = GetDemoAluno();

            var result = controller.Edit(item.ID);

            Assert.IsNotNull(result);
        }
Beispiel #8
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);
        }
Beispiel #9
0
        public void GetAluno_ShouldReturnAlunoWithSameID()
        {
            var context = new TestUniversityContext();

            context.Alunos.Add(GetDemoAluno());

            var controller = new AlunosController(context);
            var result     = controller.Edit(3) as ViewResult;

            Assert.IsNotNull(result);
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Aluno novoAluno = new Aluno();

            novoAluno.Nome      = txtNome.Text;
            novoAluno.Matricula = int.Parse(txtMatricula.Text);

            AlunosController alunosController = new AlunosController();

            alunosController.Inserir(novoAluno);
        }
Beispiel #11
0
        public void DeleteAluno_ShouldReturnOK()
        {
            var context = new TestUniversityContext();
            var item    = GetDemoAluno();

            context.Alunos.Add(item);

            var controller = new AlunosController(context);
            var result     = controller.Delete(3);

            Assert.IsNotNull(result);
        }
Beispiel #12
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            int matricula = int.Parse(txtMatriculaAluno.Text);

            AlunosController alunosController = new AlunosController();

            alunosController.Excluir(matricula);

            frmAvisoExcluir excluirAluno = new frmAvisoExcluir();

            excluirAluno.ShowDialog();
        }
        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");
            }
        }
        private void btnDeletar_Click(object sender, EventArgs e)
        {
            Aluno del = new Aluno
            {
                AlunoID = int.Parse(txtDeletar.Text)
            };

            AlunosController alunosController = new AlunosController();

            alunosController.Excluir(del.AlunoID);
            txtDeletar.Clear();

            MessageBox.Show("o Id:" + del.AlunoID);
        }
Beispiel #15
0
        private void  listAluno_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AlunosController alunosController = new AlunosController();

            try
            {
                Aluno a = (Aluno)listAluno.SelectedItem;
                Preenche(a);
            }
            catch
            {
                MessageBox.Show("Sem alunos para seleção");
            }
            //MessageBox.Show("o q tem no a" + a.AlunoID);
        }
Beispiel #16
0
        private void btnProcuraMatricula_Click(object sender, EventArgs e)
        {   //Verificar
            Aluno matricula = new Aluno();

            matricula.Matricula = int.Parse(txtMatricula.Text);

            AlunosController alunosController = new AlunosController();

            matricula = alunosController.BuscarMatriculaAluno(matricula.Matricula);

            txtNomeAtt.Text      = matricula.Nome;
            txtMatriculaAtt.Text = matricula.Matricula.ToString();

            //Verificar
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Aluno novoAluno = new Aluno();

            novoAluno.Nome      = txtNome.Text;
            novoAluno.Matricula = int.Parse(txtMatricula.Text);


            AlunosController alunosController = new AlunosController();

            alunosController.Inserir(novoAluno);

            frmAvisoCadastrarAluno avisoCadAluno = new frmAvisoCadastrarAluno();

            avisoCadAluno.ShowDialog();
        }
Beispiel #18
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Aluno novoAluno = new Aluno();

            novoAluno.Nome      = txtNome.Text;
            novoAluno.Matricula = int.Parse(txtMatricula.Text);

            AlunosController alunosController = new AlunosController();

            alunosController.Inserir(novoAluno);

            txtNome.Text      = string.Empty;
            txtMatricula.Text = string.Empty;

            MessageBox.Show("Aluno Cadastrado com sucesso");
        }
Beispiel #19
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();
            }
        }
Beispiel #20
0
        private void btnDeletar_Click(object sender, EventArgs e)
        {
            Aluno delete = new Aluno
            {
                AlunoID = int.Parse(txtDeletar.Text)
            };


            AlunosController alunosController = new AlunosController();

            alunosController.Excluir(delete.AlunoID);
            MessageBox.Show("O Aluno de ID: " + delete.AlunoID + " Foi deletado!");
            Close();
            frmDeletarAluno dd = new frmDeletarAluno();

            dd.Show();
        }
Beispiel #21
0
        private void btnEditar_Click(object sender, RoutedEventArgs e)
        {
            AlunosController alunosController = new AlunosController();
            Aluno            aluno            = new Aluno();

            aluno.AlunoID    = Convert.ToInt32(txtId.Text);
            aluno.Matricula  = Convert.ToInt32(txtMatricula.Text);
            aluno.Nome       = txtNome.Text;
            aluno.Endereco   = txtEndereco.Text;
            aluno.DataInicio = dtCalendario.SelectedDate.Value;
            alunosController.Editar(aluno);
            MessageBox.Show("Editado com Sucesso");
            btnGravar.Visibility = Visibility.Visible;
            txtId.Text           = "";
            txtNome.Text         = "";
            txtEndereco.Text     = "";
            txtMatricula.Text    = "";
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            AlunosController alunosController = new AlunosController();

            //Cadastrando alunos
            Aluno a = CadastrarAluno();

            alunosController.Inserir(a);

            Aluno b = CadastrarAluno();

            alunosController.Inserir(b);

            Aluno c = CadastrarAluno();

            alunosController.Inserir(c);

            foreach (Aluno aluno in alunosController.ListarTodos())
            {
                ImprimirDadosAluno(aluno);
            }

            ProfessoresController professoresController = new ProfessoresController();

            //Cadastrando professores
            Professor d = CadastrarProfessor();

            professoresController.Inserir(d);

            Professor e = CadastrarProfessor();

            professoresController.Inserir(e);

            Professor f = CadastrarProfessor();

            professoresController.Inserir(f);

            foreach (Professor professor in professoresController.ListarTodos())
            {
                ImprimirDadosProfessor(professor);
            }

            Console.ReadKey();
        }
Beispiel #23
0
        private void btnGravar_Click(object sender, RoutedEventArgs e)
        {
            AlunosController alunosController = new AlunosController();
            Aluno            aluno            = new Aluno();


            //ServicoController servico = new ServicoController();
            // Servico ser = new Servico();

            if (aluno is null)
            {
                MessageBox.Show("Não foi possivel efetuar o cadastro");
            }
            try
            {
                aluno.Matricula = Convert.ToInt32(txtMatricula.Text);
                aluno.Nome      = txtNome.Text;
                aluno.Endereco  = txtEndereco.Text;
                aluno.IDServico = ((Servico)cbServico.SelectedItem).ServicoID;

                txtIDServico.Text = aluno.IDServico.ToString();
                try
                {
                    aluno.DataInicio = dtCalendario.SelectedDate.Value;
                    alunosController.Adicionar(aluno);
                    MessageBox.Show("Cadastro efetuado com sucesso");
                    ListaAluno(alunosController);
                }
                catch
                {
                    MessageBox.Show("Preencha a data");
                }
            }
            catch
            {
                MessageBox.Show("Revise os dados para cadastro");
            }
            // var serv = cbServico.SelectedIndex.;
            //ser.ServicoID = serv.;

            //aluno._Servico.Insert(serv, ser);
            //aluno._Servico.Add(ser);
        }
Beispiel #24
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();
            }
        }
Beispiel #25
0
        private void btnBuscarServ_Click(object sender, RoutedEventArgs e)
        {
            AlunosController alunosController = new AlunosController();
            Aluno            aluno            = new Aluno();

            if (aluno is null)
            {
                MessageBox.Show("Aluno não encontrado");
            }

            try
            {
                listAluno.ItemsSource = new List <Aluno>();
                listAluno.ItemsSource = alunosController.BuscarPorNome(txtConsulta.Text);
            }
            catch
            {
                MessageBox.Show("Aluno não encontrado");
            }
        }
        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");
            }
        }
        private void btnSalvarAluno_Click(object sender, EventArgs e)
        {
            Aluno novoaluno = new Aluno();

            if (txtNomeAluno.Text != "" && txtMatricula.Text != "")
            {
                novoaluno.Nome       = txtNomeAluno.Text;
                novoaluno.Matricula  = int.Parse(txtMatricula.Text);
                novoaluno.EmailAluno = txtEmailAluno.Text;
                novoaluno.AnoAluno   = cmbAnoAluno.Text;
                novoaluno.FoneAluno  = txtFoneAluno.Text;

                AlunosController alunosController = new AlunosController();
                alunosController.Inserir(novoaluno);

                this.LimparCampos();
                MessageBox.Show("Aluno Cadastrado com sucesso!", "AVISO");
            }
            else
            {
                MessageBox.Show("Obrigatório digitar um nome e uma matrícula", "AVISO");
            }
        }
        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);
            }
        }
Beispiel #29
0
        static void Main(string[] args)
        {
            AlunosController alunosController = new AlunosController();

            // Cadastrando alunos
            Aluno a = CadastrarAluno();

            alunosController.Inserir(a);

            Aluno b = CadastrarAluno();

            alunosController.Inserir(b);

            Aluno c = CadastrarAluno();

            alunosController.Inserir(c);

            foreach (Aluno aluno in alunosController.ListarTodos())
            {
                ImprimirDadosAluno(aluno);
            }

            Console.ReadKey();
        }
Beispiel #30
0
        private void frmListaAlunos_Load(object sender, EventArgs e)
        {
            AlunosController alunosController = new AlunosController();

            dvgAlunos.DataSource = alunosController.ListarTodos();
        }