using Lottomat.Application.Busines.BaseManage; using Lottomat.Application.Entity.BaseManage; using Lottomat.Application.Code; using Lottomat.Cache.Factory; using System.Collections.Generic; using System.Data; using System.Linq; using Lottomat.Application.Entity.WebApp; namespace Lottomat.Application.Cache { /// /// 版 本 1.0 /// Copyright (c) 2016-2017 /// 创建人:赵轶 /// 日 期:2016.3.4 9:56 /// 描 述:用户信息缓存 /// public class UserCache { private UserBLL busines = new UserBLL(); /// /// 用户列表 /// /// public IEnumerable GetList() { IEnumerable data = new List(); var cacheList = CacheFactory.Cache().GetCache>(busines.cacheKey); if (cacheList == null) { data = busines.GetList(); CacheFactory.Cache().WriteCache(data, busines.cacheKey); } else { data = cacheList; } return data; } /// /// 用户列表 /// /// 部门Id /// public IEnumerable GetList(string departmentId) { var data = this.GetList(); if (!string.IsNullOrEmpty(departmentId)) { data = data.Where(t => t.DepartmentId == departmentId); } return data; } public Dictionary GetListToApp() { Dictionary data = new Dictionary(); var datalist = this.GetList(); foreach (var item in datalist) { appUserInfoModel one = new appUserInfoModel { UserId = item.UserId, Account = item.Account, RealName = item.RealName, OrganizeId = item.OrganizeId, DepartmentId = item.DepartmentId }; data.Add(item.UserId, one); } return data; } } }