public async Task SetBalanceAsync(string ownerId, string ownerType, decimal newBalance) { var oldBalance = await m_Database.GetBalanceAsync(ownerId, ownerType); await m_Database.SetBalanceAsync(ownerId, ownerType, newBalance); var getBalanceEvent = new BalanceUpdatedEvent(ownerId, ownerType, oldBalance, newBalance, "Set Balance Requested"); await m_EventBus.EmitAsync(EconomyPlugin.Instance, this, getBalanceEvent); }
public async Task SetBalanceAsync(string ownerId, string ownerType, decimal newBalance) { var oldBalance = await m_Database.GetBalanceAsync(ownerId, ownerType); await m_Database.SetBalanceAsync(ownerId, ownerType, newBalance); var getBalanceEvent = new BalanceUpdatedEvent(ownerId, ownerType, oldBalance, newBalance, "Set Balance Requested"); await EventBus.EmitAsync(OpenModComponent, this, getBalanceEvent); }
public async Task Handle(BalanceUpdatedEvent evt) { await _cachedWalletsRepository.UpdateBalanceAsync( evt.WalletId, evt.AssetId, decimal.Parse(evt.Balance), decimal.Parse(evt.Reserved), evt.SequenceNumber); _chaosKitty.Meow("Problem with Azure Table Storage"); }
public async Task Handle( BalanceUpdatedEvent evt) { if (evt.AssetId == _neoAssetId) { await _balanceService.RegisterBalanceUpdateAsync ( walletId : Guid.Parse(evt.WalletId), eventTimestamp : evt.Timestamp, newBalance : decimal.Parse(evt.Balance) ); } }
public async Task <decimal> UpdateBalanceAsync(string ownerId, string ownerType, decimal amount, string reason) { if (amount == 0) { throw new UserFriendlyException(StringLocalizer["economy:fail:invalid_amount", new { Amount = amount }]); } var oldBalance = await m_Database.GetBalanceAsync(ownerId, ownerType); var balance = await m_Database.UpdateBalanceAsync(ownerId, ownerType, amount, reason); var getBalanceEvent = new BalanceUpdatedEvent(ownerId, ownerType, oldBalance, balance, reason); await m_EventBus.EmitAsync(EconomyPlugin.Instance, this, getBalanceEvent); return(balance); }
public override void Handle(BalanceUpdatedEvent message) { base.Handle(message); this.NotifyProperties(); }
public void Apply(BalanceUpdatedEvent domainEvent) { Console.WriteLine("Apply BalanceUpdatedEvent {0}", domainEvent.Balance); this.balance = domainEvent.Balance; }
private void OnPostBalanceUpdated(string id, decimal increaseBy, decimal amt) { var @event = new BalanceUpdatedEvent(id, KnownActorTypes.Player, amt - increaseBy, amt, null); AsyncHelper.RunSync(() => m_EventBus.EmitAsync(m_RocketModComponent, this, @event)); }