Exemplo n.º 1
0
 public void Update(Account account)
 {
     string query = QueryBuilder.Update("accounts", "AccountId", account.accountId.ToString(),
                                                    GetNameColumnPair(account.name),
                                                    GetCurrencyColumnPair(account.currency),
                                                    GetOwnerPersonIdColumnPair(account.ownerPersonId),
                                                    GetTypeColumnPair(account.type));
     using (SQLiteCommand update = new SQLiteCommand(query, m_conn))
         update.ExecuteNonQuery();
 }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
 public void Update(Account account)
 {
     m_accounts[account.accountId] = account;
 }
Exemplo n.º 4
0
 public void Delete(Account account)
 {
     m_accounts.Remove(account.accountId);
 }
Exemplo n.º 5
0
 public long AddAccount(string name, string currency, long ownerPersonId, AccountType type)
 {
     Account account = new Account(0, currency, ownerPersonId, name, type);
     Add(ref account);
     return account.accountId;
 }
Exemplo n.º 6
0
 public void Add(ref Account account)
 {
     account.accountId = GetNewId();
     m_accounts.Add(account.accountId, account);
 }
Exemplo n.º 7
0
 public void Delete(Account account)
 {
     string query = QueryBuilder.Delete("accounts", "AccountId", account.accountId.ToString());
     using (SQLiteCommand delete = new SQLiteCommand(query, m_conn))
         delete.ExecuteNonQuery();
 }
Exemplo n.º 8
0
 public void Add(ref Account account)
 {
     account.accountId = AddAccount(account.name, account.currency, account.ownerPersonId, account.type);
 }
Exemplo n.º 9
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];
 }
Exemplo n.º 10
0
 public AccountViewModel GetAccount(Account a)
 {
     return GetAccount(a.accountId);
 }
Exemplo n.º 11
0
 public void Add(ref Account account)
 {
     m_accountsManager.Add(ref account);
 }
Exemplo n.º 12
0
 public void Update(Account account)
 {
     m_accountsManager.Update(account);
 }
Exemplo n.º 13
0
 public void Delete(Account account)
 {
     m_accountsManager.Delete(account);
 }
Exemplo n.º 14
0
 public AccountViewModel(Account account, IAccountancyApplication accountancyApplication)
     : this(account, accountancyApplication, accountancyApplication.GetPerson(account.ownerPersonId))
 {
 }
Exemplo n.º 15
0
 public void UpdateUnderlyingData()
 {
     if (Owner.PersonId != OwnerPersonId)
     {
         m_accountancyApplication.GetPerson(OwnerPersonId).UserAccounts.Remove(this);
         Owner.UserAccounts.Add(this);
     }
     m_underlyingData = new Account(AccountId, Currency, Owner.PersonId, Name, AccountType);
 }