Example #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;
 }
Example #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;
 }
Example #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;
 }
Example #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();
        }
Example #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;
 }
Example #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();
        }
Example #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();
        }
Example #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();
 }
Example #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();
 }