Ejemplo n.º 1
0
        public void GetMenu(HttpContext context)
        {
            context.Response.ContentType = "application/json;charset=utf-8";
            context.Response.Charset     = "utf-8";
            string       str          = "{";
            ShopMenuInfo shopMenuInfo = new ShopMenuInfo();
            int          menuId       = 0;

            if (!int.TryParse(context.Request["MenuId"], out menuId))
            {
                str = "\"status\":\"1\"";
            }
            else
            {
                shopMenuInfo = ShopMenuHelper.GetMenu(menuId);
                if (shopMenuInfo != null)
                {
                    str += "\"status\":\"0\",\"data\":[";
                    str  = str + "{\"menuid\": \"" + shopMenuInfo.MenuId + "\",";
                    str  = str + "\"type\": \"" + shopMenuInfo.Type + "\",";
                    str  = str + "\"name\": \"" + shopMenuInfo.Name + "\",";
                    str  = str + "\"shopmenupic\": \"" + shopMenuInfo.ShopMenuPic + "\",";
                    str  = str + "\"content\": \"" + shopMenuInfo.Content + "\"}";
                    str += "]";
                }
                str += "}";
                context.Response.Write(str);
            }
        }
Ejemplo n.º 2
0
        public void updatename(HttpContext context)
        {
            context.Response.ContentType = "application/json;charset=utf-8";
            context.Response.Charset     = "utf-8";
            string s   = "{\"status\":\"1\"}";
            int    num = 0;

            if (!int.TryParse(context.Request["MenuId"], out num))
            {
                s = "{\"status\":\"1\"}";
            }
            else
            {
                if (num > 0)
                {
                    ShopMenuInfo menu = ShopMenuHelper.GetMenu(num);
                    menu.Name   = context.Request["Name"];
                    menu.MenuId = num;
                    if (ShopMenuHelper.UpdateMenu(menu))
                    {
                        s = "{\"status\":\"0\"}";
                    }
                }
                context.Response.Write(s);
            }
        }