public static IQueryable<approles> GetAllRolesNotDeveloperAndNotAsingToUser(string username)
 {
     DbEntities entities = new DbEntities();
       return from listaRolesAsignables in entities.approles
      from user in entities.appusers
      where user.username == username && listaRolesAsignables.rolename != HMFunctionConst.Developer &&
      !(user.approles).Contains(listaRolesAsignables)
      select listaRolesAsignables;
 }
示例#2
0
 public static int GetNumberOfUsersOnline()
 {
     DbEntities entities = new DbEntities();
       TimeSpan onlineSpan = new TimeSpan(0, System.Web.Security.Membership.UserIsOnlineTimeWindow, 0);
       DateTime compareTime = DateTime.Now.Subtract(onlineSpan);
       IQueryable<appusers> listaUsuariosOnLine = from users in entities.appusers
                                         where users.lastActivityDate >= compareTime
                                         select users;
       return listaUsuariosOnLine.Count();
 }
        public static bool validateAccessByRole(string userName, string controllerName, string actionName)
        {
            DbEntities model = new DbEntities();
              // busca los roles por usuario
              var listaRolePorUsuarios = model.appusers.SingleOrDefault(u => u.username == userName).approles.ToList();
              var RolePorUsuarios = from roles in listaRolePorUsuarios
                            select roles.rolename;

              var ListaAccessos = from rolepermisos in model.approlepermisos
                          where (RolePorUsuarios.Contains(rolepermisos.rolename) && rolepermisos.controller == controllerName && rolepermisos.method == actionName)
                          select rolepermisos;

              if (ListaAccessos.ToList().Count > 0)
            return true;
              else
            return false;
        }
示例#4
0
 public static MembershipUserCollection GetAllMembershipUsers(string PROVIDERNAME, int pageIndex, int pageSize, out int totalRecords)
 {
     DbEntities entities = new DbEntities();
       MembershipUserCollection result = new MembershipUserCollection();
       try
       {
     IQueryable<appusers> listaTotalUsuarios = from users in entities.appusers
                                          select users;
     foreach (appusers u in listaTotalUsuarios)
     {
       result.Add(u.GetMembershipUser(PROVIDERNAME));
     }
       }
       catch (Exception e)
       {
     throw new Exception(string.Format("MSG:{0}\nINNER:{2}\nSTACK:{1}", e.Message, e.StackTrace, e.InnerException));
       }
       totalRecords = result.Count;
       return result;
 }
示例#5
0
 public EANRepository()
 {
     this.entities = new DbEntities();
 }
 //TODO: Crear el contructor
 public ApplicationModelRepositoy()
 {
     this.entities = new DbEntities();
 }
        //public List<approles> GetRolesForOption(string userName, string Model)
        //{
        //  if (!UserExists(GetUser(userName)))
        //    throw new Exception(MissingUser);
        //  else
        //  {
        //    var ListaRoles = from rolesopciones in model.approlesopciones
        //                        join opciones in model.appopciones on rolesopciones.Id_opcion equals opciones.Id_opcion
        //                        where (RolePorUsuarios.Contains(rolesopciones.rolename) && opciones.Nombre == optionName)
        //                        select rolesopciones;
        //  }
        //  //return entities.appusers.SingleOrDefault(u => u.username == userName).approles.ToList();
        //}
        /// <summary>
        /// Validates the option by role.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="optionName">Name of the option.</param>
        /// <returns></returns>
        public static bool validateOptionByRole(string userName, string optionName)
        {
            DbEntities model = new DbEntities();
              // busca los roles por usuario
              var listaRolePorUsuarios = model.appusers.SingleOrDefault(u => u.username == userName).approles.ToList();
              var RolePorUsuarios = from roles in listaRolePorUsuarios
                            select roles.rolename;

              var ListaOpciones = from rolesopciones in model.approlesopciones
                          join opciones in model.appopciones on rolesopciones.Id_opcion equals opciones.Id_opcion
                          where (RolePorUsuarios.Contains(rolesopciones.rolename) && opciones.Nombre == optionName)
                          select rolesopciones;

              if (ListaOpciones.ToList().Count > 0)
            return true;
              else
            return false;
        }
 public Responsables_CalidadRepository()
 {
     this.entities = new DbEntities();
 }
 public appReport_OrderRepository()
 {
     this.entities = new DbEntities();
 }
示例#10
0
 public appusersWSRepository()
 {
     this.entities = new DbEntities();
 }
示例#11
0
 public appreportesRepository()
 {
     this.entities = new DbEntities();
 }
示例#12
0
        public List<appreportes> GetReportByViewData(string srNombreVista)
        {
            DbEntities model = new DbEntities();
              // busca los roles por usuario

              var ListaOpciones = from r in model.appreportes
                          where r.Nombre_vista == srNombreVista
                          select r;

              return ListaOpciones.ToList();
        }
示例#13
0
 public CentrosRepository()
 {
     this.entities = new DbEntities();
 }
 public Origen_alertaRepository()
 {
     this.entities = new DbEntities();
 }
示例#15
0
 public SeccionesRepository()
 {
     this.entities = new DbEntities();
 }
示例#16
0
 public MercadosRepository()
 {
     this.entities = new DbEntities();
 }
示例#17
0
 public AlertasRepository()
 {
     this.entities = new DbEntities();
 }
示例#18
0
        public List<appreportes> GetReportByOption(string optionName)
        {
            DbEntities model = new DbEntities();
              // busca los roles por usuario

              var ListaOpciones = from r in model.appreportes
                          join o in model.appopciones on r.Id_opcion equals o.Id_opcion
                          where o.Nombre == optionName
                          select r;

              return ListaOpciones.ToList();
        }
 public Alertas_detalle_EANRepository()
 {
     this.entities = new DbEntities();
 }
示例#20
0
        public IQueryable<Tab_Consultas> GetTabConsultas(string tipo_consultas)
        {
            DbEntities model = new DbEntities();
              // busca los roles por usuario

              var ListaConsultas = from r in model.Tab_Consultas
                          where r.tipo == tipo_consultas
                          select r;

              return ListaConsultas;
        }
示例#21
0
 public appopcionesRepository()
 {
     this.entities = new DbEntities();
 }
 public approlepermisosRepository()
 {
     this.entities = new DbEntities();
 }
示例#23
0
 public Tipos_CargosRepository()
 {
     this.entities = new DbEntities();
 }
示例#24
0
 public appmanualRepository()
 {
     this.entities = new DbEntities();
 }
 public appcentrosrolesRepository()
 {
     this.entities = new DbEntities();
 }