public List<SysPermission> GetAllPermissions()
 {
     var list= _dataAccess.GetList<SysPermission>("Sys_Permission.Status=0 ORDER BY Sort");
     foreach (var function in list)
     {
         //function.Father = list.FirstOrDefault(p => p.PermissionId == function.ParentId);
         function.Childrens.AddRange(list.Where(p => p.ParentId == function.PermissionId));
     }
     return list;
 }
Exemple #2
0
        /// <summary>
        /// 从缓存中获取指定类型的集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public IEnumerable <T> GetCache <T>() where T : BaseEntity
        {
            var cachekey = typeof(T).FullName;
            var list     = CacheHelper.CacheService.GetList <T>(cachekey);

            if (list == null || !list.Any())
            {
                list = _dataAccess.GetList <T>();
                CacheHelper.CacheService.SetList(cachekey, list, CachingExpirationType.Invariable);
            }
            return(list);
        }
        public static void SetConfigValue(int tenantId, string section, string name, string value)
        {
            string           sqlwhere = @" Sys_TenantConfig.TenantId=@tid 
AND Sys_TenantConfig.ConfigName=@name 
AND Sys_TenantConfig.ConfigSection=@section";
            Sys_TenantConfig config   =
                _dataAccess.GetList <Sys_TenantConfig>(sqlwhere, new { tid = tenantId, name, section }).FirstOrDefault();

            if (config == null)
            {
                config               = new Sys_TenantConfig();
                config.TenantId      = tenantId;
                config.ConfigSection = section;
                config.ConfigName    = name;
                config.ConfigValue   = value;
                _dataAccess.AddEntity(config);
            }
            else
            {
                config.ConfigValue = value;
                _dataAccess.UpdateEntity(config);
            }
        }
Exemple #4
0
 /// <summary>
 ///     根据用户名查找用户
 /// </summary>
 public SysUser GetUserByName(string username)
 {
     //var user = _dataAccess.GetExtend<RetechWing.Models.TenantSystem.User>(1);
     return(_dataAccess.GetList <SysUser>("Sys_Users.Status = 0 and Sys_Users.Username=@username", new { username }).FirstOrDefault());
 }
Exemple #5
0
        public IEnumerable <SysPost> GetPostByDeptId(int deptId)
        {
            var sqlwhere = "Sys_Posts.Status=0 AND Sys_Posts.DeptId=" + deptId;

            return(_dataAccess.GetList <SysPost>(sqlwhere));
        }
Exemple #6
0
 // added at 8 sep 2007 10 : 44
 public IList GetList(Type type, ICriterion[] expArrays, Order[] orderArrays)
 {
     //BaseDataAccess mgr = new BaseDataAccess();
     using (mgr)
         return(mgr.GetList(type, expArrays, orderArrays));
 }
 /// <summary>
 ///     获得数据列表
 /// </summary>
 public List <UserActivity> GetList(string strWhere)
 {
     return(_dataAccess.GetList <UserActivity>(strWhere));
 }