Exemplo n.º 1
0
        private async void ExpenseData()
        {
            int daysToShow = (DateTime.Now - datepicker.Date).Days;
            var _expenses  = await exp.GetExpenses(App.ownerId, daysToShow, -1);

            expenses.Clear();
            foreach (var expense in _expenses)
            {
                expenses.Add(expense);
            }
        }
Exemplo n.º 2
0
        private async void MainData()
        {
            var expenses = await exp.GetExpenses(App.ownerId, -1, -1);

            var incomes = await inp.GetIncomes(App.ownerId, -1, -1);

            float esum = 0;
            float isum = 0;

            foreach (var expense in expenses)
            {
                esum += expense.Moneyused;
            }
            foreach (var income in incomes)
            {
                isum += income.Moneyrecieved;
            }

            expenses = new List <ExpenseDTO>(expenses.OrderByDescending(e => e.Expensetime));
            incomes  = new List <IncomeDTO>(incomes.OrderByDescending(e => e.Incometime));

            this.expenses.Clear();
            foreach (var expense in expenses)
            {
                if (this.expenses.Count < 5)
                {
                    this.expenses.Add(expense);
                }
            }
            this.incomes.Clear();
            foreach (var income in incomes)
            {
                if (this.incomes.Count < 5)
                {
                    this.incomes.Add(income);
                }
            }
            yourMoney.Text = String.Format("Current money: {0:0.00}$", isum - esum);
        }