Exemplo n.º 1
0
        /// <summary>
        /// 移动主题
        /// </summary>
        public void SetMove(string tids, int board_id, int tobid)
        {
            Model.Forum_Board modelBoard   = new BLL.Forum_Board().GetModel(board_id);
            Model.Forum_Board modelToBoard = new BLL.Forum_Board().GetModel(tobid);

            string strIds   = "0" + modelBoard.ClassList + "0";
            string strToIds = "0" + modelToBoard.ClassList + "0";

            System.Data.DataTable dt = GetList("id in (" + tids + ")").Tables[0];

            string strSql = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                strSql += "UPDATE [" + siteConfig.sysdatabaseprefix + "Forum_Board] SET [TopicCount] = [TopicCount]-1 ,[PostCount] = [PostCount]-" + dt.Rows[i]["ReplayCount"].ToString() + " WHERE  [TopicCount]>0 and [Id] in ( " + strIds + ");";
                strSql += "UPDATE [" + siteConfig.sysdatabaseprefix + "Forum_Board] SET [TopicCount] = [TopicCount]+1 ,[PostCount] = [PostCount]+" + dt.Rows[i]["ReplayCount"].ToString() + " WHERE  [Id] in ( " + strToIds + ");";
            }

            new BLL.Forum_Topic().UpdateField("id in (" + tids + ")", "[BoardId]=" + tobid);

            if (!string.IsNullOrEmpty(strSql))
            {
                DbHelperSQL.ExecuteSql(strSql);
            }
        }
Exemplo n.º 2
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("plugin_forum", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.Forum_Board bll = new BLL.Forum_Board();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("board_list.aspx", "keywords={0}", this.keywords));
        }
Exemplo n.º 3
0
        private void RptBind()
        {
            BLL.Forum_Board bll = new BLL.Forum_Board();
            DataTable       dt  = bll.GetAllList(0);

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除回贴,标题统计,版块统计,积分一并处理,有附件的一并处理
        /// </summary>
        public void DeleterReply(string rids, int topic_id)
        {
            Model.Forum_Topic modelTopic = GetModel(topic_id);

            System.Data.DataTable dt = new BLL.Forum_Post(modelTopic.PostSubTable).GetList(" id in (" + rids + ") ").Tables[0];

            //获得实际积分
            int _point = new BLL.Forum_BoardActionPoint().GetRealPoint(modelTopic.BoardId, 6);

            BLL.Forum_Attachment bllAtt = new Forum_Attachment();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                new Forum_UserExtended().UpdateField(Convert.ToInt32(dt.Rows[i]["PostUserId"]), " PostCount=PostCount-1 , Credit=Credit+" + _point);

                //附件处理

                if (Convert.ToInt32(dt.Rows[i]["Attachment"]) != 0)
                {
                    List <Model.Forum_Attachment> dtAtt = bllAtt.GetModelList(" PostId=" + dt.Rows[i]["id"].ToString());

                    foreach (Model.Forum_Attachment item in dtAtt)
                    {
                        bllAtt.Delete(item, item.Id);
                    }
                }
            }

            string strSql = "DELETE [" + siteConfig.sysdatabaseprefix + "Forum_Post_" + modelTopic.PostSubTable + "]  WHERE ID in (" + rids + ")";

            //影响记录数相当于删了多少条数据
            int _count = 0;

            if (!string.IsNullOrEmpty(strSql))
            {
                _count = DbHelperSQL.ExecuteSql(strSql);
            }

            modelTopic.ReplayCount = modelTopic.ReplayCount - _count;

            Update(modelTopic);

            //版块包括父级版块的统计

            string strValue = "[PostCount]=[PostCount]-" + _count + "";

            Model.Forum_Board modelBoard = new BLL.Forum_Board().GetModel(modelTopic.BoardId);

            new Forum_Board().UpdateField(" Id in (0" + modelBoard.ClassList + "0) ", strValue);

            new Forum_PostId().DeleteList(rids);

            new Forum_PostSubTable().UpdateField(modelTopic.PostSubTable, " PostCount=PostCount-" + _count);
        }
Exemplo n.º 5
0
        private void ShowInfo(int _id)
        {
            BLL.Forum_Board   bll   = new BLL.Forum_Board();
            Model.Forum_Board model = bll.GetModel(_id);
            //编写赋值操作Begin

            txtIcon.Text        = model.Icon;
            txtRule.Text        = model.Rule;
            txtDescription.Text = model.Description;
            txtChildCol.Text    = model.ChildCol.ToString();

            ddlParentId.SelectedValue = model.ParentId.ToString();
            rblShow.SelectedValue     = model.Show.ToString();
            txtUrl.Text    = model.Url;
            txtSortId.Text = model.SortId.ToString();
            txtName.Text   = model.Name;


            //编写赋值操作End
        }
Exemplo n.º 6
0
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("plugin_forum", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.Forum_Board bll     = new BLL.Forum_Board();
            Repeater        rptList = new Repeater();

            rptList = this.rptList;
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;
                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "sortId=" + sortId.ToString());
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存论坛版块排序"); //记录日志
            JscriptMsg("保存排序成功!", Utils.CombUrlTxt("board_list.aspx", "keywords={0}", this.keywords));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 内部标题表的统计、版块的回贴统计及最后回贴人,积分,回贴归属
        /// </summary>
        public void Add(Model.Forum_Topic modelTopic, Model.Forum_Post modelPost)
        {
            modelTopic.LastPostUserId   = modelPost.PostUserId;
            modelTopic.LastPostNickname = modelPost.PostNickname;
            modelTopic.LastPostUsername = modelPost.PostUsername;
            modelTopic.LastPostDatetime = System.DateTime.Now;
            modelTopic.ReplayCount      = modelTopic.ReplayCount + 1;

            //主题与回贴不是同一人才记录入回复记录表
            if (modelTopic.PostUserId != modelPost.PostUserId)
            {
                //回贴归属
                new Forum_MyPost().Add(new Model.Forum_MyPost {
                    TopicId = modelTopic.Id, UserId = modelPost.PostUserId, PostId = modelPost.Id
                });
            }

            //更新主题
            new Forum_Topic().Update(modelTopic);

            //版块统计
            Model.Forum_Board modelBoard = new BLL.Forum_Board().GetModel(modelTopic.BoardId);

            string strIds = "0" + modelBoard.ClassList + "0";

            string strSql = "UPDATE [" + siteConfig.sysdatabaseprefix + "Forum_Board] SET  [PostCount]=[PostCount]+1  WHERE Id in (" + strIds + ")";

            DbHelperSQL.ExecuteSql(strSql);

            dal.Add(modelPost);

            //除了标题贴
            if (modelPost.First == 0)
            {
                //获得实际积分
                int _point = new BLL.Forum_BoardActionPoint().GetRealPoint(modelTopic.BoardId, 2);
                new Forum_UserExtended().UpdateField(modelPost.PostUserId, " PostCount=PostCount+1 ,Credit=Credit+" + _point);
                new BLL.Forum_PostSubTable().UpdateField(modelTopic.PostSubTable, " PostCount=PostCount+1 ");
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 路径地址
        /// </summary>
        /// <returns></returns>
        public string get_location(int board_id = 0, int topic_id = 0, string title = "", string action = "")
        {
            StringBuilder str = new StringBuilder();

            str.Append("<a href='" + linkurl("forum_index", "index") + "' class='home'> 官方论坛</a>");

            if (board_id == 0 && Request.QueryString["keys"] != null)
            {
                str.Append("<span class='separator'>&gt;</span><a href='#'>搜索结果</a>");

                return(str.ToString());
            }


            //取所有版块
            System.Data.DataTable dt = new BLL.Forum_Board().GetList("1=1").Tables[0];

            System.Data.DataRow[] drs = dt.Select("Id=" + board_id);

            string[] ids = drs[0]["ClassList"].ToString().Split(',');

            for (int i = 0; i < ids.Length; i++)
            {
                if (!string.IsNullOrEmpty(ids[i]))
                {
                    System.Data.DataRow[] _dr = dt.Select("Id=" + ids[i]);

                    str.Append("<span class='separator'>&gt;</span><a href='" + linkurl("forum_board", _dr[0]["Id"]) + "'>" + _dr[0]["Name"] + "</a>");
                }
            }

            if (topic_id != 0)
            {
                str.Append("<span class='separator'>&gt;</span><a href='" + linkurl("forum_topic", topic_id) + "'>" + title + "</a>");
            }

            if (!string.IsNullOrEmpty(action))
            {
                string actionTxt = "";

                switch (action)
                {
                //新主题
                case "create":

                    actionTxt = "新主题";

                    break;

                //编主题
                case "update":

                    actionTxt = "编辑主题";

                    break;

                //新回复
                case "reply":

                    actionTxt = "写回复";

                    break;

                //编回复
                case "editor":

                    actionTxt = "编辑回复";

                    break;
                }

                str.Append("<span class='separator'>&gt;</span><a href='#'>" + actionTxt + "</a>");
            }

            return(str.ToString());
        }
Exemplo n.º 9
0
        /// <summary>
        /// 内部 删除一条数据及主题的回贴并重新统计版块的主题总数,积分,我的主题,我的回复一起清除
        /// </summary>
        public bool Delete(int Id)
        {
            Model.Forum_Topic model = GetModel(Id);

            //--删除回复----------------------------------

            System.Data.DataTable dt = new BLL.Forum_Post(model.PostSubTable).GetList(9999999, " TopicId=" + Id + " ", " id asc ").Tables[0];

            //获得实际积分,调整,删除主题不牵联其它已经回复者的积分
            //int _point = new BLL.Forum_BoardActionPoint().GetRealPoint(model.BoardId, 6);

            BLL.Forum_Attachment bllAtt = new Forum_Attachment();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (Convert.ToInt32(dt.Rows[i]["First"].ToString()) == 0)
                {
                    new Forum_UserExtended().UpdateField(Convert.ToInt32(dt.Rows[i]["PostUserId"]), " PostCount=PostCount-1 ");
                }

                //附件处理

                if (Convert.ToInt32(dt.Rows[i]["Attachment"]) != 0)
                {
                    List <Model.Forum_Attachment> dtAtt = bllAtt.GetModelList(" PostId=" + dt.Rows[i]["id"].ToString());

                    foreach (Model.Forum_Attachment item in dtAtt)
                    {
                        bllAtt.Delete(item, item.Id);
                    }
                }
            }

            //------------------------------------

            new BLL.Forum_Post(model.PostSubTable).DeleteTopicId(Id);

            //版块包括父级版块的统计

            string strValue = "[TopicCount]=[TopicCount]-1,[PostCount]=[PostCount]-" + model.ReplayCount;

            Model.Forum_Board modelBoard = new BLL.Forum_Board().GetModel(model.BoardId);

            string strIds = "0" + modelBoard.ClassList + "0";

            new Forum_Board().UpdateField(" Id in (" + strIds + ") ", strValue);

            new Forum_PostSubTable().UpdateField(model.PostSubTable, " TopicCount=TopicCount-1,PostCount=PostCount-" + model.ReplayCount);

            //获得实际积分
            int _point = new BLL.Forum_BoardActionPoint().GetRealPoint(model.BoardId, 5);

            new Forum_UserExtended().UpdateField(model.PostUserId, " TopicCount=TopicCount-1, Credit=Credit+" + _point);

            //--主题清空随之 我的主题,我的回复一起清除----------------------------------
            new BLL.Forum_MyTopic().Delete("TopicId=" + Id);

            new BLL.Forum_MyPost().Delete("TopicId=" + Id);

            return(dal.Delete(Id));
        }