public static Professor Primeiro() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Professor pf = new Professor(); pf = db.Professors.First(); posicao = 0; return(pf); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static Avaliador Primeiro() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Avaliador av = new Avaliador(); av = db.Avaliadors.First(); posicao = 0; return(av); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static Avaliador Ultimo() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Avaliador av = new Avaliador(); List <Avaliador> listProf = db.Avaliadors.ToList(); posicao = listProf.Count() - 1; av = listProf.ElementAt(posicao); return(av); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static Professor Ultimo() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Professor pf = new Professor(); List <Professor> listProf = db.Professors.ToList(); posicao = listProf.Count() - 1; pf = listProf.ElementAt(posicao); return(pf); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Inserir(Avaliador av) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Guid guid = Guid.NewGuid(); av.IdAvaliador = guid; db.Avaliadors.Add(av); db.SaveChanges(); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Inserir(Professor pf) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Guid guid = Guid.NewGuid(); pf.IdProfessor = guid; db.Professors.Add(pf); db.SaveChanges(); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Valida(String strLogin, String strSenha) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Administracao pa = new Administracao(); pa = db.Administracaos.Where(m => m.login == strLogin).FirstOrDefault(); if (pa.senha == strSenha) { return(true); } return(false); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool SetSituacao(Avaliador a, byte status) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Avaliador av = new Avaliador(); av = db.Avaliadors.Find(a.IdAvaliador); av.situacao = status; db.SaveChanges(); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Inserir(Aluno a) { try { s2aeiDBEntities db = new s2aeiDBEntities(); a.situacao = 1; //quando aluno é cadastrado, o status deve se tornar imediatamente ativo. db.Alunoes.Add(a); db.SaveChanges(); return(true); } catch (Exception) { throw; } }
public static bool SetSituacao(Professor p, byte status) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Professor pf = new Professor(); pf = db.Professors.Find(p.IdProfessor); pf.situacao = status; db.SaveChanges(); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Desativar(Aluno a) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Aluno al = new Aluno(); al = db.Alunoes.Find(a.emaila); al.situacao = 0; db.SaveChanges(); return(true); } catch (Exception) { throw; } }
public static bool AlterarSenha(Aluno a) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Aluno al = new Aluno(); al = db.Alunoes.Find(a.emaila); al.senha = a.senha; db.SaveChanges(); return(true); } catch (Exception) { throw; } }
public static bool Alterar(Aluno a) { try { s2aeiDBEntities db = new s2aeiDBEntities(); Aluno al = new Aluno(); al = db.Alunoes.Find(a.emaila); al.Nome = a.Nome; al.periodo = a.periodo; al.campus = a.campus; al.curso = a.curso; db.SaveChanges(); return(true); } catch (Exception) { throw; } }
public static Avaliador Anterior() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Avaliador av = new Avaliador(); List <Avaliador> listProf = db.Avaliadors.ToList(); if (posicao > 0) { posicao--; av = listProf.ElementAt(posicao); } else { av = listProf.ElementAt(0); } return(av); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static Professor Proximo() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Professor pf = new Professor(); List <Professor> listProf = db.Professors.ToList(); if (posicao >= 0 && posicao < (listProf.Count() - 1)) { posicao++; pf = listProf.ElementAt(posicao); } else { pf = listProf.ElementAt(listProf.Count() - 1); } return(pf); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static Professor Anterior() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Professor pf = new Professor(); List <Professor> listProf = db.Professors.ToList(); if (posicao > 0) { posicao--; pf = listProf.ElementAt(posicao); } else { pf = listProf.ElementAt(0); } return(pf); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static Avaliador Proximo() { try { s2aeiDBEntities db = new s2aeiDBEntities(); Avaliador av = new Avaliador(); List <Avaliador> listProf = db.Avaliadors.ToList(); if (posicao >= 0 && posicao < (listProf.Count() - 1)) { posicao++; av = listProf.ElementAt(posicao); } else { av = listProf.ElementAt(listProf.Count() - 1); } return(av); } catch (Exception ex) { throw new Exception(ex.Message); } }