Beispiel #1
0
        public string AddReply(Reply reply)
        {
            var mapper = Common.GetMapper();

            ReplyDao  replydao  = new ReplyDao(mapper);
            TopicDao  topicdao  = new TopicDao(mapper);
            NotifyDao notifydao = new NotifyDao(mapper);

            topicdao.UpdateReplyCount(new TopicQueryForm
            {
                ID            = reply.TopicID,
                LastReplierID = reply.OwnerID,
            });
            topicdao.Update(new TopicUpdateForm
            {
                QueryForm = new TopicQueryForm {
                    ID = reply.TopicID
                },
                Entity = new Topic {
                    LastReplierID = reply.OwnerID
                }
            });
            replydao.Add(reply);
            notifydao.Add(new Notify
            {
                TopicID = reply.TopicID,
                UserID  = reply.ReplyToID,
                ReplyID = reply.ID,
            });

            return(reply.ID);
        }
Beispiel #2
0
        public bool Read(NotifyQueryForm form)
        {
            var mapper = Common.GetMapper();

            NotifyDao notifydao = new NotifyDao(mapper);

            notifydao.Update(new NotifyUpdateForm
            {
                QueryForm = form,
                Entity    = new Notify {
                    IsRead = 1
                },
            });

            return(true);
        }
Beispiel #3
0
        public FullReplyInfo GetReplyDetailList(string replyID)
        {
            var       mappper   = Common.GetMapper();
            ReplyDao  dao       = new ReplyDao(mappper);
            NotifyDao notifyDao = new NotifyDao(mappper);
            var       current   = dao.QueryFullReplyInfo(new ReplyQueryForm {
                ID = replyID
            }).FirstOrDefault();
            var replies = new List <ReplyWithChild>();

            if (current.ReplyID == "0")
            {
                replies = dao.QueryFullReplyInfo(new ReplyQueryForm {
                    ReplyID = replyID, OrderByColumn = "CreateTime", OrderBy = OrderBy.DESC
                });
            }
            else
            {
                current = dao.QueryFullReplyInfo(new ReplyQueryForm {
                    ID = current.ReplyID
                }).FirstOrDefault();
                replies = dao.QueryFullReplyInfo(new ReplyQueryForm {
                    ReplyID = current.ID, OrderByColumn = "CreateTime", OrderBy = OrderBy.DESC
                });
            }
            var replyids = (from r in replies
                            select r.ID).Distinct().ToList();

            notifyDao.Update(new NotifyUpdateForm
            {
                Entity = new Notify {
                    IsRead = 1
                },
                QueryForm = new NotifyQueryForm {
                    ReplyIDs = replyids
                },
            });
            if (current != null)
            {
                current.Children = new List <ReplyWithChild>();
                current.Children.AddRange(replies);
            }
            return(current);
        }
Beispiel #4
0
        public bool ReadReply(ReplyQueryForm form)
        {
            var       mapper    = Common.GetMapper();
            ReplyDao  replyDao  = new ReplyDao(mapper);
            NotifyDao notifyDao = new NotifyDao(mapper);
            var       replies   = replyDao.Query(form);
            var       ids       = (from r in replies
                                   select r.ID).ToList();

            notifyDao.Update(new NotifyUpdateForm
            {
                QueryForm = new NotifyQueryForm {
                    ReplyIDs = ids
                },
                Entity = new Notify {
                    IsRead = 1
                }
            });
            return(true);
        }