Esempio n. 1
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);
        }
Esempio n. 2
0
        public PaginationEntity <ReplyWithChild> GetReplies(ReplyQueryForm form)
        {
            PaginationEntity <ReplyWithChild> paging = new PaginationEntity <ReplyWithChild>();
            var      mapper       = Common.GetMapper();
            ReplyDao replydao     = new ReplyDao(mapper);
            var      firstReplies = replydao.QueryFullReplyInfo(form);

            var replyids = (from r in firstReplies
                            select r.ID).ToList();
            var chilren = replydao.QueryFullReplyInfo(new ReplyQueryForm {
                ReplyIDs = replyids, Enabled = true, OrderByColumn = "CreateTime", OrderBy = OrderBy.ASC
            });

            //chilren.Sort((l, r) =>
            //{
            //    return Convert.ToInt16(l.CreateTime < r.CreateTime);
            //});

            firstReplies.ForEach(t =>
            {
                t.Children = new List <ReplyWithChild>();
                for (int i = 0; i < chilren.Count; i++)
                {
                    var reply = chilren[i];
                    if (t.ID.Equals(reply.ReplyID))
                    {
                        t.Children.Add(reply);
                        chilren.Remove(reply);
                        i--;
                    }
                }
            });
            paging.List        = firstReplies;
            paging.RecordCount = form.RecordCount;

            return(paging);
        }