コード例 #1
0
 //GetPastUsersWatchList
 public List <MyBid> GetPastUsersWatchList(long event_id, long user_id)
 {
     dataContext.CommandTimeout = 600000;
     return((from sp in dataContext.spBid_View_GetPastBidWatch(user_id, event_id)
             select new MyBid
     {
         PriceRealized = new PriceRealized {
             ID = sp.ID, Lot = sp.Lot.HasValue ? sp.Lot.Value : (short)0, Title = sp.Title, Price = sp.PriceRealized.GetValueOrDefault(0), LinkParams = new LinkParams {
                 EventTitle = sp.EventTitle, MainCategoryTitle = sp.MainCategoryTitle, CategoryTitle = sp.CategoryTitle
             }
         },
         AuctionStatus = sp.AuctionStatus.GetValueOrDefault(1),
         Amount = sp.Amount,
         MaxBid = sp.MaxBid,
         DateMade = sp.DateMade.GetValueOrDefault(DateTime.MinValue),
         IsUnsold = sp.IsUnsold,
         IsWinner = sp.IsWinner.GetValueOrDefault(false),
         WinBid = sp.WinBid.GetValueOrDefault(0),
         BidsCount = sp.BidsCount.GetValueOrDefault(0),
         ThubnailImage = sp.ThumbnailPath
     }).ToList());
 }
コード例 #2
0
        //GetPastUsersWatchList
        public PagedList <MyBid> GetPastUsersWatchList(long event_id, long user_id, int pageindex, int pagesize)
        {
            int?totalrecords = 0;

            pageindex = (pageindex > 0) ? pageindex - 1 : 0;
            DataCacheObject dco = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.BIDS, "GETPASTUSERSWATCHLIST", new object[] { event_id, user_id, pageindex, pagesize }, CachingExpirationTime.Days_01);

            TableViewResult <MyBid> result = CacheRepository.Get(dco) as TableViewResult <MyBid>;

            if (result != null && result.TotalRecords > 0)
            {
                return(new PagedList <MyBid>(result.Records, pageindex, pagesize, result.TotalRecords));
            }
            result = new TableViewResult <MyBid>();

            dataContext.CommandTimeout = 600000;
            result.Records             = (from SP in dataContext.spBid_View_GetPastBidWatch(user_id, event_id, pageindex, pagesize, ref totalrecords)
                                          select new MyBid
            {
                LinkParams = new LinkParams {
                    EventTitle = SP.EventTitle, CategoryTitle = SP.CategoryTitle, Lot = SP.Lot.GetValueOrDefault(0), ID = SP.Auction_ID.GetValueOrDefault(0), Title = SP.Title
                },
                Amount = SP.Amount.GetValueOrDefault(0),
                MaxBid = SP.MaxBid.GetValueOrDefault(0),
                DateMade = SP.DateMade.GetValueOrDefault(DateTime.Now),
                IsWinner = SP.IsWinner.GetValueOrDefault(false),
                CurrentBid_1 = SP.CurrentBid_1,
                CurrentBid_2 = SP.CurrentBid_2,
                ThubnailImage = SP.ThumbnailPath
            }).ToList();
            result.TotalRecords = totalrecords.GetValueOrDefault(0);
            if (result.TotalRecords > 0)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(totalrecords.GetValueOrDefault(0) > 0 ? new PagedList <MyBid>(result.Records, pageindex, pagesize, totalrecords.GetValueOrDefault(0)) : new PagedList <MyBid>(new List <MyBid>(), pageindex, pagesize, 0));
        }