Exemplo n.º 1
0
        public void GetMenu(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   text     = "{";
            MenuInfo menuInfo = new MenuInfo();
            int      menuId   = 0;

            if (!int.TryParse(context.Request["MenuId"], out menuId))
            {
                return;
            }
            menuInfo = WeiboHelper.GetMenu(menuId);
            if (menuInfo != null)
            {
                text += "\"status\":\"0\",\"data\":[";
                object obj = text;
                text = string.Concat(new object[]
                {
                    obj,
                    "{\"menuid\": \"",
                    menuInfo.MenuId,
                    "\","
                });
                text  = text + "\"type\": \"" + menuInfo.Type + "\",";
                text  = text + "\"name\": \"" + Globals.String2Json(menuInfo.Name) + "\",";
                text  = text + "\"content\": \"" + Globals.String2Json(menuInfo.Content) + "\"}";
                text += "]";
            }
            text += "}";
            context.Response.Write(text);
        }
        public void GetMenu(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   s      = "{";
            MenuInfo menu   = new MenuInfo();
            int      result = 0;

            if (!int.TryParse(context.Request["MenuId"], out result))
            {
                s = "\"status\":\"1\"";
            }
            else
            {
                menu = WeiboHelper.GetMenu(result);
                if (menu != null)
                {
                    object obj2 = s + "\"status\":\"0\",\"data\":[";
                    s = (((string.Concat(new object[] { obj2, "{\"menuid\": \"", menu.MenuId, "\"," }) + "\"type\": \"" + menu.Type + "\",") + "\"name\": \"" + Globals.String2Json(menu.Name) + "\",") + "\"content\": \"" + Globals.String2Json(menu.Content) + "\"}") + "]";
                }
                s = s + "}";
                context.Response.Write(s);
            }
        }