Пример #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;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["delete"]) &&
                !string.IsNullOrEmpty(Request.QueryString["menuId"]))
            {
                MenuDao.Delete(Convert.ToInt32(Request.QueryString["menuId"]));
                LtlMessage.Text = Utils.GetMessageHtml("删除成功!", true);
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["up"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["parentId"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["menuId"]))
            {
                MenuDao.UpdateTaxisToUp(Convert.ToInt32(Request.QueryString["parentId"]), Convert.ToInt32(Request.QueryString["menuId"]));
                LtlMessage.Text = Utils.GetMessageHtml("排序成功!", true);
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["down"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["parentId"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["menuId"]))
            {
                MenuDao.UpdateTaxisToDown(Convert.ToInt32(Request.QueryString["parentId"]), Convert.ToInt32(Request.QueryString["menuId"]));
                LtlMessage.Text = Utils.GetMessageHtml("排序成功!", true);
            }

            if (IsPostBack)
            {
                return;
            }

            var menuInfoList = MenuDao.GetMenuInfoList(0);

            RptContents.DataSource     = menuInfoList;
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            BtnAdd.OnClientClick = $"location.href = '{PageMenuSettings.GetRedirectUrl(0, 0)}';return false;";
        }