Пример #1
0
        /// <summary>
        /// 根据分类查询字典所有项(为了方便取值,定义成索引器)
        /// </summary>
        /// <param name="dictType"></param>
        /// <returns></returns>
        public List <SysDictDTO> this[EnumDictType dictType]
        {
            get
            {
                if (!DictCahce.ContainsKey(dictType))
                {
                    DictCahce[dictType] = GetDictByType(dictType);
                }

                return(DictCahce[dictType]);
            }
        }
Пример #2
0
        /// <summary>
        /// 根据分类查询字典项
        /// </summary>
        /// <param name="typeID">分类ID</param>
        /// <returns></returns>
        public List <SysDictDTO> GetDictByType(EnumDictType dictType)
        {
            string typeID = dictType.ToString();

            return(GetDictByType(typeID));
        }
Пример #3
0
        /// <summary>
        /// 查询字典名称
        /// </summary>
        /// <param name="dictType">字典分类</param>
        /// <param name="value">字典值</param>
        /// <returns></returns>
        public string GetDictName(EnumDictType dictType, string value)
        {
            var item = this[dictType].FirstOrDefault(i => i.DicCode == value);

            return(item == null ? "" : item.CNName);
        }
Пример #4
0
        /// <summary>
        /// 用于绑定选择框的分类
        /// </summary>
        /// <param name="typeID"></param>
        /// <returns></returns>
        public List <ResponseTextAndValue> GetDownlistByType(EnumDictType dictType)
        {
            string typeID = dictType.ToString();

            return(GetDownlistByType(typeID));
        }