//GetByCriterias private List <AuctionShort> GetByCriterias(string lot, string title, int sortby, bool ordrby, long event_id, int pageindex, int pagesize, out int?totalrecord) { title = String.IsNullOrEmpty(title) ? String.Empty : title.Replace(" ", "%"); var dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONLISTS, "GETBYCRITERIAS", new object[] { lot, title, sortby, ordrby, event_id, pageindex, pagesize }, CachingExpirationTime.Seconds_30); var result = CacheRepository.Get(dco) as TableViewResult; if (result != null && result.TotalRecords > 0) { totalrecord = result.TotalRecords; return(result.Records); } result = new TableViewResult(); totalrecord = 0; dataContext.CommandTimeout = 600000; result.Records = (from p in dataContext.spAuction_View_Search(event_id, lot, title, String.Empty, -1, -1, sortby - 1, ordrby, pageindex, pagesize, ref totalrecord) 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 = totalrecord.GetValueOrDefault(0); if (result.TotalRecords > 0) { dco.Data = result; CacheRepository.Add(dco); } return(result.Records); }
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); }
//GetByCriterias private List<AuctionShort> GetByCriterias(string lot, string title, int sortby, bool ordrby, long event_id, int pageindex, int pagesize, out int? totalrecord) { title = String.IsNullOrEmpty(title) ? String.Empty : title.Replace(" ", "%"); var dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONLISTS, "GETBYCRITERIAS", new object[] {lot, title, sortby, ordrby, event_id, pageindex, pagesize}, CachingExpirationTime.Seconds_30); var result = CacheRepository.Get(dco) as TableViewResult; if (result != null && result.TotalRecords > 0) { totalrecord = result.TotalRecords; return result.Records; } result = new TableViewResult(); totalrecord = 0; dataContext.CommandTimeout = 600000; result.Records = (from p in dataContext.spAuction_View_Search(event_id, lot, title, String.Empty, -1, -1, sortby - 1, ordrby, pageindex, pagesize, ref totalrecord) 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 = totalrecord.GetValueOrDefault(0); if (result.TotalRecords > 0) { dco.Data = result; CacheRepository.Add(dco); } return result.Records; }
//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)); }
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; }