public ExpenseViewModel(Expense e, AccountancyApplication app) { Account = app.GetAccount(e.accountId); Amount = e.amount; Date = e.date; Category = app.GetCategory(e.categoryId); Description = e.description; m_underlyingData = e; }
public void UpdateExpense(Expense expense) { string query = QueryBuilder.Update(TableName, "ExpenseId", expense.expenseId.ToString(), GetAccountIdColumnPair(expense.accountId), GetAmountColumnPair(expense.amount), GetCategoryIdColumnPair(expense.categoryId), GetDateColumnPair(expense.date), GetDescriptionColumnPair(expense.description)); using (SQLiteCommand update = new SQLiteCommand(query, m_conn)) update.ExecuteNonQuery(); }
public void UpdateExpense(Expense expense) { AccountBalance accountBalance1 = GetBalance(m_expenses[expense.expenseId].accountId); AccountBalance accountBalance2 = GetBalance(expense.accountId); if (CategoryTypeHelper.IsPositive(GetCategory(expense.categoryId).type)) accountBalance1.balance -= m_expenses[expense.expenseId].amount; else accountBalance1.balance += m_expenses[expense.expenseId].amount; m_expenses[expense.expenseId] = expense; if (CategoryTypeHelper.IsPositive(GetCategory(expense.categoryId).type)) accountBalance2.balance += expense.amount; else accountBalance2.balance -= expense.amount; }
public void DeleteExpense(Expense expense) { m_expenses.Remove(expense.expenseId); AccountBalance accountBalance = GetBalance(expense.accountId); if (CategoryTypeHelper.IsNegative(GetCategory(expense.categoryId).type)) accountBalance.balance += expense.amount; else accountBalance.balance -= expense.amount; }
public long AddExpense(long accountId, long amount, long categoryId, DateTime date, string description) { Expense expense = new Expense(0, accountId, amount, categoryId, date, description); AddExpense(ref expense); return expense.expenseId; }
public void AddExpense(ref Expense expense) { expense.expenseId = GetNewId(); m_expenses.Add(expense.expenseId, expense); AccountBalance accountBalance = GetBalance(expense.accountId); if (CategoryTypeHelper.IsPositive(GetCategory(expense.categoryId).type)) accountBalance.balance += expense.amount; else accountBalance.balance -= expense.amount; }
public void DeleteExpense(Expense expense) { string query = QueryBuilder.Delete(TableName, "ExpenseId", expense.expenseId.ToString()); using (SQLiteCommand delete = new SQLiteCommand(query, m_conn)) delete.ExecuteNonQuery(); }
public void AddExpense(ref Expense expense) { expense.expenseId = AddExpense(expense.accountId, expense.amount, expense.categoryId, expense.date, expense.description); }
public void UpdateUnderlyingData() { m_underlyingData = new Expense(m_underlyingData.expenseId, Account.AccountId, Amount, Category.CategoryId, Date, Description); }
public void AddExpense(ref Expense expense) { m_expensesManager.AddExpense(ref expense); }
public void UpdateExpense(Expense expense) { m_expensesManager.UpdateExpense(expense); }
public void DeleteExpense(Expense expense) { m_expensesManager.DeleteExpense(expense); }