示例#1
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel("plugin_forum_topic", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.Forum_Topic   bll   = new BLL.Forum_Topic();
            Model.Forum_Topic model = bll.GetModel(id);

            switch (e.CommandName)
            {
            case "lbtnIsBan":
                if (model.Ban == 1)
                {
                    bll.UpdateField(id, "[Ban]=0");
                }
                else
                {
                    bll.UpdateField(id, "[Ban]=1");
                }
                break;

            case "lbtnIsTop":
                if (model.Top == 1)
                {
                    bll.UpdateField(id, "[Top]=0");
                }
                else
                {
                    bll.UpdateField(id, "[Top]=1");
                }
                break;

            case "lbtnDigest":
                if (model.Digest == 1)
                {
                    bll.UpdateField(id, "[Digest]=0");
                }
                else
                {
                    bll.UpdateField(id, "[Digest]=1");
                }
                break;

            case "lbtnClose":
                if (model.Close == 1)
                {
                    bll.UpdateField(id, "[Close]=0");
                }
                else
                {
                    bll.UpdateField(id, "[Close]=1");
                }
                break;
            }

            this.RptBind(" 1=1 " + CombSqlTxt(keywords), " id desc ");//添加where子句和order子句
        }
示例#2
0
        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            topic_id = DTRequest.GetQueryInt("topic_id", 0);
            page     = DTRequest.GetQueryInt("page", 1);

            if (page < 0)
            {
                page = 900000;
            }

            if (topic_id != 0)
            {
                BLL.Forum_Topic bllTopic = new BLL.Forum_Topic();


                modelTopic = bllTopic.GetModel(topic_id);

                if (modelTopic == null)
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("我的天,贴子没啦!")));

                    return;

                    //modelTopic = new Model.Forum_Topic();
                }

                int _groupId = 0;

                if (modelUserExtended != null)
                {
                    _groupId = modelUserExtended.GroupId;
                }

                if (!BLL.Forum_BoardPermission.CheckPermission(modelTopic.BoardId + "|" + _groupId, "VisitTopic"))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("不好意思,目前您还没有权限进入!")));
                    return;
                }


                bool bolViewCount = false;

                //禁止过于频繁的过度刷新
                if (HttpContext.Current.Session["SESSION_FORUM_TOPIC"] == null)
                {
                    HttpContext.Current.Session["SESSION_FORUM_TOPIC"] = topic_id;

                    bolViewCount = true;
                }
                else if (Convert.ToInt32(HttpContext.Current.Session["SESSION_FORUM_TOPIC"]) != topic_id)
                {
                    bolViewCount = true;
                }

                if (bolViewCount)
                {
                    bllTopic.UpdateField(topic_id, "ViewCount=ViewCount+1");
                }

                board_id = modelTopic.BoardId;
            }

            modelBoard = new BLL.Forum_Board().GetModel(board_id);

            if (modelBoard == null)
            {
                modelBoard = new Model.Forum_Board();
            }

            drPostList = new BLL.Forum_Post(modelTopic.PostSubTable).GetList(20, page, "", topic_id, "id asc", out totalcount).Tables[0].Select(" 1=1 ", "id asc");

            pagelist = OutPageList(20, page, totalcount, linkurl("forum_topic", topic_id, "__id__"), 10);

            //权限
            bolOperate = CheckOperate(board_id);
        }