public void AddMenus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   s    = "{\"status\":\"1\"}";
            MenuInfo menu = new MenuInfo {
                Content = context.Request["Content"].Trim(),
                Name    = context.Request["Name"].Trim(),
                wid     = this.wid
            };

            if (context.Request["ParentMenuId"] != null)
            {
                menu.ParentMenuId = (context.Request["ParentMenuId"] == "") ? 0 : int.Parse(context.Request["ParentMenuId"]);
            }
            else
            {
                menu.ParentMenuId = 0;
            }
            menu.Type = context.Request["Type"];
            if (VShopHelper.CanAddMenu(menu.ParentMenuId, this.wid))
            {
                if (VShopHelper.SaveMenu(menu))
                {
                    s = "{\"status\":\"0\"}";
                }
            }
            else
            {
                s = "{\"status\":\"2\"}";
            }
            context.Response.Write(s);
        }
Exemple #2
0
        private void btnAddMenu_Click(object sender, EventArgs e)
        {
            if ((this.ddlType.SelectedValue == "1") && (this.ddlValue.Items.Count <= 0))
            {
                this.ShowMsg("关键字不能为空", false);
            }
            else
            {
                MenuInfo menu = new MenuInfo {
                    Name         = this.txtCategoryName.Text,
                    ParentMenuId = base.GetUrlIntParam("pid"),
                    wid          = this.wid
                };
                if (!VShopHelper.CanAddMenu(menu.ParentMenuId, this.wid))
                {
                    this.ShowMsg("一级菜单不能超过三个,对应二级菜单不能超过五个", false);
                }
                else
                {
                    menu.Bind = Convert.ToInt32(this.ddlType.SelectedValue);
                    BindType bindType = menu.BindType;
                    switch (bindType)
                    {
                    case BindType.Key:
                        menu.ReplyId = Convert.ToInt32(this.ddlValue.SelectedValue);
                        break;

                    case BindType.Topic:
                        menu.Content = this.ddlValue.SelectedValue;
                        break;

                    default:
                        if (bindType == BindType.Url)
                        {
                            menu.Content = this.txtUrl.Text.Trim();
                        }
                        break;
                    }
                    menu.Type = "click";
                    if (menu.ParentMenuId == 0)
                    {
                        menu.Type = "view";
                    }
                    else if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || (this.ddlType.SelectedValue == "0"))
                    {
                        this.ShowMsg("二级菜单必须绑定一个对象", false);
                        return;
                    }
                    if (VShopHelper.SaveMenu(menu))
                    {
                        base.Response.Redirect("ManageMenu.aspx");
                    }
                    else
                    {
                        this.ShowMsg("添加失败", false);
                    }
                }
            }
        }
Exemple #3
0
        private void btnAddMenu_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (masterSettings.IsDemoSite)
            {
                this.ShowMsg("演示站点不允许添加微信自定义菜单", false);
            }
            else
            {
                MenuInfo menuInfo = new MenuInfo();
                menuInfo.Name         = this.txtCategoryName.Text;
                menuInfo.ParentMenuId = base.GetUrlIntParam("pid");
                if (!VShopHelper.CanAddMenu(menuInfo.ParentMenuId, ClientType.VShop))
                {
                    this.ShowMsg("一级菜单不能超过三个,对应二级菜单不能超过五个", false);
                }
                else
                {
                    menuInfo.Bind = Convert.ToInt32(this.ddlType.SelectedValue);
                    switch (menuInfo.BindType)
                    {
                    case BindType.Url:
                        menuInfo.Content = this.txtUrl.Text.Trim();
                        break;

                    case BindType.Key:
                        menuInfo.ReplyId = Convert.ToInt32(this.ddlValue.SelectedValue);
                        break;

                    case BindType.Topic:
                        menuInfo.Content = this.ddlValue.SelectedValue;
                        break;
                    }
                    menuInfo.Client = ClientType.VShop;
                    menuInfo.Type   = "click";
                    if (menuInfo.ParentMenuId == 0)
                    {
                        menuInfo.Type = "view";
                    }
                    else if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || this.ddlType.SelectedValue == "0")
                    {
                        this.ShowMsg("二级菜单必须绑定一个对象", false);
                        return;
                    }
                    if (VShopHelper.SaveMenu(menuInfo))
                    {
                        base.Response.Redirect("ManageMenu.aspx");
                    }
                    else
                    {
                        this.ShowMsg("添加失败", false);
                    }
                }
            }
        }
Exemple #4
0
        private void btnAddMenu_Click(object sender, System.EventArgs e)
        {
            MenuInfo menuInfo = new MenuInfo();

            menuInfo.Name         = this.txtCategoryName.Text;
            menuInfo.ParentMenuId = base.GetUrlIntParam("pid");
            if (!VShopHelper.CanAddMenu(menuInfo.ParentMenuId, ClientType.VShop))
            {
                this.ShowMsg("一级菜单不能超过三个,对应二级菜单不能超过五个", false);
                return;
            }
            menuInfo.Bind = System.Convert.ToInt32(this.ddlType.SelectedValue);
            BindType bindType = menuInfo.BindType;

            switch (bindType)
            {
            case BindType.Key:
                menuInfo.ReplyId = System.Convert.ToInt32(this.ddlValue.SelectedValue);
                break;

            case BindType.Topic:
                menuInfo.Content = this.ddlValue.SelectedValue;
                break;

            default:
                if (bindType == BindType.Url)
                {
                    menuInfo.Content = this.txtUrl.Text.Trim();
                }
                break;
            }
            menuInfo.Client = ClientType.VShop;
            menuInfo.Type   = "click";
            if (menuInfo.ParentMenuId == 0)
            {
                menuInfo.Type = "view";
            }
            else
            {
                if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || this.ddlType.SelectedValue == "0")
                {
                    this.ShowMsg("二级菜单必须绑定一个对象", false);
                    return;
                }
            }
            if (VShopHelper.SaveMenu(menuInfo))
            {
                base.Response.Redirect("ManageMenu.aspx");
                return;
            }
            this.ShowMsg("添加失败", false);
        }
Exemple #5
0
        public void AddMenus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   s    = "{\"status\":\"1\"}";
            MenuInfo menu = new MenuInfo
            {
                Content = context.Request["Content"].Trim(),
                Name    = context.Request["Name"].Trim(),
                Type    = context.Request["Type"],
                Bind    = 8
            };

            if (menu.Content.EndsWith("/getstorecard/"))
            {
                menu.Bind = 9;
                menu.Type = "click";
            }
            if (context.Request["ParentMenuId"] != null)
            {
                menu.ParentMenuId = (context.Request["ParentMenuId"] == "") ? 0 : int.Parse(context.Request["ParentMenuId"]);
            }
            else
            {
                menu.ParentMenuId = 0;
            }
            if (VShopHelper.CanAddMenu(menu.ParentMenuId))
            {
                if (VShopHelper.SaveMenu(menu))
                {
                    if (menu.ParentMenuId > 0)
                    {
                        MenuInfo info2 = VShopHelper.GetMenu(menu.ParentMenuId);
                        info2.Bind    = 0;
                        info2.Content = "";
                        VShopHelper.UpdateMenu(info2);
                    }
                    s = "{\"status\":\"0\"}";
                }
            }
            else
            {
                s = "{\"status\":\"2\"}";
            }
            context.Response.Write(s);
        }
Exemple #6
0
        public void AddMenus(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   s        = "{\"status\":\"1\"}";
            MenuInfo menuInfo = new MenuInfo();

            menuInfo.Content = context.Request["Content"].Trim();
            menuInfo.Name    = context.Request["Name"].Trim();
            menuInfo.Bind    = 8;
            if (context.Request["ParentMenuId"] != null)
            {
                menuInfo.ParentMenuId = ((context.Request["ParentMenuId"] == "") ? 0 : int.Parse(context.Request["ParentMenuId"]));
            }
            else
            {
                menuInfo.ParentMenuId = 0;
            }
            menuInfo.Type = context.Request["Type"];
            if (VShopHelper.CanAddMenu(menuInfo.ParentMenuId))
            {
                if (VShopHelper.SaveMenu(menuInfo))
                {
                    if (menuInfo.ParentMenuId > 0)
                    {
                        MenuInfo menu = VShopHelper.GetMenu(menuInfo.ParentMenuId);
                        menu.Bind    = 0;
                        menu.Content = "";
                        VShopHelper.UpdateMenu(menu);
                    }
                    s = "{\"status\":\"0\"}";
                }
            }
            else
            {
                s = "{\"status\":\"2\"}";
            }
            context.Response.Write(s);
        }
Exemple #7
0
        private void btnAddMenu_Click(object sender, System.EventArgs e)
        {
            if (this.ddlType.SelectedValue == "1" && this.ddlValue.Items.Count <= 0)
            {
                this.ShowMsgToTarget("关键字不能为空", false, "parent");
                return;
            }
            MenuInfo menuInfo = new MenuInfo();

            if (this.id > 0)
            {
                menuInfo = VShopHelper.GetMenu(this.id);
            }
            else
            {
                menuInfo.ParentMenuId = this.parentid;
                if (!VShopHelper.CanAddMenu(menuInfo.ParentMenuId))
                {
                    this.ShowMsgToTarget("一级菜单不能超过三个,对应二级菜单不能超过五个", false, "parent");
                    return;
                }
            }
            int    num = 16;
            string msg = "菜单标题不超过16个字节!";

            if (menuInfo.ParentMenuId > 0)
            {
                num = 14;
                msg = "二级菜单不超过14个字节!";
            }
            string text = this.txtMenuName.Text;

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsgToTarget("请填写菜单名称!", false, "parent");
                return;
            }
            if (this.GetStrLen(text) > num)
            {
                this.ShowMsgToTarget(msg, false, "parent");
                return;
            }
            menuInfo.Name = this.txtMenuName.Text;
            menuInfo.Type = "click";
            if (menuInfo.ParentMenuId == 0)
            {
                menuInfo.Type = "view";
            }
            else if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || this.ddlType.SelectedValue == "0")
            {
                this.ShowMsgToTarget("二级菜单必须绑定一个对象", false, "parent");
                return;
            }
            menuInfo.Bind = System.Convert.ToInt32(this.ddlType.SelectedValue);
            BindType bindType = menuInfo.BindType;

            switch (bindType)
            {
            case BindType.Key:
                menuInfo.ReplyId = System.Convert.ToInt32(this.ddlValue.SelectedValue);
                break;

            case BindType.Topic:
                menuInfo.Content = this.ddlValue.SelectedValue;
                break;

            default:
                if (bindType == BindType.Url)
                {
                    menuInfo.Content = this.txtUrl.Text.Trim();
                }
                break;
            }
            if (this.id > 0)
            {
                if (VShopHelper.UpdateMenu(menuInfo))
                {
                    this.DoFunction("菜单修改成功!");
                    return;
                }
                this.ShowMsgToTarget("菜单添加失败", false, "parent");
                return;
            }
            else
            {
                if (VShopHelper.SaveMenu(menuInfo))
                {
                    this.DoFunction("菜单添加成功!");
                    return;
                }
                this.ShowMsgToTarget("菜单添加失败", false, "parent");
                return;
            }
        }