Ejemplo n.º 1
0
        /// <summary>
        ///  获取附件,目前作用于帖子列表中
        /// </summary>
        /// <returns></returns>
        public DataTable get_attachment_list(int _userId, int _boardId, int _topicId, int _postId)
        {
            DataTable dt = new DataTable();

            dt = new BLL.Forum_Attachment().GetList(" [UserId]=" + _userId + " and  [BoardId]=" + _boardId + " and [TopicId]=" + _topicId + " and  [PostId]=" + _postId + " ").Tables[0];

            return(dt);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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));
        }