public IQueryable <Guestbooks> GetAllDataList(ForPaging Paging, string Search) { try { IQueryable <Guestbooks> Data = db.Guestbooks.Where(p => p.MembersAccount.Contains(Search) || p.Content.Contains(Search) || p.Reply.Contains(Search) || p.Members.Name.Contains(Search)); Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count() / Paging.ItemNum))); Paging.SetRightPage(); return(Data); } catch (System.IO.IOException e) { logger.Error(LogUtility.GetExceptionDetails(e)); return(null); } }
public IQueryable <FileContent> GetAllFileList(ForPaging Paging) { try { IQueryable <FileContent> Data = db.FileContents; Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum)); Paging.SetRightPage(); return(Data); } catch (System.IO.IOException e) { logger.Error(LogUtility.GetExceptionDetails(e)); return(null); } }
public List <Guestbooks> GetDataList(ForPaging Paging, string Search) { try { IQueryable <Guestbooks> SearchData; if (String.IsNullOrEmpty(Search)) { SearchData = GetAllDataList(Paging); } else { SearchData = GetAllDataList(Paging, Search); } return(SearchData.OrderByDescending(p => p.Id).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum).ToList()); } catch (System.IO.IOException e) { logger.Error(LogUtility.GetExceptionDetails(e)); return(null); } }
public List <Stock> getStockList(ForPaging Paging, string Num) { try { IQueryable <Stock> SearchData; bool numIsEmpty = String.IsNullOrEmpty(Num); if (!numIsEmpty) { int Id = int.Parse(Num); SearchData = db.Stocks.Where(p => p.Id.Equals(Id)); if (SearchData.Count() == 0) { List <Stock> nullStock = new List <Stock>(); Paging.MaxPage = 1; Paging.SetRightPage(); return(nullStock); } else { Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(SearchData.Count() / Paging.ItemNum))); Paging.SetRightPage(); return(SearchData.ToList().OrderByDescending(p => p.Price_Date).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum).ToList()); } } else { List <Stock> nullStock = new List <Stock>(); Paging.MaxPage = 1; Paging.SetRightPage(); return(nullStock); } } catch (System.IO.IOException e) { logger.Error(LogUtility.GetExceptionDetails(e)); return(null); } }