コード例 #1
0
ファイル: Replies.cs プロジェクト: mfcharaf/SnitzDotNet
        public static int FindReplyPage(int replyid)
        {
            bool found    = false;
            int  pagesize = SnitzConfig.Config.TopicPageSize;
            int  page     = 0;

            ReplyInfo reply    = GetReply(replyid);
            ITopic    topicdal = Factory <ITopic> .Create("Topic");

            List <int> replies = new List <int>(topicdal.GetReplyIdList(reply.TopicId));

            while (!found)
            {
                List <int> sublist = (replies.Skip(page * pagesize).Take(pagesize)).ToList();
                if (sublist.Contains(replyid))
                {
                    found = true;
                    page += 1;
                    continue;
                }
                page += 1;
                if (sublist.Count < pagesize)
                {
                    found = true;
                    page  = -1;
                }
            }
            return(page);
        }