private void UpdateBalances()
 {
     Balances.Clear();
     if (SelectedTicket == null)
     {
         return;
     }
     foreach (var ticketEntity in SelectedTicket.TicketEntities)
     {
         if (ticketEntity.AccountId > 0)
         {
             var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
             if (_applicationState.GetPaymentScreenPaymentTypes().Any(x => x.AccountTransactionType.TargetAccountTypeId == entityType.AccountTypeId))
             {
                 var balance = _accountDao.GetAccountBalance(ticketEntity.AccountId);
                 balance +=
                     SelectedTicket.Payments.Where(
                         x =>
                         x.Id == 0 &&
                         x.AccountTransaction.AccountTransactionValues.Any(
                             y => y.AccountId == ticketEntity.AccountId)).Sum(x => x.Amount);
                 Balances.Add(ticketEntity.AccountId, balance);
             }
         }
     }
 }
 public void Initialization()
 {
     foreach (var balance in _dbWorker.GetBalances())
     {
         Balances.Add(new BalanceViewModel(balance));
     }
 }
Exemple #3
0
        private async void AddBalance()
        {
            if (Balance != 0 && BalanceCategory != null)
            {
                if (BalanceForEdit == null)
                {
                    Balances.Add(new Balance(IsPlusPage ? Balance : -Balance, Currency, BalanceCategory));
                }
                else
                {
                    for (int i = 0; i < Balances.Count; i++)
                    {
                        if (Balances[i] == BalanceForEdit)
                        {
                            Balances[i] = new Balance(Balance, Currency, BalanceCategory);
                        }
                    }
                }

                Balance         = default(double);
                Currency        = default(Currencies);
                BalanceCategory = default(Category);
                BalanceForEdit  = default(Balance);

                await(Application.Current.MainPage as MasterDetailPage).Detail.Navigation.PopAsync();
            }
        }
 internal void UpdateData()
 {
     Balances.Clear();
     foreach (var balance in _dbWorker.GetBalances())
     {
         Balances.Add(new BalanceViewModel(balance));
     }
 }
Exemple #5
0
        internal void CompoundAndContribute(double ret, double contribution)
        {
            var prevValue = Balances.Last();
            var currValue = prevValue * (1 + ret) + contribution;

            Balances.Add(currValue);
            CashFlows.Add(-1 * contribution);
        }
        private void Initial()
        {
            bool isStop = false;

            while (!isStop)
            {
                Teachers.Add(TeacherGenerator());
                if (Teachers.Count > 4)
                {
                    isStop = true;
                }
            }
            Balances.Add(BalanceGenerator());
            StockGenerator();
        }
 private void UpdateBalances()
 {
     Balances.Clear();
     foreach (var ticketEntity in SelectedTicket.TicketEntities)
     {
         if (ticketEntity.AccountId > 0)
         {
             var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
             if (_applicationState.GetPaymentScreenPaymentTypes().Any(x => x.AccountTransactionType.TargetAccountTypeId == entityType.AccountTypeId))
             {
                 var balance = _accountService.GetAccountBalance(ticketEntity.AccountId);
                 Balances.Add(ticketEntity.AccountId, balance);
             }
         }
     }
 }
        public async Task <Exception> TryUpdateAccountInfo(UserInfo userInfo)
        {
            if (!ConnectedUsers.ContainsKey(userInfo.Id))
            {
                return(new ValidationException(string.Empty));
            }

            var response = await TryRunTask <string, AccountInfoResponse>(GetAccountInfo, OnDisposeCts.Token, userInfo.Login);

            if (response.IsSuccess)
            {
                ConnectedUsers[userInfo.Id].AccountInfo = response.Result;
                var responseBalances = response.Result.Balances;
                responseBalances.ForEach(x => x.UserInfo = ConnectedUsers[userInfo.Id]);
                lock (Balances)
                {
                    responseBalances.ForEach(x =>
                    {
                        var balanceInd = Balances.FindIndex(y => y.UserInfo.Id == x.UserInfo.Id && y.CurrencyType == x.CurrencyType);
                        if (balanceInd >= 0)
                        {
                            Balances[balanceInd] = x;
                        }
                        else
                        {
                            Balances.Add(x);
                        }
                    });
                }
            }
            else
            {
                return(response.Exception);
            }

            var historyResp = await TryRunTask <string, AccountHistoryResponse[]>(GetAccountHistory, OnDisposeCts.Token, userInfo.Login);

            if (historyResp.IsSuccess)
            {
                ConnectedUsers[userInfo.Id].AccountHistory = historyResp.Result;
                return(null);
            }

            return(historyResp.Exception);
        }
Exemple #9
0
 public Trial(double initialValue)
 {
     Balances.Add(initialValue);
     CashFlows.Add(-1 * initialValue);
 }
 public void AddBalanceInformation(BalanceInformation balance)
 {
     AddBalanceInformationToListView(balance);
     Balances.Add(balance);
 }