/// <summary> /// 查询缓存:通过 角色类型 所有数据 /// </summary> /// <param name="roleType">角色类型</param> /// <returns></returns> public List <Bd_Base_Page> GetListByCache(int roleType) { List <Bd_Base_Page> basePageList = null; try { PbProject.WebCommon.Web.Cache.CacheManage cacheManage = new WebCommon.Web.Cache.CacheManage(); basePageList = cacheManage.GetCacheData("GetBasePageList", "GetBasePageList") as List <Bd_Base_Page>; if (basePageList == null || basePageList.Count == 0) { basePageList = GetList(); cacheManage.SetCacheData("GetBasePageList", basePageList, -1, "GetBasePageList"); } if (basePageList != null && basePageList.Count > 0) { basePageList = basePageList.Where(w => w.RoleType == roleType).ToList <Bd_Base_Page>(); } basePageList.Sort(); } catch (Exception) { } return(basePageList); }
/// <summary> /// 字典表缓存:通过父级 id 读取所有数据 /// </summary> /// <param name="parentID">通过父级 id</param> /// <returns></returns> public List <Bd_Base_Dictionary> GetListByParentID(int parentID) { List <Bd_Base_Dictionary> DictionaryList = null; try { PbProject.WebCommon.Web.Cache.CacheManage cacheManage = new WebCommon.Web.Cache.CacheManage(); DictionaryList = cacheManage.GetCacheData("GetBaseDictionaryList", "GetBaseDictionaryList") as List <Bd_Base_Dictionary>; if (DictionaryList == null || DictionaryList.Count == 0) { DictionaryList = GetList(); cacheManage.SetCacheData("GetBaseDictionaryList", DictionaryList, -1, "GetBaseDictionaryList"); } if (DictionaryList != null && DictionaryList.Count > 0) { DictionaryList = DictionaryList.Where(w => w.ParentID == parentID).ToList <Bd_Base_Dictionary>(); } DictionaryList.Sort(); } catch (Exception) { } return(DictionaryList); }