//GetAllowedCategoriesForTheEvent
        public List <EventCategoryDetail> GetAllowedCategoriesForTheEvent(long event_id)
        {
            DataCacheObject            dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETALLOWEDCATEGORIESFORTHEEVENT", new object[] { event_id }, CachingExpirationTime.Days_01);
            List <EventCategoryDetail> result = CacheRepository.Get(dco) as List <EventCategoryDetail>;

            if (result != null && result.Any())
            {
                return(result);
            }
            result = (from p in dataContext.spEventCategory_ListForEvent(event_id)
                      select new EventCategoryDetail
            {
                EventCategory_ID = p.EventCategory_ID,
                Category_ID = p.Category_ID,
                CategoryDescription = p.CategoryDescription,
                CategoryTitle = p.CategoryTitle,
                CategoryMap_ID = p.CategoryMap_ID,
                IsActive = p.IsActive,
                Event_ID = p.Event_ID,
                IsTaxable = p.IsTaxable
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 2
0
        //GetBidWatchForUser
        public List <UserBidWatch> GetBidWatchForUser(long user_id, long event_id)
        {
            DataCacheObject     dco    = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.WATCHLISTS, "GETBIDWATCHFORUSER", new object[] { user_id, event_id }, CachingExpirationTime.Seconds_15);
            List <UserBidWatch> result = CacheRepository.Get(dco) as List <UserBidWatch>;

            if (result != null && result.Any())
            {
                return(result);
            }
            dataContext.CommandTimeout = 600000;
            result = (from p in dataContext.spBid_View_BidWatch(user_id, event_id)
                      select new UserBidWatch
            {
                AuctionStatus = p.AuctionStatus.GetValueOrDefault(1),
                Amount = p.Amount.GetValueOrDefault(0),
                CurrentBid = p.CurrentBid.GetValueOrDefault(0),
                HighBidder = p.HighBidder,
                Quantity = p.Quantity,
                Bids = p.Bids.GetValueOrDefault(0),
                MaxBid = p.MaxBid.GetValueOrDefault(0),
                Option = p.IsWatch.GetValueOrDefault(0),
                LinkParams = new LinkParams {
                    ID = p.Auction_ID, Lot = p.Lot.GetValueOrDefault(0), Title = p.Title, EventTitle = p.EventTitle, CategoryTitle = p.CategoryTitle, MainCategoryTitle = p.MainCategoryTitle
                }
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetEventCategoryDetail
        public EventCategoryDetail GetEventCategoryDetail(long eventcategory_id)
        {
            DataCacheObject     dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETEVENTCATEGORYDETAIL", new object[] { eventcategory_id }, CachingExpirationTime.Days_01);
            EventCategoryDetail result = CacheRepository.Get(dco) as EventCategoryDetail;

            if (result != null)
            {
                return(result);
            }
            result = (from p in dataContext.spEventCategory_Detail(eventcategory_id)
                      select new EventCategoryDetail
            {
                EventCategory_ID = p.EventCategory_ID,
                Category_ID = p.Category_ID,
                CategoryDescription = p.CategoryDescription,
                CategoryTitle = p.CategoryTitle,
                CategoryMap_ID = p.CategoryMap_ID,
                IsActive = p.IsActive,
                Event_ID = p.Event_ID,
                IsTaxable = p.IsTaxable
            }).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetUpcomingList
        public List <Event> GetUpcomingList(bool?IsAdmin)
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETUPCOMINGLIST", new object[] { IsAdmin }, CachingExpirationTime.Hours_01);
            List <Event>    result = CacheRepository.Get(dco) as List <Event>;

            if (result != null && result.Count() > 0)
            {
                return(result);
            }
            result = (IsAdmin.HasValue && IsAdmin.Value ?
                      (from E in dataContext.Events
                       where E.ID != 0
                       orderby E.Ordinary ascending, E.DateEnd descending
                       select E) :
                      (from E in dataContext.Events
                       where E.IsViewable && E.DateEnd > DateTime.Now.AddDays(-45) && E.ID != 0
                       orderby E.Ordinary ascending, E.DateEnd descending
                       select E)).ToList();
            if (result.Count() > 0)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 5
0
        //GetCategoriesMenu
        public string GetCategoriesMenu(long?event_id, bool onlyLeafs)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.CATEGORIES,
                                                      "GETCATEGORIESMENU",
                                                      new object[] { event_id.GetValueOrDefault(0) },
                                                      CachingExpirationTime.Hours_01);
            string res = CacheRepository.Get(dco) as string;

            if (!String.IsNullOrEmpty(res))
            {
                return(res);
            }
            StringBuilder sb = new StringBuilder();
            FileInfo      fi =
                new FileInfo(System.Web.HttpContext.Current.Server.MapPath(@"~\Templates\Different\CategoriesMenu.txt"));

            if (!fi.Exists)
            {
                res = GetCategoriesMenuByEvent(event_id, onlyLeafs);
            }
            else
            {
                TextReader fileReader =
                    new StreamReader(System.Web.HttpContext.Current.Server.MapPath(@"~\Templates\Different\CategoriesMenu.txt"));
                sb.Append(fileReader.ReadToEnd());
                fileReader.Close();
                res = (sb.Length > 0) ? sb.ToString() : GetCategoriesMenuByEvent(event_id, onlyLeafs);
            }
            if (!String.IsNullOrEmpty(res))
            {
                dco.Data = res;
                CacheRepository.Add(dco);
            }
            return(res);
        }
        //RemoveEventCash
        public void RemoveEventCache(long event_id)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETCURRENT");

            CacheRepository.Remove(dco);
            dco.Method = "GETEVENTBYID";
            dco.Params = new object[] { event_id };
            CacheRepository.Remove(dco);
            dco.Method = "GETEVENTDETAIL";
            CacheRepository.Remove(dco);
            dco.Method = "GETUPCOMINGLIST";
            dco.Params = new object[] { true };
            CacheRepository.Remove(dco);
            dco.Method = "GETUPCOMINGLIST";
            dco.Params = new object[] { false };
            CacheRepository.Remove(dco);
            dco.Method = "GETFUTUREEVENTS";
            dco.Params = new object[] { };
            CacheRepository.Remove(dco);
            dco.Method = "GETEVENTCATEGORYBYID";
            dco.Params = new object[] { event_id };
            CacheRepository.Remove(dco);
            dco.Method = "GETALLOWEDCATEGORIESFORTHEEVENT";
            CacheRepository.Remove(dco);
            dco.Region = DataCacheRegions.CATEGORIES;
            dco.Method = "GETCATEGORIESMAPTREEPREVIEW";
            CacheRepository.Remove(dco);
            dco.Method = "GETCATEGORIESMAPTREE";
            dco.Params = new object[] { event_id, false };
            CacheRepository.Remove(dco);
            dco.Params = new object[] { event_id, true };
            CacheRepository.Remove(dco);
        }
Esempio n. 7
0
        //GetConsignmentTotals
        public UICInvoice GetConsignmentTotals(long consignment_id)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.INVOICES, "GETCONSIGNMENTTOTALS",
                                                      new object[] { consignment_id }, CachingExpirationTime.Hours_01);
            UICInvoice result = CacheRepository.Get(dco) as UICInvoice;

            if (result != null)
            {
                return(result);
            }
            int?totalamount = 0;

            result =
                (from p in
                 dataContext.spInvoice_View_ConsignorStatements(consignment_id, null, null, null, 0, 1, ref totalamount)
                 select new UICInvoice
            {
                AmountDue = p.ADue.GetValueOrDefault(0),
                AmountPaid = p.APaid.GetValueOrDefault(0),
                TotalCost = p.TotalCost.GetValueOrDefault(0)
            }).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetEventDetals
        public EventDetail GetEventDetail(long?event_id)
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETEVENTDETAIL", new object[] { event_id }, CachingExpirationTime.Hours_01);
            EventDetail     result = CacheRepository.Get(dco) as EventDetail;

            if (result != null)
            {
                return(result);
            }
            result = (from p in dataContext.spEvent_Detail(event_id)
                      select new EventDetail
            {
                BuyerFee = p.BuyerFee,
                DateEnd = p.DateEnd,
                DateStart = p.DateStart,
                Description = p.Description,
                ID = p.Event_ID,
                IsClickable = p.IsClickable,
                IsCurrent = p.IsCurrent,
                IsPrivate = p.IsPrivate.GetValueOrDefault(false),
                IsViewable = p.IsViewable,
                RegisterRequired = p.RegisterRequired,
                Ordinary = p.Ordinary,
                Title = p.Title
            }).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetProductsForTag

        //GetProductsForTag
        public List <AuctionSales> GetProductsForSales(long eventID)
        {
            var dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONLISTS, "GETPRODUCTSFORSALES",
                                          new object[] { eventID }, CachingExpirationTime.Seconds_30);
            var result = CacheRepository.Get(dco) as List <AuctionSales>;

            if (result != null && result.Any())
            {
                return(result);
            }
            dataContext.CommandTimeout = 600000;
            result = (from p in dataContext.spAuction_View_Sales(eventID)
                      select new AuctionSales
            {
                LinkParams =
                    new LinkParams
                {
                    ID = p.Auction_ID,
                    EventTitle = p.EventTitle,
                    MainCategoryTitle = p.MainCategoryTitle,
                    CategoryTitle = p.CategoryTitle
                },
                Lot = p.Lot.HasValue ? p.Lot.Value : (short)0,
                Price = p.Price,
                ThumbnailPath = p.ThumbnailPath,
                Title = p.Title,
                Estimate = p.Estimate
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetStateByCode
        public State GetStateByCode(string code)
        {
            var dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.STATES, "GETSTATEBYCODE",
                                          new object[] { code }, CachingExpirationTime.Days_01);
            var result = _cacheRepository.Get(dco) as State;

            try
            {
                if (result != null)
                {
                    return(result);
                }
                result = _dataContext.spState_List(null).FirstOrDefault(t => t.Code.ToLower() == code.ToLower());
                if (result == null)
                {
                    result = _dataContext.States.FirstOrDefault(t => t.ID == 0);
                }
                if (result != null)
                {
                    dco.Data = result;
                    _cacheRepository.Add(dco);
                }
            }
            catch (Exception ex)
            {
                Logger.LogException("[code=" + code + "]", ex);
            }
            return(result);
        }
        //GetBidHistory
        public List <BiddingHistory> GetBidHistory(long auction_id)
        {
            DataCacheObject       dco    = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.BIDS, "GETBIDHISTORY", new object[] { auction_id }, CachingExpirationTime.Days_01);
            List <BiddingHistory> result = CacheRepository.Get(dco) as List <BiddingHistory>;

            if (result != null && result.Count() > 0)
            {
                return(result);
            }
            dataContext.CommandTimeout = 600000;
            result = (from p in dataContext.spBid_BidsHistory(auction_id)
                      select new BiddingHistory
            {
                Login = p.Bidder,
                Amount = p.Bid.GetValueOrDefault(0),
                DateMade = p.DateMade.GetValueOrDefault(DateTime.MinValue),
                IsWinner = p.IsWinner.GetValueOrDefault(false)
            }).ToList();
            if (result.Count() > 0)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetTopBidsForMultipleItem
        public List <BidCurrent> GetBidsForMultipleItem(long auction_id, byte iswinner, int quantity, bool fromcache)
        {
            DataCacheObject   dco    = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.BIDS, "GETBIDSFORMULTIPLEITEM", new object[] { auction_id, iswinner }, CachingExpirationTime.Hours_01);
            List <BidCurrent> result = CacheRepository.Get(dco) as List <BidCurrent>;

            if (result != null && fromcache)
            {
                return(result);
            }
            result = (from p in dataContext.spBid_BidsForMultipleItem(auction_id, iswinner, quantity)
                      select new BidCurrent
            {
                Amount = p.Amount,
                Auction_ID = p.Auction_ID,
                Bidder = p.Bidder,
                Comments = p.Comments,
                DateMade = p.DateMade,
                ID = p.ID,
                IP = p.IP,
                IsActive = p.IsActive,
                IsProxy = p.IsProxy,
                ItemNumber = p.ItemNumber,
                MaxBid = p.MaxBid,
                Quantity = p.Quantity,
                User_ID = p.User_ID
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 13
0
        //GetStateByCode
        public State GetStateByCode(string code)
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.STATES, "GETSTATEBYCODE", new object[] { code }, CachingExpirationTime.Days_01);
            State           result = CacheRepository.Get(dco) as State;

            try
            {
                if (result != null)
                {
                    return(result);
                }
                result = GetStateList(null).FirstOrDefault(S => S.Code.ToLower() == code.ToLower());
                if (result == null)
                {
                    result = dataContext.States.Where(S => S.ID == 0).FirstOrDefault();
                }
                else
                {
                    dco.Data = result;
                    CacheRepository.Add(dco);
                }
            }
            catch (Exception ex)
            {
                Vauction.Utils.Lib.Logger.LogException("[code=" + code + "]", ex);
            }
            return(result);
        }
        //GetBidWatchForUser
        public List <UserBidWatch> GetBidWatchForUser(long userID, long eventID)
        {
            DataCacheObject     dco    = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.BIDS, "GETBIDWATCHFORUSER", new object[] { userID, eventID }, CachingExpirationTime.Seconds_15);
            List <UserBidWatch> result = CacheRepository.Get(dco) as List <UserBidWatch>;

            if (result != null && result.Any())
            {
                return(result);
            }
            dataContext.CommandTimeout = 600000;
            result = (from p in dataContext.spBid_BidWatch(userID, eventID)
                      select new UserBidWatch
            {
                Amount = p.Amount.GetValueOrDefault(0),
                CurrentBid_1 = p.CurrentBid_1,
                CurrentBid_2 = p.CurrentBid_2,
                HighBidder_1 = p.HighBidder_1,
                HighBidder_2 = p.HighBidder_2,
                Quantity = p.WinQuantity.GetValueOrDefault(0) > 0 ? p.WinQuantity.GetValueOrDefault(0) : p.BidQuantity,
                MaxBid = p.MaxBid.GetValueOrDefault(0),
                Option = (byte)(p.Amount.GetValueOrDefault(-1) == -1 ? 2 : (p.WinQuantity.GetValueOrDefault(0) == 0 ? 0 : 1)),
                LinkParams = new LinkParams {
                    ID = p.Auction_ID.GetValueOrDefault(0), Lot = p.Lot.GetValueOrDefault(0), Title = p.Title
                },
                Cost = p.Cost.GetValueOrDefault(1)
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetAuctionUpdates
        public List <AuctionUpdate> GetAuctionUpdates(long event_id)
        {
            var dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONS, "GETAUCTIONUPDATES",
                                          new object[] { event_id }, CachingExpirationTime.Hours_01);
            var result = CacheRepository.Get(dco) as List <AuctionUpdate>;

            if (result != null && result.Count() > 0)
            {
                return(result);
            }
            result = (from p in dataContext.spAuction_Updates(event_id)
                      select new AuctionUpdate
            {
                Lot = p.Lot.HasValue ? p.Lot.Value : (short)0,
                Title = p.Title,
                Addendum = p.Addendum,
                IsPulledOut = p.IsPulledOut,
                LinkParams =
                    new LinkParams
                {
                    ID = p.Auction_ID,
                    EventTitle = p.EventTitle,
                    MainCategoryTitle = p.MainCategoryTitle,
                    CategoryTitle = p.CategoryTitle
                }
            }).ToList();
            if (result.Count() > 0)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetAuctionDetailResult
        public AuctionShort GetAuctionDetailResult(long auction_id, bool iscaching)
        {
            var dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONS, "GETAUCTIONDETAILRESULT",
                                          new object[] { auction_id }, CachingExpirationTime.Minutes_01);
            var result = CacheRepository.Get(dco) as AuctionShort;

            if (result != null && iscaching)
            {
                return(result);
            }
            dataContext.CommandTimeout = 600000;
            result = (from a in dataContext.spAuction_View_DetailResult(auction_id)
                      select new AuctionShort
            {
                Bids = a.Bids,
                CurrentBid = a.CurrentBid,
                Estimate = a.Estimate,
                IsUnsoldOrPulledOut = a.IsUnsold,
                Price = a.Price,
                PriceRealized = a.PriceRealized,
                EndDate = a.EventDateEnd
            }).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 17
0
        //GetEventCategoryDetailById
        public EventCategoryDetail GetEventCategoryDetail(long eventcategory_id)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.CATEGORIES, "GETEVENTCATEGORYDETAIL",
                                                      new object[] { eventcategory_id }, CachingExpirationTime.Hours_01);
            EventCategoryDetail ecd = CacheRepository.Get(dco) as EventCategoryDetail;

            if (ecd != null)
            {
                return(ecd);
            }
            ecd = (from p in dataContext.spCategory_View_EventCategoriesDetail(eventcategory_id)
                   select new EventCategoryDetail
            {
                DateEnd = p.DateEnd,
                IsCurrent = p.IsCurrent,
                IsClickable = p.IsClickable,
                Step = p.CloseStep,
                LinkParams = new LinkParams {
                    EventCategory_ID = p.EventCategory_ID, Event_ID = p.Event_ID, MainCategory_ID = p.MainCategory_ID, Category_ID = p.Category_ID, EventTitle = p.EventTitle, MainCategoryTitle = p.MainCategoryTitle, CategoryTitle = p.CategoryTitle
                },
            }).SingleOrDefault();
            if (ecd != null)
            {
                dco.Data = ecd;
                CacheRepository.Add(dco);
            }
            return(ecd);
        }
Esempio n. 18
0
        //GetConsignmentDetailsByConsignmentID
        public List <ConsignmentDetail> GetConsignmentDetailsByConsignmentID(long consignmentID)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.INVOICES, "GETCONSIGNMENTDETAILSBYCONSIGNMENTID",
                                                      new object[] { consignmentID }, CachingExpirationTime.Hours_01);
            List <ConsignmentDetail> result = CacheRepository.Get(dco) as List <ConsignmentDetail>;

            if (result != null && result.Any())
            {
                return(result);
            }
            result = (from p in dataContext.spInvoice_View_GetConsignmentByConsignments(consignmentID)
                      select new ConsignmentDetail
            {
                Consignment_ID = p.Consignment_ID,
                Invoice_ID = p.Invoice_ID.GetValueOrDefault(0),
                Reserve = p.Reserve.GetValueOrDefault(0),
                Cost = p.Cost,
                Amount = p.Amount,
                LinkParams = new LinkParams {
                    EventTitle = p.EventTitle, MainCategoryTitle = p.MainCategoryTitle, CategoryTitle = p.CategoryTitle, Lot = p.Lot.HasValue ? p.Lot.Value : (short)0, Title = p.Title, ID = p.Auction_ID
                },
                CommissionRate = p.CommRate
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //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);
        }
Esempio n. 20
0
        //ClearUserCache
        public void ClearUserCache(long user_id)
        {
            User            user = GetUser(user_id, true);
            DataCacheObject dco  = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.USERS, "GETUSER", new object[] { user.ID }, CachingExpirationTime.Hours_01, user);

            CacheRepository.Remove(dco);
            dco.Params = new object[] { user.Login.ToLower() }; CacheRepository.Remove(dco);
            dco.Method = "GETUSERBYEMAIL";
            dco.Params = new object[] { user.Email.ToLower() };
            CacheRepository.Remove(dco);
        }
        //RemoveEventCacheForListing
        public void RemoveEventCacheForListing(long event_id)
        {
            var dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.CATEGORIES, "GETCATEGORIESMAPTREEPREVIEW", new object[] { event_id });

            CacheRepository.Remove(dco);
            dco.Method = "GETCATEGORIESMAPTREE";
            dco.Params = new object[] { event_id, true };
            CacheRepository.Remove(dco);
            dco.Params = new object[] { event_id, false };
            CacheRepository.Remove(dco);
        }
        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);
        }
Esempio n. 23
0
        //UpdateUser
        private void UpdateUserCache(User user)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.USERS, "GETUSER", new object[] { user.ID }, CachingExpirationTime.Hours_01, user);

            CacheRepository.Put(dco);
            dco.Params = new object[] { user.Login.ToLower() };
            CacheRepository.Put(dco);
            dco.Method = "GETUSERBYEMAIL";
            dco.Params = new object[] { user.Email.ToLower() };
            CacheRepository.Put(dco);
            //CacheRepository.Update(CacheDataKeys.USER_GETUSER, user, new object[] { user.ID });
            //CacheRepository.Update(CacheDataKeys.USER_GETUSER, user, new object[] { user.Login.ToLower() });
            //CacheRepository.Update(CacheDataKeys.USER_GETUSERBYEMAIL, user, new object[] {  });
        }
Esempio n. 24
0
        //GetCountryByID
        public Country GetCountryByID(long ID)
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.COUNTRIES, "GETCOUNTRYBYID", new object[] { ID }, CachingExpirationTime.Days_01);
            Country         result = CacheRepository.Get(dco) as Country;

            if (result != null)
            {
                return(result);
            }
            result = GetCountryList().Where(c => c.ID == ID).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 25
0
        //GetListPage
        public List <Country> GetCountryList()
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.COUNTRIES, "GETCOUNTRYLIST", new object[] { }, CachingExpirationTime.Days_01);
            List <Country>  result = CacheRepository.Get(dco) as List <Country>;

            if (result != null && result.Count() > 0)
            {
                return(result);
            }
            result = dataContext.spCountry_List().ToList();
            if (result.Count() > 0)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 26
0
        //GetStateList
        public List <State> GetStateList(long?country_id)
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.STATES, "GETSTATELIST", new object[] { country_id }, CachingExpirationTime.Days_01);
            List <State>    result = CacheRepository.Get(dco) as List <State>;

            if (result != null && result.Count() > 0)
            {
                return(result);
            }
            result = dataContext.spState_List(country_id).ToList();
            if (result.Count() > 0)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
        //GetEventCategoryById
        public EventCategory GetEventCategoryById(long id)
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETEVENTCATEGORYBYID", new object[] { id }, CachingExpirationTime.Days_01);
            EventCategory   result = CacheRepository.Get(dco) as EventCategory;

            if (result != null)
            {
                return(result);
            }
            result = dataContext.spSelect_EventCategory(id).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 28
0
        //GetVariables
        private List <Variable> GetVariables()
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.COUNTRIES, "GETVARIABLES", new object[] { }, CachingExpirationTime.Days_01);
            List <Variable> result = CacheRepository.Get(dco) as List <Variable>;

            if (result != null)
            {
                return(result);
            }
            result = dataContext.spSelect_Variable().ToList();
            if (result.Count() > 0)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }
Esempio n. 29
0
        //GetCurrent()
        public Event GetCurrent()
        {
            DataCacheObject dco  = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETCURRENT", null, CachingExpirationTime.Hours_01);
            Event           evnt = CacheRepository.Get(dco) as Event;

            if (evnt != null)
            {
                return(evnt);
            }
            evnt = dataContext.spEvent_Current().FirstOrDefault();
            if (evnt != null)
            {
                dco.Data = evnt;
                CacheRepository.Add(dco);
            }
            return(evnt);
        }
        //GetCategoryMapById
        public CategoriesMap GetCategoryMapById(long id)
        {
            DataCacheObject dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.CATEGORIES, "GETCATEGORYMAPBYID", new object[] { id }, CachingExpirationTime.Days_01);
            CategoriesMap   result = CacheRepository.Get(dco) as CategoriesMap;

            if (result != null)
            {
                return(result);
            }
            result = dataContext.spSelect_CategoriesMap(id).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }