Beispiel #1
0
        public void DBGetAccountBalancesSet(string mobile)
        {
            try
            {
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);
                if (result.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < result.Tables[0].Rows.Count; i++)
                    {
                        Account newAccount = new Account();
                        newAccount.accountName    = result.Tables[0].Rows[i][""].ToString();
                        newAccount.accountBalance = result.Tables[0].Rows[i][""].ToString();

                        AccountBalances.Add(newAccount);
                    }
                }
                else
                {
                    AccountBalances = null;
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
            }
        }
        public PaymentEditorViewModel(IApplicationState applicationState,
                                      TicketTotalsViewModel paymentTotals, PaymentEditor paymentEditor, NumberPadViewModel numberPadViewModel,
                                      OrderSelectorViewModel orderSelectorViewModel, ITicketService ticketService,
                                      ForeignCurrencyButtonsViewModel foreignCurrencyButtonsViewModel, PaymentButtonsViewModel paymentButtonsViewModel,
                                      CommandButtonsViewModel commandButtonsViewModel, TenderedValueViewModel tenderedValueViewModel,
                                      ReturningAmountViewModel returningAmountViewModel, ChangeTemplatesViewModel changeTemplatesViewModel, AccountBalances accountBalances)
        {
            _applicationState                = applicationState;
            _paymentTotals                   = paymentTotals;
            _paymentEditor                   = paymentEditor;
            _numberPadViewModel              = numberPadViewModel;
            _orderSelectorViewModel          = orderSelectorViewModel;
            _ticketService                   = ticketService;
            _foreignCurrencyButtonsViewModel = foreignCurrencyButtonsViewModel;
            _commandButtonsViewModel         = commandButtonsViewModel;
            _tenderedValueViewModel          = tenderedValueViewModel;
            _returningAmountViewModel        = returningAmountViewModel;
            _changeTemplatesViewModel        = changeTemplatesViewModel;
            _accountBalances                 = accountBalances;

            _makePaymentCommand             = new CaptionCommand <PaymentType>("", OnMakePayment, CanMakePayment);
            _selectChangePaymentTypeCommand = new CaptionCommand <PaymentData>("", OnSelectChangePaymentType);

            ClosePaymentScreenCommand = new CaptionCommand <string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen);
            paymentButtonsViewModel.SetButtonCommands(_makePaymentCommand, null, ClosePaymentScreenCommand);
        }
        public AccountBalances GetAccountBalances(int accountId)
        {
            var tableBalances = m_db.Query <TableAccountBalances>(
                "select * from dbo.AccountBalances where account_id = @0", accountId);
            var rt = new AccountBalances(tableBalances);

            return(rt);
        }
 protected async Task HandleValidSubmit()
 {
     _output = null;
     await _network.ExecuteAsync(_input.Gateway, null, async client =>
     {
         _output = await client.GetAccountBalancesAsync(_input.Address);
     });
 }
        public AccountBalances GetAccountBalances(string accountGuid)
        {
            var accountId     = Utils.DbUtils.GetIdByGuid(accountGuid, "dbo.Accounts", "account_guid");
            var tableBalances = m_db.Query <TableAccountBalances>(
                "select * from dbo.AccountBalances where account_id = @0", accountId);
            var rt = new AccountBalances(tableBalances);

            return(rt);
        }
 public static AccountBalancesContract ToContract(this AccountBalances balances)
 {
     return(new AccountBalancesContract
     {
         SafeBalance = balances.SafeBalance,
         ConfirmedBalance = balances.ConfirmedBalance,
         PendingBalance = balances.PendingBalance
     });
 }
 public bool TryGetAccountBalances(string address, out AccountBalances balances)
 {
     if (_accountBalances.ContainsKey(address))
     {
         balances = _accountBalances[address];
         return(true);
     }
     else
     {
         balances = null;
         return(false);
     }
 }
Beispiel #8
0
        public PaymentEditor(IApplicationState applicationState, ITicketService ticketService, AccountBalances accountBalances)
        {
            _applicationState = applicationState;
            _ticketService    = ticketService;
            _accountBalances  = accountBalances;
            _selectedTicket   = Ticket.Empty;

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(x =>
            {
                if (SelectedTicket != Ticket.Empty && x.Topic == EventTopicNames.CloseTicketRequested)
                {
                    SelectedTicket = Ticket.Empty;
                }
            });
        }
        public NumberPadViewModel(ISettingService settingService, PaymentEditor paymentEditor, TenderedValueViewModel tenderedValueViewModel,
                                  OrderSelectorViewModel orderSelectorViewModel, AccountBalances accountBalances,
                                  ForeignCurrencyButtonsViewModel foreignCurrencyButtonsViewModel, TicketTotalsViewModel paymentTotals)
        {
            _settingService                  = settingService;
            _paymentEditor                   = paymentEditor;
            _tenderedValueViewModel          = tenderedValueViewModel;
            _orderSelectorViewModel          = orderSelectorViewModel;
            _accountBalances                 = accountBalances;
            _foreignCurrencyButtonsViewModel = foreignCurrencyButtonsViewModel;
            _paymentTotals                   = paymentTotals;

            TenderAllCommand         = new CaptionCommand <string>(Resources.All, OnTenderAllCommand);
            ChangeBalanceModeCommand = new DelegateCommand <string>(OnChangeBalanceMode);
            TypeValueCommand         = new DelegateCommand <string>(OnTypeValueExecuted);
            SetValueCommand          = new DelegateCommand <string>(OnSetValue);
            DivideValueCommand       = new DelegateCommand <string>(OnDivideValue);
        }
Beispiel #10
0
        public PosViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
                            ITicketService ticketService, ITicketServiceBase ticketServiceBase, IUserService userService, ICacheService cacheService, IMessagingService messagingService,
                            TicketListViewModel ticketListViewModel, TicketTagListViewModel ticketTagListViewModel, MenuItemSelectorViewModel menuItemSelectorViewModel,
                            MenuItemSelectorView menuItemSelectorView, TicketViewModel ticketViewModel, TicketOrdersViewModel ticketOrdersViewModel,
                            TicketEntityListViewModel ticketEntityListViewModel, TicketTypeListViewModel ticketTypeListViewModel, AccountBalances accountBalances)
        {
            _ticketService             = ticketService;
            _ticketServiceBase         = ticketServiceBase;
            _userService               = userService;
            _cacheService              = cacheService;
            _messagingService          = messagingService;
            _applicationState          = applicationState;
            _applicationStateSetter    = applicationStateSetter;
            _regionManager             = regionManager;
            _menuItemSelectorView      = menuItemSelectorView;
            _ticketViewModel           = ticketViewModel;
            _ticketOrdersViewModel     = ticketOrdersViewModel;
            _menuItemSelectorViewModel = menuItemSelectorViewModel;
            _ticketListViewModel       = ticketListViewModel;
            _ticketTagListViewModel    = ticketTagListViewModel;
            _ticketEntityListViewModel = ticketEntityListViewModel;
            _ticketTypeListViewModel   = ticketTypeListViewModel;
            _accountBalances           = accountBalances;

            EventServiceFactory.EventService.GetEvent <GenericEvent <Order> >().Subscribe(OnOrderEventReceived);
            EventServiceFactory.EventService.GetEvent <GenericEvent <Ticket> >().Subscribe(OnTicketEventReceived);
            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(OnTicketEvent);
            EventServiceFactory.EventService.GetEvent <GenericEvent <ScreenMenuItemData> >().Subscribe(OnMenuItemSelected);
            EventServiceFactory.EventService.GetEvent <GenericIdEvent>().Subscribe(OnTicketIdPublished);
            EventServiceFactory.EventService.GetEvent <GenericEvent <OperationRequest <Entity> > >().Subscribe(OnEntitySelectedForTicket);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketTagGroup> >().Subscribe(OnTicketTagSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketStateData> >().Subscribe(OnTicketStateSelected);
            EventServiceFactory.EventService.GetEvent <GenericEvent <TicketType> >().Subscribe(OnTicketTypeChanged);

            EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe(
                x =>
            {
                if (x.Topic == EventTopicNames.ResetCache && _applicationState.CurrentTicketType != null)
                {
                    _menuItemSelectorViewModel.Reset();
                    _menuItemSelectorViewModel.UpdateCurrentScreenMenu(_applicationState.CurrentTicketType.GetScreenMenuId(_applicationState.CurrentTerminal));
                }
            });
        }
        public AccountBalances GetAccountBalances()
        {
            GetAccountBalancesResponse response = _proxy.GetAccountBalances(new GetAccountBalancesRequest());

            if (response.ReturnStatus.Code != 0)
            {
                throw new Exception(response.ReturnStatus.Description);
            }


            AccountBalances balances = new AccountBalances();

            balances.Currency       = response.Currency;
            balances.AvailableFunds = response.AvailableFunds;
            balances.Balance        = response.Balance;
            balances.Credit         = response.Credit;
            balances.Exposure       = response.Exposure;
            return(balances);
        }
Beispiel #12
0
        public void Deposits_and_withdraws_should_not_interfere_with_each_other()
        {
            var SUT = new YakShayBus();
            // register all types under test
            SUT.RegisterType<Account>();
            SUT.RegisterType<AccountTransferSaga>();
            SUT.RegisterType<AccountBalances>();

            var ms = new MessageStore();

            SUT.HandleUntilAllConsumed(Message.FromAction(x => x.RegisterAccount(AccountId: "account/1", OwnerName: "Tom")), ms.Add, ms.Filter);
            SUT.HandleUntilAllConsumed(Message.FromAction(x => x.RegisterAccount(AccountId: "account/2", OwnerName: "Ben")), ms.Add, ms.Filter);
            SUT.HandleUntilAllConsumed(Message.FromAction(x => x.DepositAmount(AccountId: "account/1", Amount: 126m)), ms.Add, ms.Filter);
            SUT.HandleUntilAllConsumed(Message.FromAction(x => x.DepositAmount(AccountId: "account/2", Amount: 10m)), ms.Add, ms.Filter);
            SUT.HandleUntilAllConsumed(Message.FromAction(x => x.Transfer(AccountId: "account/1", TargetAccountId: "account/2", Amount: 26m)), ms.Add, ms.Filter);
            SUT.HandleUntilAllConsumed(Message.FromAction(x => x.WithdrawAmount(AccountId: "account/2", Amount: 10m)), ms.Add, ms.Filter);

            var bal = new AccountBalances();
            SUT.ApplyHistory(bal, ms.Filter);
            bal.Balances.Count.ShouldBe(2);
            bal.Balances["account/1"].ShouldBe(100m);
            bal.Balances["account/2"].ShouldBe(26m);
        }