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 <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);
            }
        }
Example #3
0
 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);
     }
 }
Example #4
0
 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);
     }
 }