Exemple #1
0
        public void Can_log_VIP_Level_Updated()
        {
            var @event = new VipLevelUpdated();

            _serviceBus.PublishMessage(@event);
            AssertAdminActivityLog(@event, AdminActivityLogCategory.VipLevel);
        }
        public void Handle(VipLevelUpdated updatedEvent)
        {
            //todo: refactor updatedEvent.Id
            var repository = _container.Resolve <IReportRepository>();
            var records    = repository.VipLevelRecords.Where(r => r.VipLevelId == updatedEvent.Id);

            if (!records.Any())
            {
                throw new RegoException(string.Format("Vip level record with id '{0}' was not found", updatedEvent.Id));
            }

            var brand = _container.Resolve <BrandQueries>().GetBrandOrNull(updatedEvent.BrandId);

            foreach (var record in records)
            {
                record.Licensee  = brand.Licensee.Name;
                record.Brand     = brand.Name;
                record.Code      = updatedEvent.Code;
                record.Rank      = updatedEvent.Rank;
                record.Updated   = updatedEvent.EventCreated;
                record.UpdatedBy = updatedEvent.EventCreatedBy;
            }
            UpdateReportBetLimits(repository, records.First(), updatedEvent.VipLevelLimits, updatedEvent.BrandId);
            repository.SaveChanges();
        }
        public void Consume(VipLevelUpdated @event)
        {
            var vipLevel = _repository.VipLevels
                           .Include(x => x.VipLevelLimits)
                           .Single(x => x.Id == @event.Id);

            vipLevel.VipLevelLimits.Clear();
            vipLevel.VipLevelLimits = @event.VipLevelLimits.Select(x => new VipLevelGameProviderBetLimit
            {
                VipLevelId     = x.VipLevelId,
                BetLimitId     = x.BetLimitId,
                GameProviderId = x.GameProviderId,
                CurrencyCode   = x.CurrencyCode
            }).ToList();

            var vipLevelBetLimitGroup = _repository.VipLevelBetLimitGroups.SingleOrDefault(blg => blg.VipLevelId == @event.Id);

            if (vipLevelBetLimitGroup != null)
            {
                _repository.VipLevelBetLimitGroups.Remove(vipLevelBetLimitGroup);
            }

            var betLimitGroup = _repository.BetLimitGroups.SingleOrDefault(blg => blg.Name == @event.Name);

            if (betLimitGroup != null)
            {
                _repository.VipLevelBetLimitGroups.Add(new VipLevelBetLimitGroup()
                {
                    VipLevelId      = @event.Id,
                    BetLimitGroupId = betLimitGroup.Id
                });
            }

            _repository.SaveChanges();
        }
Exemple #4
0
        public void Consume(VipLevelUpdated @event)
        {
            var vipLevel = _playerRepository.VipLevels.Single(x => x.Id == @event.Id);

            vipLevel.BrandId     = @event.BrandId;
            vipLevel.Code        = @event.Code;
            vipLevel.Name        = @event.Name;
            vipLevel.Rank        = @event.Rank;
            vipLevel.Description = @event.Description;
            vipLevel.ColorCode   = @event.ColorCode;

            _playerRepository.SaveChanges();
        }
Exemple #5
0
        public void Consume(VipLevelUpdated @event)
        {
            var paymentRepository = _container.Resolve <IPaymentRepository>();

            var vipLevel = paymentRepository.VipLevels.FirstOrDefault(x => x.Id == @event.Id);

            if (vipLevel == null)
            {
                throw new RegoException("No appropriate Vip Level found. Brand: " + @event.BrandId + " Code: " + @event.Code);
            }

            vipLevel.BrandId = @event.BrandId;
            vipLevel.Name    = @event.Name;

            paymentRepository.SaveChanges();
        }
 public void Consume(VipLevelUpdated message)
 {
     _eventHandlers.Handle(message);
 }
Exemple #7
0
 public void Handle(VipLevelUpdated @event)
 {
     AddActivityLog(AdminActivityLogCategory.VipLevel, @event);
 }
 public void Consume(VipLevelUpdated message)
 {
     _repository.VipLevels.Single(x => x.Id == message.Id).Name = message.Name;
     _repository.SaveChanges();
 }