private void frmListaProfessores_Load(object sender, EventArgs e) { // preencher a lista ao carregar a tela (LOAD) ProfessoresController professoresController = new ProfessoresController(); dgvProfessores.DataSource = professoresController.ListarTodos(); dgvProfessores.Columns[0].Visible = false; }
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(); }
private void BtnSalvar_Click(object sender, EventArgs e) { Professor novoProfessor = new Professor(); novoProfessor.Nome = txtNome.Text; novoProfessor.Cadastro = int.Parse(txtCadastro.Text); ProfessoresController professoresController = new ProfessoresController(); professoresController.Inserir(novoProfessor); }
private void btnProcuraProfessor_Click(object sender, EventArgs e) { Professor pp = new Professor(); pp.ProfessorID = int.Parse(txtProfessorid.Text); ProfessoresController pc = new ProfessoresController(); pp = pc.BuscarProfID(pp.ProfessorID); txtNomeAttProf.Text = pp.NomeP.ToString(); txtMatriculaAttProf.Text = pp.MatriculaP.ToString(); }
private void btnExcluirProfessor_Click(object sender, EventArgs e) { DialogResult d = MessageBox.Show("Realmente deseja Excluir?", "AVISO", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { Professor professor = new Professor(); ProfessoresController professoresController = new ProfessoresController(); professor = professoresController.BuscarPorID(int.Parse(txtIDProfessor.Text)); professoresController.Excluir(professor.ProfessorID); this.LimparCampos(); MessageBox.Show("Professor excluído do sistema!", "AVISO"); } }
private void btnDeletarProf_Click(object sender, EventArgs e) { Professor delP = new Professor { ProfessorID = int.Parse(txtDeletarProf.Text) }; ProfessoresController professoresController = new ProfessoresController(); professoresController.ExcluirP(delP.ProfessorID); txtDeletarProf.Clear(); MessageBox.Show("o Id do professor:" + delP.ProfessorID); }
private void btnSalvarProfessor_Click(object sender, EventArgs e) { Professor novoProf = new Professor(); novoProf.NomeP = txtNomeProfessor.Text; novoProf.MatriculaP = int.Parse(txtMatriculaProfessor.Text); ProfessoresController professoresController = new ProfessoresController(); professoresController.InserirProf(novoProf); txtNomeProfessor.Text = string.Empty; txtMatriculaProfessor.Text = string.Empty; MessageBox.Show("Professor Cadastrado com sucesso"); }
private void btnAtualizarProfessor_Click(object sender, EventArgs e) { Professor attProf = new Professor(); attProf.ProfessorID = int.Parse(txtProfessorid.Text); if (attProf.ProfessorID >= 1) { attProf.NomeP = txtNomeAttProf.Text; attProf.MatriculaP = int.Parse(txtMatriculaAttProf.Text); ProfessoresController pc = new ProfessoresController(); pc.AtualizarP(attProf); MessageBox.Show("Professor atualizado com sucesso"); txtProfessorid.Clear(); txtNomeAttProf.Clear(); txtMatriculaAttProf.Clear(); } }
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(); }
private void btnLocalizarProfessor_Click(object sender, EventArgs e) { frmListaProfessores f = new frmListaProfessores(); f.ShowDialog(); if (f.ID != 0) { Professor professor = new Professor(); ProfessoresController professoresController = new ProfessoresController(); professor = professoresController.BuscarPorID(f.ID); txtNomeProfessor.Text = professor.NomeProfessor; txtCPF.Text = professor.CPF.ToString(); txtIDProfessor.Text = professor.ProfessorID.ToString(); txtEmailProfessor.Text = professor.EmailProfessor.ToString(); cmbFormacao.Text = professor.Formacao.ToString(); txtFoneProfessor.Text = professor.FoneProfessor.ToString(); this.AlterarBotoes(2); } }
private void btnSalvarProfessor_Click(object sender, EventArgs e) { Professor novoprofessor = new Professor(); if (txtNomeProfessor.Text != "" && txtCPF.Text != "") { novoprofessor.NomeProfessor = txtNomeProfessor.Text; novoprofessor.CPF = txtCPF.Text; novoprofessor.EmailProfessor = txtEmailProfessor.Text; novoprofessor.Formacao = cmbFormacao.Text; novoprofessor.FoneProfessor = txtFoneProfessor.Text; ProfessoresController professorsController = new ProfessoresController(); professorsController.Inserir(novoprofessor); this.LimparCampos(); MessageBox.Show("Professor Cadastrado com sucesso!", "AVISO"); } else { MessageBox.Show("Obrigatório digitar um nome e um CPF", "AVISO"); } }
private void btnAlterarProfessor_Click(object sender, EventArgs e) { if (txtNomeProfessor.Text != "" && txtCPF.Text != "") { Professor professor = new Professor(); ProfessoresController professoresController = new ProfessoresController(); professor = professoresController.BuscarPorID(int.Parse(txtIDProfessor.Text)); professor.NomeProfessor = txtNomeProfessor.Text; professor.CPF = txtCPF.Text; professor.EmailProfessor = txtEmailProfessor.Text; professor.Formacao = cmbFormacao.Text; professor.FoneProfessor = txtFoneProfessor.Text; professoresController.Atualizar(professor); this.LimparCampos(); MessageBox.Show("Dados do Professor Alterados com sucesso", "AVISO"); } else { MessageBox.Show("Obrigatório digitar um nome e um CPF", "AVISO"); } }
static void Main(string[] args) { //Criando usuario Console.WriteLine("-----------------Aluno-----------------------"); AlunosController alunosController = new AlunosController(); Aluno a = CadastraAluno(); alunosController.Inserir(a); //Criando objeto ProfessoresController pC = new ProfessoresController(); Console.WriteLine("----------------Professor--------------"); Professor b = CadastrarProfessor(); pC.InserirProf(b); //Inserir disciplina DisciplinaController dC = new DisciplinaController(); Console.WriteLine("----------------Disciplina--------------"); Disciplina c = CadastrarDisciplina(); dC.Inserird(c); // Console.ReadKey(); int opcao; do { Console.WriteLine("Escolha uma opção"); Console.WriteLine("1 - Para listar 'Alunos'"); Console.WriteLine("2 - Para listar 'Professores'"); Console.WriteLine("3 - Para listar 'Disciplinas'"); Console.WriteLine("4 - Deletar o Aluno", a); Console.WriteLine("5 - Deletar um professor", b); Console.WriteLine("6 - Deletar uma disciplina", c); Console.WriteLine("0 - Para Finalizar"); Console.Write("Digite uma opção e tecle Enter: "); opcao = Int32.Parse(Console.ReadLine()); switch (opcao) { case 1: Console.Clear(); Console.WriteLine("Lista de Alunos"); Console.WriteLine(""); foreach (Aluno aluno in alunosController.ListarTodos()) { ImprimirDadosAluno(aluno); } Console.WriteLine("\n Aperte 'Enter' Para Voltar ao Menu!"); break; case 2: Console.Clear(); Console.WriteLine("Lista de Professores"); Console.WriteLine(""); foreach (Professor p in pC.ListarTodosProfessor()) { ImprimirDadoProfessor(p); } Console.WriteLine("\n Aperte 'Enter' Para Voltar ao Menu!"); break; case 3: Console.Clear(); Console.WriteLine("Lista de Disciplina"); Console.WriteLine(""); foreach (Disciplina disciplina in dC.ListarDisciplinas()) { ImprimirDisciplinas(disciplina); } Console.WriteLine("\nAperte 'Enter' Para Voltar ao Menu!"); break; case 4: alunosController.Delete(a); Console.WriteLine("Aluno excluido com sucesso tecle Enter para voltar ao menu"); break; case 5: pC.Delete(b); Console.WriteLine("Professor excluido com sucesso tecle Enter para voltar ao menu"); break; case 6: dC.Delete(c); Console.WriteLine("Disciplina excluido com sucesso tecle Enter para voltar ao menu"); break; } Console.ReadKey(); Console.Clear(); } while (opcao != 0); }
static void Main(string[] args) { //-------- Cadastrar Aluno ---------- AlunosController alunosController = new AlunosController(); Aluno a = CadastrarAluno(); alunosController.Inserir(a); Aluno b = CadastrarAluno(); alunosController.Inserir(b); Aluno c = CadastrarAluno(); alunosController.Inserir(c); //---------- Cadastrar Prof -------------- ProfessoresController profController = new ProfessoresController(); Professor p = CadastrarProf(); profController.Inserir(p); Professor m = CadastrarProf(); profController.Inserir(m); Professor n = CadastrarProf(); profController.Inserir(n); //------------ Cadastrar Disciplina --------------- DisciplinasController disciplinaController = new DisciplinasController(); Disciplina d = CadastrarDisciplina(); disciplinaController.Inserir(d); Disciplina e = CadastrarDisciplina(); disciplinaController.Inserir(e); Disciplina f = CadastrarDisciplina(); disciplinaController.Inserir(f); Console.WriteLine("------------- DADOS ALUNO --------------"); foreach (Aluno aluno in alunosController.ListarTodos()) { ImprimirDadosAluno(aluno); } Console.WriteLine("------------- DADOS PROFESSOR --------------"); foreach (Professor professor in profController.ListarTodos()) { ImprimirDadosProf(professor); } Console.WriteLine("------------- DADOS DISCIPLINA --------------"); foreach (Disciplina disciplina in disciplinaController.ListarTodos()) { ImprimirDadosDisciplina(disciplina); } Console.ReadKey(); }
private void btnAcharProfessor_Click(object sender, EventArgs e) { ProfessoresController professorController = new ProfessoresController(); dgvProfessores.DataSource = professorController.BuscarPorNomeProfessor(txtAcharProfessor.Text); }
static void Main(string[] args) { //------------------------------Alunos------------------------------------- AlunosController alunosController = new AlunosController(); Aluno a = CadastrarAluno(); alunosController.Inserir(a); Aluno b = CadastrarAluno(); alunosController.Inserir(b); Aluno c = CadastrarAluno(); alunosController.Inserir(c); foreach (Aluno aluno in alunosController.ListarTodos()) { Console.WriteLine(""); ImprimeDadosAluno(aluno); } //-----------------------------Professores--------------------------------- ProfessoresController professoresController = new ProfessoresController(); Professor x = CadastrarProfessor(); professoresController.Inserir(x); Professor y = CadastrarProfessor(); professoresController.Inserir(y); Professor z = CadastrarProfessor(); professoresController.Inserir(z); foreach (Professor professor in professoresController.ListarTodos()) { Console.WriteLine(""); ImprimeDadosProfessor(professor); } //------------------------------Disciplinas------------------------------------- DisciplinasController disciplinasController = new DisciplinasController(); Disciplina d = CadastrarDisciplina(); disciplinasController.Inserir(d); Disciplina e = CadastrarDisciplina(); disciplinasController.Inserir(e); Disciplina f = CadastrarDisciplina(); disciplinasController.Inserir(f); foreach (Disciplina disciplina in disciplinasController.ListarTodos()) { Console.WriteLine(""); ImprimeDadosDisciplina(disciplina); } Console.ReadKey(); }
private void frmListaProfessor_Load(object sender, EventArgs e) { ProfessoresController professoresController = new ProfessoresController(); dgvProfessores.DataSource = professoresController.ListarTodosProfessor(); }