예제 #1
0
        private void SaveTransactionButton_Click(object sender, RoutedEventArgs e)
        {
            Transaction newTransaction = new Transaction();

            double amount;
            string amountString = TransactionAmount.Text.Replace("$", "").TrimStart();

            if (Double.TryParse(amountString, out amount))
            {
                newTransaction.Amount = amount;
            }

            string destinationString = ((ListItem)TransactionDestination.SelectedItem).Value;
            int destination = int.Parse(destinationString);

            newTransaction.DestinationAccount = destination;
            newTransaction.IsRecurrent = false;
            newTransaction.RecurrenceRule = null;
            newTransaction.Notes = TransactionNotes.Text;

            ViewModel<Transaction> transactionVM = new ViewModel<Transaction>();
            transactionVM.Insert(newTransaction);

            List<Transaction> transactions = transactionVM.FetchAll();
        }
예제 #2
0
        private void InitializeAccountItems()
        {
            ViewModel<Account> accountVM = new ViewModel<Account>();
            List<Account> accounts = accountVM.FetchAll();
            List<AccountsListItem> accountListItems = new List<AccountsListItem>(accounts.Count);

            foreach (Account account in accounts)
            {
                accountListItems.Add(new AccountsListItem(account));
            }

            this.DefaultViewModel["Items"] = accountListItems;
        }