示例#1
0
 public AccountDialog(AccountViewModel account, AccountancyApplication accountancyApplication)
 {
     Users = accountancyApplication.Users;
     AccountInfo = account;
     InitializeComponent();
     txtName.SelectAll();
 }
 public void DeleteAccountTest()
 {
     PersonViewModel person1 = Application.GetPerson(Database.User1Id);
     Assert.IsNotNull(person1);
     AccountViewModel account = Application.GetAccount(Database.User1Cash);
     Account undAccount = account.UnderlyingData;
     Assert.IsNotNull(account);
     Assert.IsTrue(person1.UserAccounts.Contains(account));
     Application.DeleteAccount(account);
     account = Application.GetAccount(Database.User1Cash);
     Assert.IsNull(account);
     Assert.IsFalse(person1.UserAccounts.Contains(account));
     account = new AccountViewModel(undAccount, Application);
     Application.AddAccount(account);
     Assert.IsTrue(person1.UserAccounts.Contains(account));
 }
示例#3
0
 public void UpdateAccount(AccountViewModel account)
 {
     m_database.Update(account.UnderlyingData);
 }
示例#4
0
 public void TransferWithConversion(AccountViewModel source, AccountViewModel target, long amount, double rate)
 {
     // todo: "all or nothing" semantics
     string description = string.Format("{0} -> {1}", source, target);
     AddExpense(new ExpenseViewModel(amount, DefaultTransferOutCategory, source, description, this));
     AddExpense(new ExpenseViewModel((long) (amount * rate), DefaultTransferInCategory, target, description, this));
 }
示例#5
0
 public AccountBalance GetAccountState(AccountViewModel account)
 {
     // todo: move to account
     return m_database.GetBalance(account.AccountId);
 }
示例#6
0
 public void DeleteAccount(AccountViewModel account)
 {
     m_database.Delete(account.UnderlyingData);
     account.Owner.UserAccounts.Remove(account);
     m_accountCache.Remove(account.AccountId);
 }
示例#7
0
 public void AddAccount(AccountViewModel account)
 {
     // todo: add account to particular person specified
     Account refAccount = account.UnderlyingData;
     m_database.Add(ref refAccount);
     account.UnderlyingData = refAccount;
     account.Owner.UserAccounts.Add(account);
     m_accountCache.Add(account.AccountId, account);
 }
示例#8
0
 public ExpenseViewModel(long amount, CategoryViewModel category, AccountViewModel account, string description, AccountancyApplication app)
     : this(new Expense(0, account.AccountId, amount, category.CategoryId, app.SelectedDate, description), app)
 {
 }