private List <AuctionShort> GetProductsForTag(long eventID, long tagID, bool ispast, int sort, bool ordrby, int pageindex, int pagesize, out int?totalrecords) { var dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONLISTS, "GETPRODUCTSFORTAG", new object[] { eventID, tagID, ispast, sort, ordrby, pageindex, pagesize }, CachingExpirationTime.Seconds_30); var result = CacheRepository.Get(dco) as TableViewResult; if (result != null && result.TotalRecords > 0) { totalrecords = result.TotalRecords; return(result.Records); } result = new TableViewResult(); totalrecords = 0; dataContext.CommandTimeout = 600000; result.Records = (from p in dataContext.spAuction_View_Tag(eventID, tagID, ispast ? 2 : 1, sort, ordrby, pageindex, pagesize, ref totalrecords) select new AuctionShort { Bids = p.Bids.GetValueOrDefault(0), CurrentBid = p.CurrentBid.GetValueOrDefault(0), Estimate = p.Estimate, IsBold = p.IsBold.GetValueOrDefault(false), IsFeatured = p.IsFeatured.GetValueOrDefault(false), IsUnsoldOrPulledOut = p.IsUnsold.GetValueOrDefault(false) || p.IsPulledOut.GetValueOrDefault(false), LinkParams = new LinkParams { ID = p.Auction_ID.GetValueOrDefault(0), EventTitle = p.EventTitle, MainCategoryTitle = p.MainCategoryTitle, CategoryTitle = p.CategoryTitle }, Lot = p.Lot.HasValue ? p.Lot.Value : (short)0, Price = p.Price.GetValueOrDefault(0), PriceRealized = p.PriceRealized.GetValueOrDefault(0), PulledOut = p.IsPulledOut.GetValueOrDefault(false), Status = p.AuctionStatus.GetValueOrDefault(0), ThumbnailPath = p.ThumbnailPath, Title = p.Title, UnsoldOrPulledOut = p.IsUnsold.GetValueOrDefault(false) ? "UNSOLD" : "WITHDRAWN" }).ToList(); result.TotalRecords = totalrecords.GetValueOrDefault(0); if (result.TotalRecords > 0) { dco.Data = result; CacheRepository.Add(dco); } return(result.Records); }