예제 #1
0
 /// <summary>
 /// 取得下拉列表值
 /// </summary>
 /// <returns></returns>
 public static List <EasyComboValues> GetComboValues()
 {
     using (var proxy = new RedisProxy(RedisProxy.DbComboCache))
     {
         var result = proxy.Client.Get <List <EasyComboValues> >(comboKey);
         if (result == null)
         {
             var access = new UserDataAccess();
             var datas  = access.All(p => p.DataState == DataStateType.Enable);
             result = new List <EasyComboValues> {
                 EasyComboValues.Empty
             };
             result.AddRange(datas.Select(p => new EasyComboValues(p.Id, p.RealName)));
             proxy.Client.Set(comboKey, result);
         }
         return(result);
     }
 }
예제 #2
0
 /// <summary>
 /// 取得下拉树值
 /// </summary>
 /// <returns></returns>
 public static List <EasyUiTreeNode> GetTreeValues()
 {
     using (var proxy = new RedisProxy(RedisProxy.DbComboCache))
     {
         var result = proxy.Client.Get <List <EasyUiTreeNode> >(treeKey);
         if (result == null)
         {
             var access = new UserDataAccess();
             var datas  = access.All(p => p.DataState == DataStateType.Enable);
             result = new List <EasyUiTreeNode> {
                 EasyUiTreeNode.EmptyNode
             };
             result.AddRange(datas.Select(p => new EasyUiTreeNode
             {
                 ID     = p.Id,
                 Text   = p.RealName,
                 Title  = p.RealName,
                 IsOpen = true
             }));
             proxy.Client.Set(treeKey, result);
         }
         return(result);
     }
 }