예제 #1
0
 private void GetData()
 {
     GetLastTransactions();
     CurrentCard       = _moneyService.GetCurrentCard();
     CurrentCash       = _moneyService.GetCurrentCash();
     CurrentCredit     = _moneyService.GetCurrentCredit();
     CurrentAllSavings = _moneyService.GetAllSavings();
     if (_settingsService.GetBalanceSettings())
     {
         CurrentBill = CurrentCard + CurrentCash + CurrentAllSavings;
     }
     else
     {
         CurrentBill = CurrentCard + CurrentCash;
     }
     IsCreditVisible = CurrentCredit > 0 ? true : false;
     IsMinusAllowed  = _settingsService.GetAutoCreditSettings();
 }
예제 #2
0
        private async Task GetDataAsync()
        {
            MyCash       = _moneyService.GetCurrentCash();
            MyCard       = _moneyService.GetCurrentCard();
            MyCurrent    = MyCash + MyCard;
            MyCredit     = _moneyService.GetCurrentCredit();
            MyAllSavings = _moneyService.GetAdditionalSavings();

            var date = DateTime.Now;
            var data = await _transactionService.GetAll();

            if (data != null && data?.Count > 0)
            {
                foreach (var note in data)
                {
                    switch (note.Type)
                    {
                    case TransactionType.Spend:
                        MyAllOutlay += note.Value;
                        if (note.Date.Month == date.Month && note.Date.Year == date.Year)
                        {
                            MyOutlay += note.Value;
                        }
                        break;

                    case TransactionType.Add:
                        MyAllIncome += note.Value;
                        if (note.Date.Month == date.Month && note.Date.Year == date.Year)
                        {
                            MyIncome += note.Value;
                        }
                        break;

                    case TransactionType.Save:
                        if (note.MathSymbol == '-')
                        {
                            MyAllSavings += note.Value;
                            if (note.Date.Month == date.Month && note.Date.Year == date.Year)
                            {
                                MySavings += note.Value;
                            }
                        }
                        else
                        {
                            MyAllSavings -= note.Value;
                            if (note.Date.Month == date.Month && note.Date.Year == date.Year)
                            {
                                MySavings -= note.Value;
                            }
                        }
                        break;

                    case TransactionType.None:
                    case TransactionType.Bank:
                    default:
                        break;
                    }
                }

                MyAll = MyCurrent + MyAllSavings;
            }
        }