コード例 #1
0
        /// <summary>
        /// 提交按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            MenuInfo menu = new MenuInfo();

            menu.ID        = RequestHelper.GetQueryString <int>("ID");
            menu.FatherID  = Convert.ToInt32(FatherID.Text);
            menu.OrderID   = Convert.ToInt32(OrderID.Text);
            menu.MenuName  = MenuName.Text;
            menu.MenuImage = Convert.ToInt32(MenuImage.Text);
            menu.URL       = URL.Text;
            menu.Date      = RequestHelper.DateNow;
            menu.IP        = ClientHelper.IP;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (menu.ID == int.MinValue)
            {
                CheckAdminPower("AddMenu", PowerCheckType.Single);
                int id = MenuBLL.AddMenu(menu);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Menu"), id);
            }
            else
            {
                CheckAdminPower("UpdateMenu", PowerCheckType.Single);
                MenuBLL.UpdateMenu(menu);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Menu"), menu.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
コード例 #2
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            MenuInfo item = new MenuInfo();

            item.MenuName = txt_menuName.Value;
            item.ParentId = Convert.ToInt32(ddl_menu.SelectedValue);
            item.UrlLink  = txt_urlLink.Value;
            item.SortId   = Convert.ToInt32(txt_sortId.Value);

            if (Id == 0)
            {
                if (menuBll.AddMenu(item) > 0)
                {
                    base.ErrorMsg("提交成功!", "MenuList.aspx", 1);
                }
                else
                {
                    base.ErrorMsg("提交失败!", "MenuList.aspx", 0);
                }
            }
            else
            {
                item.Id = Id;
                if (menuBll.UpdateMenu(item) > 0)
                {
                    base.ErrorMsg("提交成功!", "MenuList.aspx", 1);
                }
                else
                {
                    base.ErrorMsg("提交失败!", "MenuList.aspx", 0);
                }
            }
        }