예제 #1
0
 public IQueryable<FileContent> GetAllFileList(ForPaging paging)
 {
     IQueryable<FileContent> SearchedFiles = fileDB.FileContent;
     paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(SearchedFiles.Count()/paging.ItemNum)));
     paging.CheckPage();
     return SearchedFiles;
 }
예제 #2
0
 private IQueryable<Message> GetMessagesFromDB(ForPaging paging, int articleId)
 {
     IQueryable<Message> dataFromDB = db.Message.Where(p => p.ArticleId == articleId);
     paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(dataFromDB.Count())/paging.ItemNum));
     paging.CheckPage();
     return dataFromDB;
 }
예제 #3
0
 public IQueryable<Guestbooks> GetAllDataFromDB(ForPaging paging)
 {
     IQueryable<Guestbooks> fetchedData = db.Guestbooks;
     paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(fetchedData.Count()) / paging.ItemNum));
     paging.CheckPage();
     return fetchedData;
 }
예제 #4
0
        public List<int> GetIdList(ForPaging paging)
        {
            paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(db.Item.Count() / paging.ItemNum)));
            paging.CheckPage();

            return db.Item.OrderByDescending(p=>p.Id).
                Skip((paging.CurrentPage-1) * paging.ItemNum).Take(paging.ItemNum).Select(p => p.Id).ToList();
        }
예제 #5
0
 public IQueryable<Guestbooks> GetAllDataFromDB(ForPaging paging, string search)
 {
     IQueryable<Guestbooks> fetchedData = db.Guestbooks.Where(s => s.Account.Contains(search) ||
             s.Content.Contains(search) ||
             s.Reply.Contains(search));
     paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(fetchedData.Count()) / paging.ItemNum));
     paging.CheckPage();
     return fetchedData;
 }
예제 #6
0
        public List<Guestbooks> GetGuestbooksList(ForPaging paging, string search)
        {
            IQueryable<Guestbooks> SearchData = null;

            if (string.IsNullOrEmpty(search))
            {
                SearchData = GetAllDataFromDB(paging);
            }
            else
            {
                SearchData = GetAllDataFromDB(paging, search);
            }
            return SearchData.OrderByDescending(p=>p.Id).Skip((paging.CurrentPage-1)*paging.ItemNum).Take(paging.ItemNum).ToList();
        }
예제 #7
0
        public List<Article> GetArticleList(ForPaging paging, string search)
        {
            IQueryable<Article> queriedResult;
            if (string.IsNullOrEmpty(search))
            {
                queriedResult = db.Article;
            }
            else
            {
                queriedResult = db.Article.Where(p => p.Content.Contains(search) ||
                                                      p.Account.Contains(search) ||
                                                      p.Title.Contains(search));
            }

            paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(queriedResult.Count()) / paging.ItemNum));
            paging.CheckPage();

            return queriedResult.OrderByDescending(p=>p.ArticleId)
                .Skip((paging.CurrentPage-1)*paging.ItemNum).Take(paging.ItemNum).ToList();
        }
예제 #8
0
 public List<FileContent> GetFileList(ForPaging paging)
 {
     IQueryable<FileContent> SearchedFiles = GetAllFileList(paging);
     return SearchedFiles.OrderByDescending(p => p.Id)
         .Skip((paging.CurrentPage - 1) * paging.ItemNum).Take(paging.ItemNum).ToList();
 }
예제 #9
0
 public List<Message> MessageList(ForPaging paging, int articleId)
 {
     IQueryable<Message> messageList = GetMessagesFromDB(paging, articleId);
     return messageList.OrderByDescending(p=>p.MessageId).Skip((paging.CurrentPage-1)*paging.ItemNum)
         .Take(paging.ItemNum).ToList();
 }