• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Entity.PostInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Discuz.Entity.PostInfo的典型用法代码示例。如果您正苦于以下问题:C# PostInfo类的具体用法?C# PostInfo怎么用?C# PostInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PostInfo类属于Discuz.Entity命名空间,在下文中一共展示了PostInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetLastPostByTid

 public static PostInfo GetLastPostByTid(int tid, string tableName)
 {
     PostInfo postinfo = new PostInfo();
     DataTable dt = DatabaseProvider.GetInstance().GetLastPostByTid(tid, tableName);
     if (dt.Rows.Count > 0)
     {
         postinfo.Pid = TypeConverter.ObjectToInt(dt.Rows[0]["pid"]);
         postinfo.Tid = TypeConverter.ObjectToInt(dt.Rows[0]["tid"]);
         postinfo.Title = dt.Rows[0]["title"].ToString().Trim();
         postinfo.Postdatetime = dt.Rows[0]["postdatetime"].ToString().Trim();
         postinfo.Poster = dt.Rows[0]["poster"].ToString().Trim();
         postinfo.Posterid = TypeConverter.ObjectToInt(dt.Rows[0]["posterid"]);
         postinfo.Topictitle = Topics.GetTopicInfo(postinfo.Tid, 0, 0).Title;
     }
     else
     {
         postinfo.Pid = 0;
         postinfo.Tid = 0;
         postinfo.Title = "从未";
         postinfo.Topictitle = "从未";
         postinfo.Postdatetime = "1900-1-1";
         postinfo.Poster = "";
         postinfo.Posterid = 0;
     }
     dt.Dispose();
     return postinfo;
 }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:27,代码来源:Posts.cs


示例2: CreatePost

        /// <summary>
        /// 创建帖子
        /// </summary>
        /// <param name="postInfo">帖子信息</param>
        /// <param name="postTableId">分表ID</param>
        /// <returns>帖子ID</returns>
        public static int CreatePost(PostInfo postInfo, string postTableId)
        {            
            int postId = DatabaseProvider.GetInstance().CreatePost(postInfo, postTableId);
            //更新TTCache缓存中的用户信息
            if (postInfo.Invisible == 0 && Users.appDBCache && Users.IUserService != null)
            {
                UserInfo userInfo = Users.IUserService.GetUserInfo(postInfo.Posterid);
                if (userInfo != null)
                {
                    userInfo.Lastpost = postInfo.Postdatetime;
                    userInfo.Lastpostid = postId;
                    userInfo.Lastposttitle = postInfo.Title;
                    userInfo.Posts = userInfo.Posts + 1;
                    userInfo.Lastactivity = DateTime.Now.ToString();
                    userInfo.Newpm = 1;
                    Users.IUserService.UpdateUser(userInfo);
                }
            }

            //更新Cache缓存中的用户信息
            if (postInfo.Invisible == 0 && Topics.appDBCache && Topics.ITopicService != null)
                Topics.ITopicService.ResetTopicByTid(postInfo.Tid);

            //创建Cache缓存中的帖子信息(权限于当前正在使用的分表)
            if (appDBCache && IPostService != null && PostTables.GetPostTableId(postInfo.Tid) == postTableId)
            {
                postInfo.Pid = postId;                
                IPostService.CreatePost(postInfo, postTableId);
            }

            return postId;
        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:38,代码来源:Posts.cs


示例3: SendPostReplyNotice

        /// <summary>
        /// 发送回复通知
        /// </summary>
        /// <param name="postinfo">回复信息</param>
        /// <param name="topicinfo">所属主题信息</param>
        /// <param name="replyuserid">回复的某一楼的作者</param>
        public static void SendPostReplyNotice(PostInfo postinfo, TopicInfo topicinfo, int replyuserid)
        {
            NoticeInfo noticeinfo = new NoticeInfo();

            noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 给您回帖, <a href =\"showtopic.aspx?topicid={2}&postid={3}#{3}\">{4}</a>.", postinfo.Posterid, postinfo.Poster, topicinfo.Tid, postinfo.Pid, topicinfo.Title));
            noticeinfo.Type = NoticeType.PostReplyNotice;
            noticeinfo.New = 1;
            noticeinfo.Posterid = postinfo.Posterid;
            noticeinfo.Poster = postinfo.Poster;
            noticeinfo.Postdatetime = Utils.GetDateTime();
            noticeinfo.Fromid = topicinfo.Tid;
            noticeinfo.Uid = replyuserid;

            //当回复人与帖子作者不是同一人时,则向帖子作者发送通知
            if (postinfo.Posterid != replyuserid && replyuserid > 0)
            {
                Notices.CreateNoticeInfo(noticeinfo);
            }

            //当上面通知的用户与该主题作者不同,则还要向主题作者发通知
            if (postinfo.Posterid != topicinfo.Posterid && topicinfo.Posterid != replyuserid && topicinfo.Posterid > 0)
            {
                noticeinfo.Uid = topicinfo.Posterid;
                Notices.CreateNoticeInfo(noticeinfo);
            }
        }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:32,代码来源:Notices.cs


示例4: GetPostInfo

 public static PostInfo GetPostInfo(string postTableId, int pid)
 {
     PostInfo postInfo = new PostInfo();
     IDataReader reader = DatabaseProvider.GetInstance().GetPostInfo(postTableId, pid);
     if (reader.Read())
     {
         postInfo = LoadSinglePostInfo(reader);
         reader.Close();
         return postInfo;
     }
     reader.Close();
     return null;
 }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:13,代码来源:Posts.cs


示例5: OnTopicCreated

        protected override void OnTopicCreated(TopicInfo topic, PostInfo post, AttachmentInfo[] attachs)
        {
            SpacePostInfo spacepost = new SpacePostInfo();
            spacepost.Author = post.Poster;
            string content = Posts.GetPostMessageHTML(post, attachs);
            spacepost.Category = "";
            spacepost.Content = content;
            spacepost.Postdatetime = DateTime.Now;
            spacepost.PostStatus = 1;
            spacepost.PostUpDateTime = DateTime.Now;
            spacepost.Title = post.Title;
            spacepost.Uid = post.Posterid;

            DbProvider.GetInstance().AddSpacePost(spacepost);
        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:15,代码来源:SpacePlugin.cs


示例6: GetPostListFromFile

        /// <summary>
        /// 获得推荐的论坛主题帖对象数组
        /// </summary>
        /// <param name="nodename">节点名称</param>
        /// <returns></returns>
        public PostInfo[] GetPostListFromFile(string nodeName)
        {
            if (postInfos != null)
                return postInfos;

            XmlNodeList xmlnodelist = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/" + nodeName + "/Forum/Topiclist/Topic");
            postInfos = new PostInfo[xmlnodelist.Count];
            int rowcount = 0;

            foreach (XmlNode xmlnode in xmlnodelist)
            {
                postInfos[rowcount] = new PostInfo();
                postInfos[rowcount].Tid = TypeConverter.ObjectToInt(xmlDoc.GetSingleNodeValue(xmlnode, "topicid"));
                postInfos[rowcount].Title = (xmlDoc.GetSingleNodeValue(xmlnode, "title") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "title");
                postInfos[rowcount].Poster = (xmlDoc.GetSingleNodeValue(xmlnode, "poster") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "poster");
                postInfos[rowcount].Posterid = TypeConverter.ObjectToInt(xmlDoc.GetSingleNodeValue(xmlnode, "posterid"));
                postInfos[rowcount].Postdatetime = (xmlDoc.GetSingleNodeValue(xmlnode, "postdatetime") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "postdatetime");
                postInfos[rowcount].Message = (xmlDoc.GetSingleNodeValue(xmlnode, "shortdescription") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "shortdescription");
                postInfos[rowcount].Fid = TypeConverter.ObjectToInt(xmlDoc.GetSingleNodeValue(xmlnode, "fid"));
                postInfos[rowcount].Forumname = (xmlDoc.GetSingleNodeValue(xmlnode, "forumname") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "forumname");
                postInfos[rowcount].ForumRewriteName = (xmlDoc.GetSingleNodeValue(xmlnode, "forumrewritename") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "forumrewritename");
                rowcount++;
            }
            return postInfos;
        }
开发者ID:khaliyo,项目名称:DiscuzNT,代码行数:30,代码来源:ForumAggregationData.cs


示例7: UpdatePost

        /// <summary>
        /// 更新指定帖子信息
        /// </summary>
        /// <param name="postsInfo">帖子信息</param>
        /// <returns>更新数量</returns>
        public static int UpdatePost(PostInfo postInfo)
        {
            if (postInfo == null || postInfo.Pid < 1)
                return 0;

            RemoveShowTopicCache(postInfo.Tid.ToString());
            return Data.Posts.UpdatePost(postInfo, GetPostTableId(postInfo.Tid));
        }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:13,代码来源:Posts.cs


示例8: CreatePost

        /// <summary>
        /// 创建帖子
        /// </summary>
        /// <param name="postInfo">帖子信息类</param>
        /// <returns>返回帖子id</returns>
        public static int CreatePost(PostInfo postInfo)
        {
            int pid = Data.Posts.CreatePost(postInfo, GetPostTableId(postInfo.Tid));

            //本帖具有正反方立场
            if (postInfo.Debateopinion > 0)
            {
                DebatePostExpandInfo dpei = new DebatePostExpandInfo();
                dpei.Tid = postInfo.Tid;
                dpei.Pid = pid;
                dpei.Opinion = postInfo.Debateopinion;
                dpei.Diggs = 0;
                Data.Debates.CreateDebateExpandInfo(dpei);
            }
            RemoveShowTopicCache(postInfo.Tid.ToString());
            return pid;
        }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:22,代码来源:Posts.cs


示例9: ShowPage

        protected override void ShowPage()
        {
            //pagetitle = "编辑帖子";
            #region 判断是否是灌水
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            this.disablepostctrl = 0;
            if (admininfo != null)
                disablepostctrl = admininfo.Disablepostctrl;
            #endregion

            if (userid == -1)
            {
                forum = new ForumInfo();
                topic = new TopicInfo();
                postinfo = new PostInfo();
                AddErrLine("您尚未登录");
                return;
            }

            #region 获取帖子和主题相关信息
            // 如果帖子ID非数字
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            postinfo = Posts.GetPostInfo(topicid, postid);
            // 如果帖子不存在
            if (postinfo == null)
            {
                AddErrLine("不存在的帖子ID");
                return;
            }
            pagetitle = (postinfo.Title == "") ? "编辑帖子" : postinfo.Title;
            htmlon = postinfo.Htmlon;
            message = postinfo.Message;
            isfirstpost = postinfo.Layer == 0;

            // 获取主题ID
            if (topicid != postinfo.Tid || postinfo.Tid == -1)
            {
                AddErrLine("无效的主题ID");
                return;
            }

            // 获取该主题的信息
            topic = Topics.GetTopicInfo(postinfo.Tid);
            // 如果该主题不存在
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }

            if (topic.Special == 1 && postinfo.Layer == 0)
            {
                pollinfo = Polls.GetPollInfo(topic.Tid);
                polloptionlist = Polls.GetPollOptionList(topic.Tid);
            }

            if (topic.Special == 4 && postinfo.Layer == 0)
            {
                debateinfo = Debates.GetDebateTopic(topic.Tid);
            }

            #endregion

            #region 获取并检查版块信息
            ///得到所在版块信息
            forumid = topic.Fid;
            forum = Forums.GetForumInfo(forumid);
            needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepostctrl, usergroupinfo);
            // 如果该版块不存在
            if (forum == null || forum.Layer == 0)
            {
                AddErrLine("版块已不存在");
                forum = new ForumInfo();
                return;
            }

            if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                SetBackLink(base.ShowForumAspxRewrite(forumid, 0));
                return;
            }

            if (forum.Applytopictype == 1)  //启用主题分类
                topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes);
            customeditbuttons = Caches.GetCustomEditButtonList();
            #endregion

            //是否有编辑帖子的权限
            if (!UserAuthority.CanEditPost(postinfo, userid, useradminid, ref msg))
            {
                AddErrLine(msg);
                return;
            }
            #region  附件信息绑定
//.........这里部分代码省略.........
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:101,代码来源:editpost.aspx.cs


示例10: UpdateLastPost

 public void UpdateLastPost(ForumInfo forumInfo, PostInfo postInfo)
 {
     UpdateLastPost(postInfo.Tid, postInfo.Topictitle, postInfo.Postdatetime.ToString(), postInfo.Posterid, postInfo.Poster, forumInfo.Fid, forumInfo.Parentidlist);
 }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:4,代码来源:ForumManage.cs


示例11: GetPostMessageHTML

        /// <summary>
        /// 得到空间格式的帖子内容
        /// </summary>
        /// <param name="postinfo">帖子描述</param>
        /// <param name="attArray">附件集合</param>
        /// <returns>空间格式</returns>
        public static string GetPostMessageHTML(PostInfo postInfo, AttachmentInfo[] attachmentArray)
        {
            string message = "";
            PostpramsInfo postpramsInfo = new PostpramsInfo();
            //处理帖子内容
            postpramsInfo.Smileyoff = postInfo.Smileyoff;
            postpramsInfo.Bbcodeoff = postInfo.Bbcodeoff;
            postpramsInfo.Parseurloff = postInfo.Parseurloff;
            postpramsInfo.Allowhtml = postInfo.Htmlon;
            postpramsInfo.Sdetail = postInfo.Message;
            postpramsInfo.Showimages = 1 - postInfo.Smileyoff;
            postpramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Pid = postInfo.Pid;
            //强制隐藏hide内容
            postpramsInfo.Hide = 1;
            //设定这是为个人空间进行的解析
            postpramsInfo.Isforspace = 1;

            //先简单判断是否是动网兼容模式
            if (!postpramsInfo.Ubbmode)
                message = UBB.UBBToHTML(postpramsInfo);
            else
                message = Utils.HtmlEncode(postInfo.Message);

            if (postpramsInfo.Jammer == 1)
                message = ForumUtils.AddJammer(postInfo.Message);

            if (postInfo.Attachment > 0 || regexAttach.IsMatch(message) || regexAttachImg.IsMatch(message))
            {
                //获取在[hide]标签中的附件id
                string[] attHidArray = GetHiddenAttachIdList(postpramsInfo.Sdetail, postpramsInfo.Hide);

                ShowtopicPagePostInfo info = new ShowtopicPagePostInfo();
                info.Posterid = postInfo.Posterid;
                info.Pid = postInfo.Pid;

                for (int i = 0; i < attachmentArray.Length; i++)
                {
                    ShowtopicPageAttachmentInfo sAtt = new ShowtopicPageAttachmentInfo();
                    sAtt.Aid = attachmentArray[i].Aid;
                    sAtt.Attachment = attachmentArray[i].Attachment;
                    sAtt.Description = attachmentArray[i].Description;
                    sAtt.Downloads = attachmentArray[i].Downloads;
                    sAtt.Filename = attachmentArray[i].Filename;
                    sAtt.Filesize = attachmentArray[i].Filesize;
                    sAtt.Filetype = attachmentArray[i].Filetype;
                    sAtt.Pid = attachmentArray[i].Pid;
                    sAtt.Postdatetime = attachmentArray[i].Postdatetime;
                    sAtt.Readperm = attachmentArray[i].Readperm;
                    sAtt.Sys_index = attachmentArray[i].Sys_index;
                    sAtt.Sys_noupload = attachmentArray[i].Sys_noupload;
                    sAtt.Tid = attachmentArray[i].Tid;
                    sAtt.Uid = attachmentArray[i].Uid;
                    message = Attachments.GetMessageWithAttachInfo(postpramsInfo, 1, attHidArray, info, sAtt, message);
                }
            }
            return message;
        }
开发者ID:WySky,项目名称:Memo-Project,代码行数:65,代码来源:Posts.cs


示例12: CreatePost

        /// <summary>
        /// 创建帖子
        /// </summary>
        /// <param name="postInfo">帖子信息类</param>
        /// <returns>返回帖子id</returns>
        public static int CreatePost(PostInfo postInfo)
        {
            int pid = 0;
            lock (lockHelper)
            {
                pid = Data.Posts.CreatePost(postInfo, GetPostTableId(postInfo.Tid));
            }
            //本帖具有正反方立场
            if (postInfo.Debateopinion > 0)
            {
                DebatePostExpandInfo dpei = new DebatePostExpandInfo();
                dpei.Tid = postInfo.Tid;
                dpei.Pid = pid;
                dpei.Opinion = postInfo.Debateopinion;
                dpei.Diggs = 0;
                Data.Debates.CreateDebateExpandInfo(dpei);
            }

            //将数据同步到sphinx增量表中
            if (pid > 0 && EntLibConfigs.GetConfig() != null && EntLibConfigs.GetConfig().Sphinxconfig.Enable)
            {
                GetSphinxSqlService().CreatePost(GetPostTableName(), pid, postInfo.Tid, postInfo.Fid, postInfo.Posterid, postInfo.Postdatetime, postInfo.Title, postInfo.Message);
            }
            return pid;
        }
开发者ID:WySky,项目名称:Memo-Project,代码行数:30,代码来源:Posts.cs


示例13: LoadSinglePostInfo

 /// <summary>
 /// 装帖子信息
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 private static PostInfo LoadSinglePostInfo(IDataReader reader)
 {
     PostInfo postInfo = new PostInfo();
     postInfo.Pid = TypeConverter.ObjectToInt(reader["pid"]);
     postInfo.Fid = TypeConverter.ObjectToInt(reader["fid"]);
     postInfo.Tid = TypeConverter.ObjectToInt(reader["tid"]);
     postInfo.Parentid = TypeConverter.ObjectToInt(reader["parentid"]);
     postInfo.Layer = TypeConverter.ObjectToInt(reader["layer"]);
     postInfo.Poster = reader["poster"].ToString();
     postInfo.Posterid = TypeConverter.ObjectToInt(reader["posterid"]);
     postInfo.Title = reader["title"].ToString();
     postInfo.Postdatetime = reader["postdatetime"].ToString();
     postInfo.Message = reader["message"].ToString();
     postInfo.Ip = reader["ip"].ToString();
     postInfo.Lastedit = reader["lastedit"].ToString();
     postInfo.Invisible = TypeConverter.ObjectToInt(reader["invisible"]);
     postInfo.Usesig = TypeConverter.ObjectToInt(reader["usesig"]);
     postInfo.Htmlon = TypeConverter.ObjectToInt(reader["htmlon"]);
     postInfo.Smileyoff = TypeConverter.ObjectToInt(reader["smileyoff"]);
     postInfo.Bbcodeoff = TypeConverter.ObjectToInt(reader["bbcodeoff"]);
     postInfo.Parseurloff = TypeConverter.ObjectToInt(reader["parseurloff"]);
     postInfo.Attachment = TypeConverter.ObjectToInt(reader["attachment"]);
     postInfo.Rate = TypeConverter.ObjectToInt(reader["rate"]);
     postInfo.Ratetimes = TypeConverter.ObjectToInt(reader["ratetimes"]);
     return postInfo;
 }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:31,代码来源:Posts.cs


示例14: ShowPage

        protected override void ShowPage()
        {
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            // 获取该帖子的信息
            post = Posts.GetPostInfo(topicid, postid);
            if (post == null)
            {
                AddErrLine("不存在的帖子ID");
                return;
            }
            // 获取该主题的信息
            topic = Topics.GetTopicInfo(topicid);
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }
            if (topicid != post.Tid)
            {
                AddErrLine("主题ID无效");
                return;
            }

            topictitle = topic.Title;
            forumid = topic.Fid;
            forum = Forums.GetForumInfo(forumid);
            forumname = forum.Name;
            pagetitle = string.Format("删除{0}", post.Title);
            forumnav = ShowForumAspxRewrite(forum.Pathlist.Trim(), forumid, forumpageid);

            if (!CheckPermission(post,DNTRequest.GetInt("opinion", -1)))  return;

            if (!allowDelPost)
            {
                AddErrLine("当前不允许删帖");
                return;
            }

            // 通过验证的用户可以删除帖子,如果是主题帖则另处理
            if (post.Layer == 0)
            {
                TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false);
                //重新统计论坛帖数
                Forums.SetRealCurrentTopics(forum.Fid);
                ForumTags.DeleteTopicTags(topicid);
            }
            else
            {
                int reval;
                if (topic.Special == 4)
                {
                    if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2)
                    {
                        AddErrLine("参数错误");
                        return;
                    }
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);
                    Debates.DeleteDebatePost(topicid, DNTRequest.GetInt("opinion", -1), postid);
                }
                else
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);

                Posts.RemoveShowTopicCache(topicid.ToString());

                // 删除主题游客缓存
                ForumUtils.DeleteTopicCacheFile(topicid);
                //再次确保回复数精确
                Topics.UpdateTopicReplyCount(topic.Tid);
                //更新指定版块的最新发帖数信息
                Forums.UpdateLastPost(forum);

                if (reval > 0 && Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24) < 0)
                    UserCredits.UpdateUserCreditsByPosts(post.Posterid, -1);
            }

            SetUrl(post.Layer == 0 ? base.ShowForumAspxRewrite(post.Fid, 0) : Urls.ShowTopicAspxRewrite(post.Tid, 1));
            SetMetaRefresh();
            SetShowBackLink(false);
            AddMsgLine("删除帖子成功, 返回主题");
        }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:85,代码来源:delpost.aspx.cs


示例15: GetTopicPostInfo

        /// <summary>
        /// 通过主题ID得到主帖内容,此方法可继续扩展
        /// </summary>
        /// <param name="tid"></param>
        /// <returns>ShowtopicPagePostInfo</returns>
        public static PostInfo GetTopicPostInfo(int tid)
        {
            PostInfo postInfo = new PostInfo();
            IDataReader reader = DatabaseProvider.GetInstance().GetSinglePost(tid, PostTables.GetPostTableId(tid));

            if (reader.Read())
            {
                postInfo = LoadSinglePostInfo(reader);
            }

            reader.Close();
            return postInfo;

        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:19,代码来源:Posts.cs


示例16: UpdateLastPost

        /// <summary>
        /// 更新指定版块的最新发帖数信息
        /// </summary>
        /// <param name="foruminfo"></param>
        public static void UpdateLastPost(ForumInfo foruminfo)
        {
            PostInfo postinfo = new PostInfo();

            int tid = DatabaseProvider.GetInstance().GetLastPostTid(foruminfo, Forums.GetVisibleForum());
            if (tid > 0)
            {
                DataTable dt = Posts.GetLastPostByTid(tid);
                if (dt.Rows.Count > 0)
                {
                    postinfo.Pid = Convert.ToInt32(dt.Rows[0]["pid"].ToString());
                    postinfo.Tid = Convert.ToInt32(dt.Rows[0]["tid"].ToString());
                    postinfo.Title = dt.Rows[0]["title"].ToString().Trim();
                    postinfo.Postdatetime = dt.Rows[0]["postdatetime"].ToString().Trim();
                    postinfo.Poster = dt.Rows[0]["poster"].ToString().Trim();
                    postinfo.Posterid = Convert.ToInt32(dt.Rows[0]["posterid"].ToString());
                    postinfo.Topictitle = Topics.GetTopicInfo(postinfo.Tid).Title;
                }
                else
                {
                    postinfo.Pid = 0;
                    postinfo.Tid = 0;
                    postinfo.Title = "从未";
                    postinfo.Topictitle = "从未";
                    postinfo.Postdatetime = "1900-1-1";
                    postinfo.Poster = "";
                    postinfo.Posterid = 0;
                }
                dt.Dispose();
            }
            else
            {
                postinfo.Pid = 0;
                postinfo.Tid = 0;
                postinfo.Title = "从未";
                postinfo.Topictitle = "从未";
                postinfo.Postdatetime = "1900-1-1";
                postinfo.Poster = "";
                postinfo.Posterid = 0;
            }

            DatabaseProvider.GetInstance().UpdateLastPost(foruminfo, postinfo);

            if (foruminfo.Layer > 0) //递归调用并更新相应父版块信息
            {
                foruminfo = Forums.GetForumInfo(foruminfo.Parentid);
                UpdateLastPost(foruminfo);
            }
        }
开发者ID:ichari,项目名称:ichari,代码行数:53,代码来源:Forums.cs


示例17: UpdateLastPost

 public void UpdateLastPost(ForumInfo foruminfo, PostInfo postinfo)
 {
     DbParameter[] parms ={
                              DbHelper.MakeInParam("@lasttid", (DbType)SqlDbType.Int, 4, postinfo.Tid),
                              DbHelper.MakeInParam("@lasttitle", (DbType)SqlDbType.NChar, 60, postinfo.Topictitle),
                              DbHelper.MakeInParam("@lastpost", (DbType)SqlDbType.DateTime, 8, postinfo.Postdatetime),
                              DbHelper.MakeInParam("@lastposterid", (DbType)SqlDbType.Int, 4, postinfo.Posterid),
                              DbHelper.MakeInParam("@lastposter", (DbType)SqlDbType.NChar, 20, postinfo.Poster),
                              DbHelper.MakeInParam("@fid", (DbType)SqlDbType.Int, 4, foruminfo.Fid)
                          };
     string sql = string.Format("UPDATE [{0}forums] SET [lasttid] = @lasttid, [lasttitle] = @lasttitle, [lastpost] = @lastpost, [lastposterid] = @lastposterid, [lastposter] = @lastposter WHERE [fid] = @fid OR [fid] IN ({1})", BaseConfigs.GetTablePrefix, foruminfo.Parentidlist);
     DbHelper.ExecuteNonQuery(CommandType.Text, sql, parms);
 }
开发者ID:ichari,项目名称:ichari,代码行数:13,代码来源:DataProvider.cs


示例18: UpdateAttachment

        /// <summary>
        /// 附件操作
        /// </summary>
        /// <param name="attachmentinfo">附件信息</param>
        /// <param name="topicId">主题id</param>
        /// <param name="postId">帖子id</param>
        /// <param name="postInfo">帖子信息</param>
        /// <param name="returnMsg">返回信息</param>
        /// <param name="userId">当前用户id</param>
        /// <param name="config">配置信息</param>
        /// <param name="userGroupInfo">当前用户组信息</param>
        /// <returns></returns>
        public static bool UpdateAttachment(AttachmentInfo[] attachmentArray, int topicId, int postId, PostInfo postInfo, ref StringBuilder returnMsg, int userId, GeneralConfigInfo config, UserGroupInfo userGroupInfo)
        {
            if (attachmentArray == null)
                return false;

            if (attachmentArray.Length > config.Maxattachments)
            {
                //returnMsg = new StringBuilder("系统设置为每个帖子附件不得多于" + config.Maxattachments + "个");
                returnMsg = new StringBuilder();
                returnMsg.AppendFormat("您添加了{0}个图片/附件,多于系统设置的{1}个.<br/>请重新编辑该帖并删除多余图片/附件.", attachmentArray.Length, config.Maxattachments);
                return false;
            }
            int newAttachCount = Attachments.BindAttachment(attachmentArray, topicId, postId, userId, userGroupInfo);
            //int errorAttachment = Attachments.BindAttachment(attachmentinfoarray, postid, sb, topicid, userid, usergroupinfo, out newAttachCount);
            int[] aid = new int[attachmentArray.Length];
            int attType = 0;//普通附件,2为图片附件
            for (int i = 0; i < attachmentArray.Length; i++)
            {
                //attachmentinfoarray[i].Tid = topicid;
                //attachmentinfoarray[i].Pid = postid;
                Attachments.UpdateAttachment(attachmentArray[i]);
                aid[i] = attachmentArray[i].Aid;
                attType = attachmentArray[i].Filetype.ToLower().StartsWith("image") ? 2 : 1;
            }

            string tempMessage = Attachments.FilterLocalTags(aid, attachmentArray, postInfo.Message);

            if (tempMessage != postInfo.Message)
            {
                postInfo.Message = tempMessage;
                postInfo.Pid = postId;
                Posts.UpdatePost(postInfo);
            }
            if (newAttachCount > 0)
                UserCredits.UpdateUserExtCreditsByUploadAttachment(userId, newAttachCount);

            UpdateTopicAndPostAttachmentType(topicId, postId, attType);
            return true;
        }
开发者ID:simazhao,项目名称:discuz-nt,代码行数:51,代码来源:Attachments.cs


示例19: WriteAggregationPostData

        /// <summary>
        /// 根据主题ID列表取出主题帖子
        /// </summary>
        /// <param name="posttableid">分表ID</param>
        /// <param name="tidlist">主题ID列表</param>
        /// <returns></returns>
        public static void WriteAggregationPostData(PostInfo[] posts, string tablelist, string tidlist, string configPath, string topiclistnodepath, string websitetopiclistnodepath)
        {
            //得到所选择帖子信息
            DataTable dt = Data.Posts.GetTopicListByTidlist(tablelist, tidlist);
            Discuz.Common.Xml.XmlDocumentExtender doc = new Discuz.Common.Xml.XmlDocumentExtender();
            if (File.Exists(configPath))
                doc.Load(configPath);
            //清除以前选择
            XmlNode topiclistnode = doc.InitializeNode(topiclistnodepath, false);
            XmlNode oldTopicListNode = topiclistnode.Clone();   //复制一份到新节点
            topiclistnode.RemoveAll();      //清除新节点的内容,只存留其结构
            XmlNode websitetopiclistnode = doc.InitializeNode(websitetopiclistnodepath);

            string selecttidlist = DNTRequest.GetString("tid");
            foreach (string tid in tidlist.Split(','))
            {
                XmlNode topic = GetOldTopicNode(oldTopicListNode, tid);
                if (topic == null)
                {
                    topic = GetTopicInDataTable(posts, dt, doc, tid);
                }
                if (topic != null)
                    topiclistnode.AppendChild(topic);

            }
            foreach (XmlNode node in topiclistnode)
            {
                if (("," + selecttidlist + ",").IndexOf("," + node.ChildNodes[20].InnerText + ",") >= 0)
                    websitetopiclistnode.AppendChild(node.Clone());
            }
            doc.Save(configPath);
        }
开发者ID:WySky,项目名称:Memo-Project,代码行数:38,代码来源:Posts.cs


示例20: UpdatePost

 /// <summary>
 /// 更新指定帖子信息
 /// </summary>
 /// <param name="postInfo">帖子信息</param>
 /// <returns>更新数量</returns>
 public static int UpdatePost(PostInfo postInfo, string postTableId)
 {            
     int result = DatabaseProvider.GetInstance().UpdatePost(postInfo, postTableId);
     //更新Cache缓存中的帖子信息
     if (appDBCache && IPostService != null)
     {
         IPostService.UpdatePost(postInfo, postTableId);
     }
     return result;
 }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:15,代码来源:Posts.cs



注:本文中的Discuz.Entity.PostInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Entity.PostpramsInfo类代码示例发布时间:2022-05-24
下一篇:
C# Entity.ForumInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap