Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
        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;
            }
        }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
        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;
            }
        }
Ejemplo n.º 12
0
        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;
            }
        }
Ejemplo n.º 13
0
        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;
            }
        }
Ejemplo n.º 14
0
        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);
            }
        }
Ejemplo n.º 15
0
        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);
            }
        }
Ejemplo n.º 16
0
        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);
            }
        }
Ejemplo n.º 17
0
        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);
            }
        }