Ejemplo n.º 1
0
        public static bool Createtopic(TopicInfo topic, out int id)
        {
            id = 0;
            if (topic == null)
            {
                return(false);
            }
            Globals.EntityCoding(topic, true);
            id = new TopicDao().AddTopic(topic);
            ReplyInfo reply = new TextReplyInfo {
                Keys        = topic.Keys,
                MatchType   = MatchType.Equal,
                MessageType = MessageType.Text,
                ReplyType   = ReplyType.Topic,
                ActivityId  = id
            };

            return(new ReplyDao().SaveReply(reply));
        }
Ejemplo n.º 2
0
        public PaginationEntity <FullTopicInfo> GetFullTopicList(TopicQueryForm form)
        {
            var                mapper   = Common.GetMapper();
            TopicDao           topicdao = new TopicDao(mapper);
            User_BoardGroupDao udgdao   = new User_BoardGroupDao(mapper);
            var                paging   = new PaginationEntity <FullTopicInfo>();
            var                boards   = udgdao.Query(new User_BoardGroupQueryForm {
                UserID = form.OwnerID
            });
            var boardids = (from b in boards
                            select b.BoardGroupID).ToList();

            form.OwnerID       = null;
            form.BoardGroupIDs = boardids;
            var topics = topicdao.QueryFullTopicInfo(form);

            paging.List        = topics;
            paging.RecordCount = form.RecordCount;
            return(paging);
        }
Ejemplo n.º 3
0
        public PaginationEntity <FullTopicInfo> GetFullTopicListByBoard(TopicQueryForm form)
        {
            var                mapper   = Common.GetMapper();
            TopicDao           topicdao = new TopicDao(mapper);
            User_BoardGroupDao udgdao   = new User_BoardGroupDao(mapper);
            var                paging   = new PaginationEntity <FullTopicInfo>();
            var                boards   = udgdao.Query(new User_BoardGroupQueryForm {
                UserID = form.OwnerID, BoardGroupID = form.BoardGroupID
            });

            if (boards.Count == 0)
            {
                throw new XinLuClubException(202, "你没有查看该板块的权限,请联系管理员");
            }
            var topics = topicdao.QueryFullTopicInfo(new TopicQueryForm {
                Enabled = true, BoardGroupID = form.BoardGroupID
            });

            paging.List        = topics;
            paging.RecordCount = form.RecordCount;
            return(paging);
        }
Ejemplo n.º 4
0
        public TopicDetail GetTopicDetail(string topicID, int pageSize, int currentPageIndex)
        {
            var      mapper   = Common.GetMapper();
            TopicDao topicdao = new TopicDao(mapper);
            ReplyDao replydao = new ReplyDao(mapper);
            var      topic    = topicdao.QueryFullTopicInfo(new TopicQueryForm {
                ID = topicID, Enabled = true
            }).FirstOrDefault();
            var replies = GetReplies(new ReplyQueryForm
            {
                TopicID       = topicID,
                ReplyID       = "0",
                OrderBy       = OrderBy.ASC,
                OrderByColumn = "CreateTime",
                PageSize      = pageSize,
                CurrentIndex  = currentPageIndex,
                Enabled       = true,
            });

            return(new TopicDetail {
                Topic = topic, Replies = replies
            });
        }
Ejemplo n.º 5
0
        public static bool Createtopic(TopicInfo topic, out int id)
        {
            id = 0;
            bool result;

            if (null == topic)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(topic, true);
                id = new TopicDao().AddTopic(topic);
                ReplyInfo replyInfo = new TextReplyInfo();
                replyInfo.Keys        = topic.Keys;
                replyInfo.MatchType   = MatchType.Equal;
                replyInfo.MessageType = MessageType.Text;
                replyInfo.ReplyType   = ReplyType.Topic;
                replyInfo.ActivityId  = id;
                result = new ReplyDao().SaveReply(replyInfo);
            }
            return(result);
        }
Ejemplo n.º 6
0
 public TopicRepository()
 {
     _dao = new TopicDao();
 }