Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 public UserInfoDialog(PersonViewModel personVM)
 {
     PersonInfo = personVM;
     InitializeComponent();
     txtUserName.Focus();
 }
Ejemplo n.º 4
0
 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
 }
Ejemplo n.º 5
0
 public void UpdatePerson(PersonViewModel person)
 {
     m_database.UpdateUser(person.UnderlyingData);
 }
Ejemplo n.º 6
0
 public void RemovePerson(PersonViewModel person)
 {
     m_database.DeleteUser(person.UnderlyingData);
     m_personCache.Remove(person.PersonId);
     Users.Remove(person);
 }
Ejemplo n.º 7
0
 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];
 }
Ejemplo n.º 8
0
 public IEnumerable<AccountViewModel> EnumUserAccounts(PersonViewModel person)
 {
     return m_database.EnumUserAccounts(person.UnderlyingData).Select(a => GetAccount(person, a));
 }
Ejemplo n.º 9
0
 public AccountViewModel CreateAccount(PersonViewModel person)
 {
     return new AccountViewModel(Account.CreateDefault(null != person ? person.PersonId : 0), this);
 }
Ejemplo n.º 10
0
 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);
 }