/* * Updates the recent transactions and income lists * */ public void update() { ObservableCollection <MoneyData> result = new ObservableCollection <MoneyData>(); MoneyData myColl; for (int i = 0; i < currentUser.ExpensesList.Count; i++) { myColl = new MoneyData(0, "0"); myColl.Amount = currentUser.ExpensesList[i].Amount; myColl.PrimaryType = currentUser.ExpensesList[i].PrimaryType.ToString(); myColl.Date = currentUser.ExpensesList[i].Date;//.ToString(); result.Add(myColl); } ObservableCollection <MoneyData> result2 = new ObservableCollection <MoneyData>(); for (int i = 0; i < currentUser.IncomeList.Count; i++) { myColl = new MoneyData(0, "0"); myColl.Amount = currentUser.IncomeList[i].Amount; myColl.PrimaryType = currentUser.IncomeList[i].PrimaryType.ToString(); myColl.Date = currentUser.IncomeList[i].Date;//.ToString(); result2.Add(myColl); } transactionList.ItemsSource = result; incomeList.ItemsSource = result2; }
/* * * Stores the information in the different fields related to this expenditure * */ private void expenditures_Button_Click(object sender, RoutedEventArgs e) { String amt = Expenditures_Amount.GetLineText(0); String type1 = Expenditures_Prim_Type.GetLineText(0); try { double amount = Convert.ToDouble(amt); MoneyData x = new MoneyData(amount, type1); currentUser.ExpensesList.Add(x); update(); } catch { MessageBox.Show("Enter a valid amount"); } Expenditures_Amount.Text = "Enter Amount"; Expenditures_Prim_Type.Text = "Enter Category"; }