//DepositNeeded public decimal DepositNeeded(decimal amount, long user_id, bool isneedonlymaxdeposit, long event_id, long auction_id) { DataCacheObject dco = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.USERS, "NOTNEEDDEPOSIT", new object[] { event_id, user_id }, CachingExpirationTime.Days_01); bool? result = (bool?)CacheRepository.Get(dco); if (result.HasValue && result.Value) { return(0); } DataCacheObject dcol = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.USERS, "USERWINLOTS", new object[] { event_id, user_id }, CachingExpirationTime.Hours_01); Dictionary <long, decimal> winlots = CacheRepository.Get(dcol) as Dictionary <long, decimal>; if (winlots == null || !winlots.Any()) { winlots = new Dictionary <long, decimal>(); dataContext.spBid_UserWinningBids(event_id, user_id).ToList().ForEach(q => winlots.Add(q.Auction_ID, q.MaxBid.GetValueOrDefault(0))); dcol.Data = winlots; CacheRepository.Add(dcol); } decimal maxbid = winlots.Where(q => q.Key != auction_id).Select(q => q.Value).Sum() + amount; if ((maxbid < Consts.TopDepositLimit && isneedonlymaxdeposit) || maxbid < Consts.BottomDepositLimit) { return(0); } decimal deposit = dataContext.fUser_GetDeposit(user_id, event_id).GetValueOrDefault(0); if (deposit >= Consts.TopDepositLimitAmount * 0.1M) { dco.Data = true; CacheRepository.Add(dco); return(0); } return((maxbid >= Consts.BottomDepositLimit && maxbid < Consts.TopDepositLimit ? Consts.BottomDepositLimitAmount : Consts.TopDepositLimitAmount) * 0.1M - deposit); }