public void GetTopMenus(System.Web.HttpContext context) { context.Response.ContentType = "application/json"; string text = "{"; System.Collections.Generic.IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus(); if (topMenus.Count <= 0) { text += "\"status\":\"-1\""; return; } text += "\"status\":\"0\",\"data\":["; foreach (MenuInfo current in topMenus) { System.Collections.Generic.IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(current.MenuId); object obj = text; text = string.Concat(new object[] { obj, "{\"menuid\": \"", current.MenuId, "\"," }); text += "\"childdata\":["; if (menusByParentId.Count > 0) { foreach (MenuInfo current2 in menusByParentId) { object obj2 = text; text = string.Concat(new object[] { obj2, "{\"menuid\": \"", current2.MenuId, "\"," }); object obj3 = text; text = string.Concat(new object[] { obj3, "\"parentmenuid\": \"", current2.ParentMenuId, "\"," }); text = text + "\"type\": \"" + current2.Type + "\","; text = text + "\"name\": \"" + Globals.String2Json(current2.Name) + "\","; text = text + "\"content\": \"" + Globals.String2Json(current2.Content) + "\"},"; } text = text.Substring(0, text.Length - 1); } text += "],"; text = text + "\"type\": \"" + current.Type + "\","; text = text + "\"name\": \"" + Globals.String2Json(current.Name) + "\","; text = text + "\"content\": \"" + Globals.String2Json(current.Content) + "\"},"; } text = text.Substring(0, text.Length - 1); text += "]"; text += "}"; context.Response.Write(text); }
public void savemenu(System.Web.HttpContext context) { string text = "{"; System.Collections.Generic.IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus(); if (topMenus.Count <= 0) { return; } text += "\"button\":["; foreach (MenuInfo current in topMenus) { System.Collections.Generic.IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(current.MenuId); text = text + "{\"name\": \"" + Globals.String2Json(current.Name) + "\","; if (menusByParentId.Count > 0) { text += "\"sub_button\":["; foreach (MenuInfo current2 in menusByParentId) { text = text + "{\"type\": \"" + current2.Type + "\","; text = text + "\"name\": \"" + Globals.String2Json(current2.Name) + "\","; if (current2.Type == "click") { text = text + "\"key\": \"" + Globals.String2Json(current2.Content) + "\"},"; } else { text = text + "\"url\": \"" + Globals.String2Json(current2.Content) + "\"},"; } } text = text.Substring(0, text.Length - 1); text += "]},"; } else { text = text + "\"type\": \"" + current.Type + "\","; if (current.Type == "click") { text = text + "\"key\": \"" + Globals.String2Json(current.Content) + "\"},"; } else { text = text + "\"url\": \"" + Globals.String2Json(current.Content) + "\"},"; } } } text = text.Substring(0, text.Length - 1); text += "]"; text += "}"; WeiBo weiBo = new WeiBo(); text = weiBo.createmenu(text); context.Response.Write(text); }
public void savemenu(HttpContext context) { string comment = "{"; IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus(); if (topMenus.Count > 0) { comment = comment + "\"button\":["; foreach (MenuInfo info in topMenus) { IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(info.MenuId); comment = comment + "{\"name\": \"" + Globals.String2Json(info.Name) + "\","; if (menusByParentId.Count > 0) { comment = comment + "\"sub_button\":["; foreach (MenuInfo info2 in menusByParentId) { comment = comment + "{\"type\": \"" + info2.Type + "\","; comment = comment + "\"name\": \"" + Globals.String2Json(info2.Name) + "\","; if (info2.Type == "click") { comment = comment + "\"key\": \"" + Globals.String2Json(info2.Content) + "\"},"; } else { comment = comment + "\"url\": \"" + Globals.String2Json(info2.Content) + "\"},"; } } comment = comment.Substring(0, comment.Length - 1); comment = comment + "]},"; } else { comment = comment + "\"type\": \"" + info.Type + "\","; if (info.Type == "click") { comment = comment + "\"key\": \"" + Globals.String2Json(info.Content) + "\"},"; } else { comment = comment + "\"url\": \"" + Globals.String2Json(info.Content) + "\"},"; } } } comment = comment.Substring(0, comment.Length - 1) + "]" + "}"; comment = new global::ControlPanel.WeiBo.WeiBo().createmenu(comment); context.Response.Write(comment); } }
public void GetTopMenus(HttpContext context) { context.Response.ContentType = "application/json"; string s = "{"; IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus(); if (topMenus.Count <= 0) { s = s + "\"status\":\"-1\""; } else { s = s + "\"status\":\"0\",\"data\":["; foreach (MenuInfo info in topMenus) { IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(info.MenuId); object obj2 = s; s = string.Concat(new object[] { obj2, "{\"menuid\": \"", info.MenuId, "\"," }); s = s + "\"childdata\":["; if (menusByParentId.Count > 0) { foreach (MenuInfo info2 in menusByParentId) { object obj3 = s; s = string.Concat(new object[] { obj3, "{\"menuid\": \"", info2.MenuId, "\"," }); object obj4 = s; s = string.Concat(new object[] { obj4, "\"parentmenuid\": \"", info2.ParentMenuId, "\"," }); s = s + "\"type\": \"" + info2.Type + "\","; s = s + "\"name\": \"" + Globals.String2Json(info2.Name) + "\","; s = s + "\"content\": \"" + Globals.String2Json(info2.Content) + "\"},"; } s = s.Substring(0, s.Length - 1); } s = s + "],"; s = s + "\"type\": \"" + info.Type + "\","; s = s + "\"name\": \"" + Globals.String2Json(info.Name) + "\","; s = s + "\"content\": \"" + Globals.String2Json(info.Content) + "\"},"; } s = s.Substring(0, s.Length - 1) + "]" + "}"; context.Response.Write(s); } }