Ejemplo n.º 1
0
        public static int MoveTopics(string topiclist, int fid, int oldfid, bool savelink, int topicType)
        {
            if (!Utils.IsNumericList(topiclist))
            {
                return(-1);
            }
            string text = "";
            //DataTable topicList = Topics.GetTopicList(topiclist);
            //foreach (DataRow dataRow in topicList.Rows)
            //{
            //	if (TypeConverter.ObjectToInt(dataRow["closed"]) <= 1 || TypeConverter.ObjectToInt(dataRow["fid"]) != oldfid)
            //	{
            //		text = text + dataRow["tid"].ToString() + ",";
            //	}
            //}
            var topicList = Topic.FindAllByTidsAndDisplayOrder(topiclist, -10);

            foreach (var tp in topicList)
            {
                if (tp.Closed <= 1 || tp.Fid != oldfid)
                {
                    text = text + tp.Fid + ",";
                }
            }
            text = text.TrimEnd(',');
            if (string.IsNullOrEmpty(text))
            {
                return(-1);
            }

            //BBX.Data.TopicAdmins.DeleteClosedTopics(fid, text);
            Topic.DeleteClosedTopics(fid, text);
            TopicAdmins.MoveTopics(text, fid, oldfid, topicType);
            if (savelink)
            {
                //if (BBX.Data.TopicAdmins.CopyTopicLink(oldfid, text) <= 0)
                //if (DatabaseProvider.GetInstance().CopyTopicLink(oldfid, text) <= 0)
                //{
                //    return -2;
                //}
                // 复制帖子链接
                foreach (var tp in topicList)
                {
                    tp.Fid    = oldfid;
                    tp.Closed = tp.ID;
                    tp.ID     = 0;
                }
                topicList.Insert();
                //AdminForumStats.ReSetFourmTopicAPost(oldfid);
                //XForum.SetRealCurrentTopics(oldfid);
                var f = XForum.FindByID(oldfid);
                f.ResetLastPost();
            }
            return(1);
        }
Ejemplo n.º 2
0
        //public static bool UpdateTopicAllInfo(TopicInfo topicinfo)
        //{
        //	bool result;
        //	try
        //	{
        //		Topics.UpdateTopic(topicinfo);
        //		result = true;
        //	}
        //	catch
        //	{
        //		result = false;
        //	}
        //	return result;
        //}

        //public static bool DeleteTopicByTid(int tid)
        //{
        //	return BBX.Data.Posts.DeleteTopicByTid(tid, TableList.CurrentTableName);
        //}

        //public static bool SetTypeid(string topiclist, int value)
        //{
        //    return BBX.Data.Topics.SetTypeid(topiclist, value);
        //}

        //public static DataSet AdminGetPostList(int tid, int pagesize, int pageindex)
        //{
        //    DataSet dataSet = BBX.Data.Posts.GetPosts(tid, pagesize, pageindex, TableList.GetPostTableId(tid));
        //    if (dataSet == null)
        //    {
        //        dataSet = new DataSet();
        //        dataSet.Tables.Add("post");
        //        dataSet.Tables.Add();
        //        return dataSet;
        //    }
        //    dataSet.Tables[0].TableName = "post";
        //    foreach (DataRow dataRow in dataSet.Tables[0].Rows)
        //    {
        //        if (dataRow["attachment"].ToString().Equals("1"))
        //        {
        //            dataRow["attachment"] = Attachment.FindCountByPid(dataRow["pid"].ToInt(0));
        //        }
        //    }
        //    return dataSet;
        //}

        public static void BatchMoveTopics(string tidList, int targetForumId, int adminUid, string adminUserName, int adminUserGroupId, string adminUserGroupTitle, string adminIp)
        {
            //foreach (DataRow dataRow in BBX.Data.Topics.GetTopicFidByTid(tidList).Rows)
            //{
            //    string text = "0";
            //    foreach (DataRow dataRow2 in BBX.Data.Topics.GetTopicTidByFid(tidList, int.Parse(dataRow["fid"].ToString())).Rows)
            //    {
            //        text = text + "," + dataRow2["tid"].ToString();
            //    }
            //    TopicAdmins.MoveTopics(text, targetForumId, (int)Convert.ToInt16(dataRow["fid"].ToString()), 0);
            //}
            var list = Topic.FindAllByIDs(tidList);

            foreach (var tp in list)
            {
                //tp.Fid = targetForumId;
                //tp.TypeID = 0;
                //tp.Save();
                TopicAdmins.MoveTopics(tp.ID + "", targetForumId, tp.Fid, 0);
            }
            AdminVisitLog.InsertLog(adminUid, adminUserName, adminUserGroupId, adminUserGroupTitle, adminIp, "批量移动主题", "主题ID:" + tidList + " <br />目标论坛fid:" + targetForumId);
        }