private void OnPromotionApplied(PromotionApplied @event) { Interlocked.Increment(ref _usages); int usagesForThisUser; _usagesPerUser.TryGetValue(@event.AccountId, out usagesForThisUser); _usagesPerUser[@event.AccountId] = Interlocked.Increment(ref usagesForThisUser); _orderIds.Add(@event.OrderId); _usersWhiteList.Remove(@event.AccountId); }
public void Handle(PromotionApplied @event) { using (var context = _contextFactory.Invoke()) { var orderReport = context.Find <OrderReportDetail>(@event.OrderId); if (orderReport != null) { orderReport.Promotion.WasApplied = true; orderReport.Promotion.Code = @event.Code; context.Save(orderReport); } } }
public void Handle(PromotionApplied @event) { using (var context = _contextFactory.Invoke()) { var account = context.Find <AccountDetail>(@event.AccountId); context.Save(new PromotionUsageDetail { OrderId = @event.OrderId, PromoId = @event.SourceId, AccountId = @event.AccountId, UserEmail = account.Email, Code = @event.Code, DiscountType = @event.DiscountType, DiscountValue = @event.DiscountValue }); } }