Пример #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (!Main.Instance.AdminApi.IsPluginAuthorized)
            {
                HttpContext.Current.Response.Write("<h1>未授权访问</h1>");
                HttpContext.Current.Response.End();
                return;
            }

            int.TryParse(Request.QueryString["parentId"], out _parentId);
            int.TryParse(Request.QueryString["menuId"], out _menuId);
            _menuInfo = _menuId > 0 ? MenuDao.GetMenuInfo(_menuId) : new MenuInfo();

            if (IsPostBack)
            {
                return;
            }

            TbTitle.Text = _menuInfo.Title;
            if (_parentId > 0)
            {
                PhSettings.Visible = true;
                TbUrl.Text         = _menuInfo.Url;
                Utils.SelectListItems(DdlIsOpenWindow, _menuInfo.IsOpenWindow.ToString());
            }
            else
            {
                PhSettings.Visible = false;
            }

            BtnReturn.Attributes.Add("onclick", $"location.href='{PageMenu.GetRedirectUrl()}';return false");
        }
Пример #2
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            _menuInfo.ParentId     = _parentId;
            _menuInfo.Title        = TbTitle.Text;
            _menuInfo.Url          = TbUrl.Text;
            _menuInfo.IsOpenWindow = Convert.ToBoolean(DdlIsOpenWindow.SelectedValue);
            if (_menuId == 0)
            {
                _menuInfo.Id = MenuDao.Insert(_menuInfo);
            }
            else
            {
                MenuDao.Update(_menuInfo);
            }

            Response.Redirect(PageMenu.GetRedirectUrl());
        }