public AccountViewModel(Account account, IAccountancyApplication accountancyApplication, PersonViewModel owner) { m_accountancyApplication = accountancyApplication; m_underlyingData = account; Name = account.name; Currency = account.currency; AccountType = account.type; Owner = owner; UpdateAccountState(); }
public void AddPersonTest() { PersonViewModel person = new PersonViewModel(new Person("User 3", "Test USer 3", 0), Application); Application.AddPerson(person); Assert.AreNotEqual(0, person.UnderlyingData.personId); PersonViewModel newPerson = Application.GetPerson(person.UnderlyingData.personId); Assert.IsNotNull(newPerson); Assert.AreSame(person, newPerson); }
public UserInfoDialog(PersonViewModel personVM) { PersonInfo = personVM; InitializeComponent(); txtUserName.Focus(); }
public AccountDialog(PersonViewModel selectedUser, AccountancyApplication accountancyApplication) : this(accountancyApplication.CreateAccount(selectedUser), accountancyApplication) { // todo: create account only user has confirmed - pressed OK. // If user presses cancel account still exists }
public void UpdatePerson(PersonViewModel person) { m_database.UpdateUser(person.UnderlyingData); }
public void RemovePerson(PersonViewModel person) { m_database.DeleteUser(person.UnderlyingData); m_personCache.Remove(person.PersonId); Users.Remove(person); }
public AccountViewModel GetAccount(PersonViewModel person, Account a) { if (!m_accountCache.ContainsKey(a.accountId)) m_accountCache[a.accountId] = new AccountViewModel(a, this, person); return m_accountCache[a.accountId]; }
public IEnumerable<AccountViewModel> EnumUserAccounts(PersonViewModel person) { return m_database.EnumUserAccounts(person.UnderlyingData).Select(a => GetAccount(person, a)); }
public AccountViewModel CreateAccount(PersonViewModel person) { return new AccountViewModel(Account.CreateDefault(null != person ? person.PersonId : 0), this); }
public void AddPerson(PersonViewModel person) { Person refPerson = person.UnderlyingData; m_database.AddUser(ref refPerson); person.UnderlyingData = refPerson; m_personCache.Add(refPerson.personId, person); Users.Add(person); }