Example #1
0
        //無搜尋值的搜尋資料方法
        public IQueryable <Guestbooks> GetAllDataList(ForPaging Paging)
        {
            //宣告要回傳的搜尋資料為資料庫中的Guestbooks資料表
            IQueryable <Guestbooks> Data = db.Guestbooks;

            //計算所需的總頁數
            Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
            //重新設定正確的頁數,避免有不正確值傳入
            Paging.SetRightPage();
            //回傳搜尋資料
            return(Data);
        }
Example #2
0
        //包含搜尋值的搜尋資料方法
        public IQueryable <Guestbooks> GetAllDataList(ForPaging Paging, string Search)
        {
            //根據搜尋值來搜尋資料
            IQueryable <Guestbooks> Data = db.Guestbooks
                                           .Where(p => p.Account.Contains(Search) || p.Content.Contains(Search) || p.Reply.Contains(Search));

            //計算所需的總頁數
            Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
            //重新設定正確的頁數,避免有不正確值傳入
            Paging.SetRightPage();
            //回傳搜尋資料
            return(Data);
        }
Example #3
0
        //搜尋全部檔案資料與設定分頁內容方法
        public IQueryable <FileContent> GetAllFileList(ForPaging Paging)
        {
            //宣告要回傳的搜尋資料為資料庫中的FileContent資料表
            IQueryable <FileContent> Data = db.FileContent;

            //計算所需的總頁面
            Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(
                                                              Data.Count()) / Paging.ItemNum));
            //重新設定正確的頁數,避免有不正確值傳入
            Paging.SetRightPage();
            //回傳搜尋資料
            return(Data);
        }