Exemple #1
0
        /// <summary>
        /// 获取包含当前枚举代号下的所有子节点项数据列表
        /// </summary>
        /// <param name="enumCode"></param>
        /// <returns></returns>
        public static List <SysEnumInfo> GetListIncludeChild(string enumCode)
        {
            SysEnum bll = new SysEnum();

            if (!enableCaching)
            {
                return(bll.GetListIncludeChild(enumCode));
            }

            string             key  = "SysEnum_GetListIncludeChild_" + enumCode + "";
            List <SysEnumInfo> data = (List <SysEnumInfo>)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetListIncludeChild(enumCode);

                AggregateCacheDependency cd = DependencyFacade.GetSysEnumDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(sysEnumTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
        private void GetJsonForCbbRepair(HttpContext context)
        {
            SysEnum seBll = new SysEnum();
            var     list  = seBll.GetListIncludeChild("ComplainCategory");

            if (list == null || list.Count() == 0)
            {
                context.Response.Write("[]");
            }

            string json = "";

            foreach (var model in list)
            {
                json += "{\"id\":\"" + model.Id + "\",\"text\":\"" + model.EnumValue + "\"},";
            }

            context.Response.Write("[" + json.Trim(',') + "]");
        }