Ejemplo n.º 1
0
        private void ShowInfo(int _id)
        {
            BLL.Forum_Topic   bll   = new BLL.Forum_Topic();
            Model.Forum_Topic model = bll.GetModel(_id);
            //编写赋值操作Begin

            txtUserId.Text           = model.PostUserId.ToString();
            ddlBoardId.SelectedValue = model.BoardId.ToString();
            txtTopicTypeId.Text      = model.TopicTypeId.ToString();
            txtTitle.Text            = model.Title;
            txtViewCount.Text        = model.ViewCount.ToString();
            txtPostDatetime.Text     = model.PostDatetime.ToString();

            if (model.Digest == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.Top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.Ban == 1)
            {
                cblItem.Items[2].Selected = true;
            }

            rblClose.SelectedValue = model.Close.ToString();

            modelPost = new BLL.Forum_Post(model.PostSubTable).GetModel(" First=1 and TopicId=" + _id + " ");

            txtMessage.Text = modelPost.Message;

            //编写赋值操作End
        }
Ejemplo n.º 2
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子句
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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


            //编写编辑操作Begin

            model.BoardId = Convert.ToInt32(ddlBoardId.SelectedValue);
            //model.TopicTypeId = txtTopicTypeId.Text;
            model.Title        = txtTitle.Text;
            model.PostDatetime = Convert.ToDateTime(txtPostDatetime.Text);


            model.Digest = 0;
            model.Top    = 0;
            model.Ban    = 0;
            model.Close  = 0;

            if (cblItem.Items[0].Selected)
            {
                model.Digest = 1;
            }
            if (cblItem.Items[1].Selected)
            {
                model.Top = 1;
            }
            if (cblItem.Items[2].Selected)
            {
                model.Ban = 1;
            }

            if (rblClose.SelectedValue == "1")
            {
                model.Close = 1;
            }

            model.Message = txtMessage.Text;

            modelPost         = new BLL.Forum_Post(model.PostSubTable).GetModel(" First=1 and TopicId=" + _id + " ");
            modelPost.Message = txtMessage.Text;


            //编写编辑操作End

            model.PostUserId   = modelUser.id;
            model.PostUsername = modelUser.user_name;
            model.PostNickname = modelUser.nick_name;

            modelPost.PostUserId   = modelUser.id;
            modelPost.PostUsername = modelUser.user_name;
            modelPost.PostNickname = modelUser.nick_name;

            if (bll.Update(model, modelPost))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.Title); //记录日志
                result = true;
            }

            return(result);
        }