コード例 #1
0
ファイル: ExpenseViewModel.cs プロジェクト: wtain/FinCalc
        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;
        }
コード例 #2
0
ファイル: ExpensesManager.cs プロジェクト: wtain/FinCalc
 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();
 }
コード例 #3
0
        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;
        }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
ファイル: ExpensesManager.cs プロジェクト: wtain/FinCalc
 public void DeleteExpense(Expense expense)
 {
     string query = QueryBuilder.Delete(TableName, "ExpenseId", expense.expenseId.ToString());
     using (SQLiteCommand delete = new SQLiteCommand(query, m_conn))
         delete.ExecuteNonQuery();
 }
コード例 #8
0
ファイル: ExpensesManager.cs プロジェクト: wtain/FinCalc
 public void AddExpense(ref Expense expense)
 {
     expense.expenseId = AddExpense(expense.accountId, expense.amount, expense.categoryId, expense.date, expense.description);
 }
コード例 #9
0
ファイル: ExpenseViewModel.cs プロジェクト: wtain/FinCalc
 public void UpdateUnderlyingData()
 {
     m_underlyingData = new Expense(m_underlyingData.expenseId, Account.AccountId, Amount, Category.CategoryId, Date, Description);
 }
コード例 #10
0
ファイル: AccountancyDatabase.cs プロジェクト: wtain/FinCalc
 public void AddExpense(ref Expense expense)
 {
     m_expensesManager.AddExpense(ref expense);
 }
コード例 #11
0
ファイル: AccountancyDatabase.cs プロジェクト: wtain/FinCalc
 public void UpdateExpense(Expense expense)
 {
     m_expensesManager.UpdateExpense(expense);
 }
コード例 #12
0
ファイル: AccountancyDatabase.cs プロジェクト: wtain/FinCalc
 public void DeleteExpense(Expense expense)
 {
     m_expensesManager.DeleteExpense(expense);
 }