using LeaRun.Application.Busines; using LeaRun.Application.Busines.SystemManage; using LeaRun.Application.Entity.SystemManage.ViewModel; using LeaRun.Cache.Factory; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LeaRun.Application.Cache { /// /// 版 本 6.1 /// Copyright (c) 2013-2016 上海力软信息技术有限公司 /// 创建人:佘赐雄 /// 日 期:2015.12.29 9:56 /// 描 述:数据字典缓存 /// public class DataItemCache { private DataItemDetailBLL busines = new DataItemDetailBLL(); /// /// 数据字典列表 /// /// public IEnumerable GetDataItemList() { var cacheList = CacheFactory.Cache().GetCache>(busines.cacheKey); if (cacheList == null) { var data = busines.GetDataItemList(); CacheFactory.Cache().WriteCache(data, busines.cacheKey); return data; } else { return cacheList; } } /// /// 数据字典列表 /// /// 分类代码 /// public IEnumerable GetDataItemList(string EnCode) { return this.GetDataItemList().Where(t => t.EnCode == EnCode); } /// /// 数据字典列表 /// /// 分类代码 /// 项目值 /// public IEnumerable GetSubDataItemList(string EnCode, string ItemValue) { var data = this.GetDataItemList().Where(t => t.EnCode == EnCode); string ItemDetailId = data.First(t => t.ItemValue == ItemValue).ItemDetailId; return data.Where(t => t.ParentId == ItemDetailId); } /// /// 项目值转换名称 /// /// 分类代码 /// 项目值 /// public string ToItemName(string EnCode, string ItemValue) { var data = this.GetDataItemList().Where(t => t.EnCode == EnCode); return data.First(t => t.ItemValue == ItemValue).ItemName; } } }