Exemplo n.º 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete") && Body.IsQueryExists("KeywordID"))
            {
                var keywordId = Body.GetQueryInt("KeywordID");
                try
                {
                    DataProvider.KeywordDao.Delete(keywordId);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.SelectCommand     = DataProvider.KeywordDao.GetSelectCommand();
            RptContents.ItemDataBound   += RptContents_ItemDataBound;
            SpContents.SortField         = nameof(KeywordInfo.Id);
            SpContents.SortMode          = SortMode.DESC; //排序
            SpContents.ItemsPerPage      = 20;

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Site);

            SpContents.DataBind();
            BtnAdd.Attributes.Add("onclick", ModalKeywordAdd.GetOpenWindowStringToAdd());
            BtnImport.Attributes.Add("onclick", ModalKeywordImport.GetOpenWindowString());
        }
Exemplo n.º 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete") && Body.IsQueryExists("KeywordID"))
            {
                var keywordId = Body.GetQueryInt("KeywordID");
                try
                {
                    DataProvider.KeywordDao.Delete(keywordId);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            spContents.ControlToPaginate = rptContents;
            spContents.SelectCommand     = DataProvider.KeywordDao.GetSelectCommand();
            rptContents.ItemDataBound   += rptContents_ItemDataBound;
            spContents.SortField         = "KeywordID";
            spContents.SortMode          = SortMode.DESC; //排序
            spContents.ItemsPerPage      = 20;

            if (!IsPostBack)
            {
                BreadCrumbSettings(AppManager.Settings.LeftMenu.Config, "敏感词管理", AppManager.Settings.Permission.SettingsConfig);

                spContents.DataBind();
                btnAdd.Attributes.Add("onclick", ModalKeywordAdd.GetOpenWindowStringToAdd());
                btnImport.Attributes.Add("onclick", ModalKeywordImport.GetOpenWindowString());
            }
        }