public IEnumerator Run( Client client, GameSession session, string moneyNamespaceName, int slot, GetWalletEvent onGetWallet, DepositEvent onDeposit, WithdrawEvent onWithdraw, ErrorEvent onError ) { if (_watching) { throw new InvalidOperationException("already started"); } _watching = true; _client = client; _session = session; _moneyNamespaceName = moneyNamespaceName; _slot = slot; _onGetWallet = onGetWallet; _onDeposit = onDeposit; _onWithdraw = onWithdraw; _onError = onError; _onDeposit.AddListener(DepositAction); _onWithdraw.AddListener(WithdrawAction); yield return(Refresh()); }
void WithdrawHandler(DialogueMgr.BTNS btn) { if (btn == DialogueMgr.BTNS.Btn1) { mEvent = new WithdrawEvent(new EventDelegate(this, "WithdrawComplete")); NetMgr.Withdraw(mEvent); } }
public static void Withdraw(Int32 pzn, Int32 quantity, DateTime dateOfAction) { using (PharmacyContainer db = new PharmacyContainer()) { Drug drug = GetDrug(pzn, db); drug.Apply(WithdrawEvent.Create(drug, quantity, dateOfAction)); db.SaveChanges(); } }
public JournaledAccountGrainState Apply(WithdrawEvent @event) { Balance -= @event.Amount; _transactions.Add(new Transaction { Amount = @event.Amount, BookingDate = DateTime.Now }); return(this); }
public static IEnumerator Withdraw( Client client, GameSession session, string moneyNamespaceName, EzWallet wallet, int value, bool paidOnly, WithdrawEvent onWithdraw, GetWalletEvent onGetWallet, ErrorEvent onError ) { AsyncResult <EzWithdrawResult> result = null; yield return(client.Money.Withdraw( r => { result = r; }, session, moneyNamespaceName, wallet.Slot, value, paidOnly )); if (result.Error != null) { onError.Invoke( result.Error ); yield break; } wallet = result.Result.Item; onWithdraw.Invoke(wallet, value); onGetWallet.Invoke(wallet); }