示例#1
0
        public static IList <DicsModel> GetDicsInfoByKeyAllLanguage(string key)
        {
            try
            {
                // 全部的Dics
                IList <DicsModel> lstDics = RedisCacheHelper.Get <List <DicsModel> >(keyDicsInfo);
                if (lstDics == null)
                {
                    lstDics = new DicsBLL().GetAllDicsInfo();

                    RedisCacheHelper.Add(keyDicsInfo, lstDics, 60);
                }

                // 根据DicsType 获取相关的字典属性
                var result = (from n in lstDics
                              where n.DicType == key
                              select n).ToList <DicsModel>();

                return(result);
            }
            catch
            {
                return(null);
            }
        }
示例#2
0
        /// <summary>
        /// 获取行业类型描述列表
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static IList <DicsModel> GetDicsInfoByKey(string key)
        {
            try
            {
                // 全部的Dics
                IList <DicsModel> lstDics = RedisCacheHelper.Get <List <DicsModel> >(keyDicsInfo);
                if (lstDics == null || lstDics.Where(p => String.IsNullOrWhiteSpace(p.KeyName)).Count() > 0)
                {
                    lstDics = new DicsBLL().GetAllDicsInfo();

                    RedisCacheHelper.Add(keyDicsInfo, lstDics, 60);
                }

                // 根据DicsType 获取相关的字典属性
                var result = (from n in lstDics
                              where n.DicType == key && n.LanguageVersion == (int)LanguageEnum.TraditionalChinese
                              select n).ToList <DicsModel>();

                return(result);
            }
            catch
            {
                return(null);
            }
        }