Example #1
0
        public IEnumerable <R_RegistroNotas> GetGrades(string userName, int year, string period)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                this.db = new SGA_DesarrolloEntities();
                db.Configuration.ProxyCreationEnabled = false;

                var grades = (from g in db.R_RegistroNotas.Include(g => g.R_Cursos)
                              join s in db.R_Estudiantes
                              on g.Estudiante equals s.IdPersona
                              where s.usuario == userName &&
                              g.A_Adem == year &&
                              g.Trimestre == period
                              select g);

                return(grades);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }
Example #2
0
 public IEnumerable <VR_Rendimiento_A_Academ> GetYearsByUser(string userName)
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         var years = (from y in db.VR_Rendimiento_A_Academ
                      join e in db.R_Estudiantes
                      on y.Estudiante equals e.IdPersona
                      join p in db.P_Personas
                      on e.IdPersona equals p.IdPersona
                      orderby y.A_Adem
                      where p.login_red == userName
                      select y
                      );
         return(years);
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
Example #3
0
 public IEnumerable <VR_Rendimiento_Periodos> GetPeriodsByYearAndUser(string userName, int year)
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         var periods = (from p in db.VR_Rendimiento_Periodos
                        join e in db.R_Estudiantes
                        on p.Estudiante equals e.IdPersona
                        join pe in db.P_Personas
                        on e.IdPersona equals pe.IdPersona
                        where pe.login_red == userName &&
                        p.A_Adem == year
                        select p
                        );
         return(periods);
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
Example #4
0
 public IEnumerable <P_Notas> GetOldUserMessages(string userName, int last)
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         IEnumerable <P_Notas>  messages;
         SGA_DesarrolloEntities context = new SGA_DesarrolloEntities();
         context.Configuration.ProxyCreationEnabled = false;
         messages = (from n in context.P_Notas
                     join p in context.P_Personas
                     on n.IdPersona equals p.IdPersona
                     where p.login_red == userName && n.idNota <= last
                     select n).Take(50);
         return(messages);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
Example #5
0
        private bool ValidateUser(LogOnModel model)
        {
            bool valid = false;

            using (SGA_DesarrolloEntities context = new SGA_DesarrolloEntities())
            {
                valid = context.P_Personas.Count(p => p.login_red == model.UserName) > 0;
                if (valid)
                {
                    DirectoryEntry entry = new DirectoryEntry("LDAP://" + ConfigurationManager.AppSettings["Domain"].ToString(), model.UserName, model.Password);
                    //TODO: uncomment this line in server.
                    object nativeObject = entry.NativeObject;
                }
            }
            return(valid);
        }
Example #6
0
 public IEnumerable <VR_Rendimiento_A_Academ> GetVR_Rendimiento_A_Academ()
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         return(db.VR_Rendimiento_A_Academ.AsEnumerable());
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
Example #7
0
 public IEnumerable <R_RegistroNotas> GetR_RegistroNotas()
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         var r_registronotas = db.R_RegistroNotas.Include(r => r.R_Estudiantes);
         return(r_registronotas.AsEnumerable());
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
Example #8
0
        public R_RegistroNotas GetR_RegistroNotas(int id)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                this.db = new SGA_DesarrolloEntities();
                R_RegistroNotas r_registronotas = db.R_RegistroNotas.Find(id);
                if (r_registronotas == null)
                {
                    throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(r_registronotas);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }
Example #9
0
        public IEnumerable <P_NotasPublicas> GetOldPublicMessages(int last)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                SGA_DesarrolloEntities context = new SGA_DesarrolloEntities();
                context.Configuration.ProxyCreationEnabled = false;
                IEnumerable <P_NotasPublicas> notas;

                notas = (from pm in context.P_NotasPublicas
                         where pm.Activa == true && pm.idNotasPublicas <= last
                         select pm).Take(50);;
                return(notas);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }
Example #10
0
        public VR_Rendimiento_A_Academ GetVR_Rendimiento_A_Academ(int id)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                this.db = new SGA_DesarrolloEntities();
                VR_Rendimiento_A_Academ vr_rendimiento_a_academ = db.VR_Rendimiento_A_Academ.Find(id);
                if (vr_rendimiento_a_academ == null)
                {
                    throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(vr_rendimiento_a_academ);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }