Ejemplo n.º 1
0
        private void GetEverything()
        {
            foreach (var item in IncomeDatabase.GetIncomes())
            {
                Income_Total += item.Amount;
            }
            Inc_Total.Text = Income_Total.ToString();



            foreach (var item in ExpensesDatabase.GetExpenses())
            {
                Expense_Total += item.Amount;
            }
            Ex_Total.Text = Expense_Total.ToString();

            Balance = Income_Total - Expense_Total;
            if (Balance > 0)
            {
                Total_Balance.Text      = Balance.ToString();
                Total_Balance.TextColor = Color.Green;
            }
            else
            {
                Total_Balance.Text      = Balance.ToString();
                Total_Balance.TextColor = Color.Red;
            }

            Income_Total  = 0;   //reset total since it's always calculated about
            Expense_Total = 0;
        }
        public ExpensesList()
        {
            InitializeComponent();


            ExpenseDatabase = new ExpensesDatabaseController();
            if (ExpenseDatabase.GetExpenses() != null)
            {
                _expenses = new ObservableCollection <Expense>(ExpenseDatabase.GetExpenses());
            }



            _ExpensesList.ItemsSource = _expenses;


            // GetExpenses();//display Expenses
        }