private void button1_Click(object sender, EventArgs e) { try { Professor professor = new Professor(); professor.NomeProf = tbnome.Text; professor.RgProf = tbrg.Text; professor.CpfProf = tbcpf.Text; professor.DataNascProf = tbdma.Text; professor.LogradouroProf = tbendereco.Text; professor.ComplementoProf = tbnumero.Text; professor.UfProf = tbuf.Text; professor.BairroProf = tbbairro.Text; professor.CidadeProf = tbcidade.Text; professor.LoginProf = tblogin.Text; professor.SenhaProf = tbsenha.Text; professor.SalarioProf = tbsalario.Text; professor.ComplementoProf = tbcomplemetno.Text; professor.IdProf = listaF.ElementAt(comboidprof.SelectedIndex).IdProf; professor.IdProfnova = Convert.ToInt32(tbidnova.Text); professor.NumeroProf = Convert.ToInt32(tbnumero.Text); fachada.atualizarProfessor(professor); RepositorioProfessor r = new RepositorioProfessor(); if (r.verificausuario == false) { MessageBox.Show("Professor Atualizado com Sucesso"); } } catch (Exception ex) { MessageBox.Show("Professor nao Atualizado" + ex); } }
public AtualizarDisciplina() { InitializeComponent(); #region ListaID's Professor try { RepositorioProfessor r = new RepositorioProfessor(); listaF = r.listaprofessor(); comboidprof.Items.Clear(); for (int i = 0; i < listaF.Count; i++) { comboidprof.Items.Add(listaF.ElementAt(i).NomeProf); } RespositorioDisciplina s = new RespositorioDisciplina(); listaD = s.listaDisciplina(); comboiddisciplina.Items.Clear(); for (int i = 0; i < listaD.Count; i++) { comboiddisciplina.Items.Add(listaD.ElementAt(i).NomeDisc); } } catch (Exception ex) { MessageBox.Show("Erro no Lista Id's do Professor e Disciplina" + ex + ""); } #endregion }
private void button1_Click(object sender, EventArgs e) { try { Professor professor = new Professor(); professor.IdProf = listaF.ElementAt(comboidprof.SelectedIndex).IdProf; fachada.removerProfessor(professor); RepositorioProfessor r = new RepositorioProfessor(); if (r.verificausuario == true) { MessageBox.Show("Professor Removido com Sucesso"); } } catch (Exception ex) { MessageBox.Show("Professor nao removido" + ex); } }
public RemoverProfessor() { InitializeComponent(); #region ListaID's Professor try { RepositorioProfessor r = new RepositorioProfessor(); listaF = r.listaprofessor(); comboidprof.Items.Clear(); for (int i = 0; i < listaF.Count; i++) { comboidprof.Items.Add(listaF.ElementAt(i).NomeProf); } } catch (Exception ex) { MessageBox.Show("Erro no Lista Id's do Professor" + ex + ""); } #endregion }