Esempio n. 1
0
        public void Can_log_VIP_Level_Updated()
        {
            var @event = new VipLevelUpdated();

            _serviceBus.PublishMessage(@event);
            AssertAdminActivityLog(@event, AdminActivityLogCategory.VipLevel);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 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();
        }
Esempio n. 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);
 }
Esempio n. 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();
 }