Example #1
0
        public List <Exchange> getExchangeList(ForPaging Paging, string Currency)
        {
            try
            {
                IQueryable <Exchange> SearchData;
                SearchData = db.Exchanges.Where(p => p.Currency.Equals(Currency));

                if (String.IsNullOrEmpty(Currency) || SearchData.Count() == 0)
                {
                    List <Exchange> nullExchange = new List <Exchange>();
                    Paging.MaxPage = 1;
                    Paging.SetRightPage();
                    return(nullExchange);
                }
                else
                {
                    Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(SearchData.Count() / Paging.ItemNum)));
                    Paging.SetRightPage();
                    return(SearchData.OrderByDescending(p => p.QuotedDate).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum).ToList());
                }
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Example #2
0
        //根據分頁以及搜尋來取得資料陣列的方法
        public List <Invoices> GetDataList(ForPaging Paging, string Search, string DateSearch, string sortOrder)
        {
            //宣告要接受全部搜尋資料的物件
            IQueryable <Invoices> SearchData;

            //判斷搜尋是否為空或Null,用於決定要呼叫取得搜尋資料
            SearchData = GetAllDataList(Paging, Search, DateSearch, sortOrder);
            //先排序再根據分頁來回傳所需部分的資料陣列
            return(SearchData.OrderByDescending(p => p.InvoicesDate)
                   .Skip((Paging.NowPage - 1) *
                         Paging.ItemNum).Take(Paging.ItemNum).ToList());
        }
Example #3
0
        public List <Libor> getLiborList()
        {
            try
            {
                IQueryable <Libor> SearchData;
                SearchData = db.Libors;

                return(SearchData.OrderByDescending(p => p.QuotedDate).ToList());
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Example #4
0
        public List <Guestbooks> GetDataList(ForPaging Paging, string Search)
        {
            //宣告要接受全部搜尋資料的物件
            IQueryable <Guestbooks> SearchData;

            //判斷搜尋是否為空或Null,用於決定要呼叫取得搜尋資料
            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());
        }
Example #5
0
        //搜尋專案|定義分頁資料筆數
        public List <Projects> GetSearchProject(Paging Paging, string Search, string UserName)
        {
            IQueryable <Projects> SearchData;
            Users data = userservice.FindUser(UserName);

            //判斷是否有搜尋資料
            if (string.IsNullOrEmpty(Search))
            {
                //無搜尋資料
                SearchData = GetAllDataList(Paging, data.UserId);
            }
            else
            {
                //有搜尋資料
                SearchData = GetAllDataList(Paging, Search, data.UserId);
            }
            return(SearchData.OrderByDescending(p => p.ProjectId).Skip((Paging.NowPage - 1) * (Paging.ItemNum)).Take(Paging.ItemNum).ToList());
        }
Example #6
0
        //根據分頁以及搜尋來取得資料陣列的方法
        public List <Article> GetDataList(ForPaging Paging, string Search)
        {
            //設定要接受全部搜尋資料的物件
            IQueryable <Article> SearchData;

            //判斷搜尋是否為空或Null,以決定要呼叫設定搜尋資料
            if (String.IsNullOrEmpty(Search))
            {
                SearchData = GetAllDataList(Paging);
            }
            else
            {
                SearchData = GetAllDataList(Paging, Search);
            }
            //先排序再根據分頁來回傳所需的部分資料陣列
            return(SearchData.OrderByDescending(p => p.A_Id)
                   .Skip((Paging.NowPage - 1) * Paging.ItemNum)
                   .Take(Paging.ItemNum).ToList());
        }
Example #7
0
 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 <Products> GetDataList(ForPaging Paging, ProductsView searchCondition)
        {
            //宣告要接受全部搜尋資料的物件
            IQueryable <Products> SearchData;

            SearchData = db.Products;

            string productID   = "";
            string productName = "";

            if (searchCondition.ProductID != null)
            {
                productID = searchCondition.ProductID.ToString().Trim();
            }

            if (searchCondition.ProductName != null)
            {
                productName = searchCondition.ProductName.Trim();
            }

            if (String.IsNullOrEmpty(productID) == false)
            {
                SearchData = SearchData.Where(p => p.ProductID.ToString().Contains(productID));
            }

            if (String.IsNullOrEmpty(productName) == false)
            {
                SearchData = SearchData.Where(p => p.ProductName.ToString().Contains(productName));
            }

            //計算所需的總頁數
            Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(SearchData.Count()) / Paging.ItemNum));

            //重新設定正確的頁數,避免有不正確值傳入
            Paging.SetRightPage();

            //先排序再根據分頁來回傳所需部分的資料陣列
            return(SearchData.OrderByDescending(p => p.ProductID).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum).ToList());
        }