Exemple #1
0
        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);
        }
Exemple #2
0
        public void createmenu(System.Web.HttpContext context)
        {
            WeiBo  weiBo = new WeiBo();
            string s     = "";

            if (!string.IsNullOrEmpty(context.Request["comment"]))
            {
                s = weiBo.createmenu(context.Request["comment"]);
            }
            context.Response.Write(s);
        }