How to simulate a bank account in OOP?

I am creating cash management software using WPF for training, and I am having some problems to correctly simulate a cash account so that I can see the balance after each transaction.

Here is the summary version of what I have now:

Account Class:

public class Account {
    public long Id { get; set; }
    public string Name { get; set; }
    public decimal StartingBalance { get; set; }
}

Category Class:

public class Category {
    public long Id { get; set; }
    public string Name { get; set; }
}

Transaction Class:

public class Transaction {
    public long Id { get; set; }
    public DateTime Date { get; set; }
    public Account Account { get; set; }
    public Category Category { get; set; }
    public string Description { get; set; }
    public decimal TransactionValue { get; set; }
}

What I want to achieve is to use only WPF binding capabilities, populate a datagrid and view the following data for a given date range and account:

Date     Account     Category     Description     Value    Balance
02/02/10 A1          C1           D1               22.30    230.00
02/03/10 A1          C1           D2              -30.00    200.00

And I would like to be able to select the "All Accounts" option and see in the balance sheet the balance sheet amount of all accounts.

, "" datagrid, , guyz!

.

+3
2

- . . , , ViewModel. MVVM Model-View-ViewModel, WPF.

, Transaction (, RegisterTransaction), . . WPF RegisterTransaction.

+1

, ( ). , .

:

  • (CR/DR)
  • Account1
  • account2

. , CR/DR , , . , .

- :

, , Account, "CurrentBalance", ( , ) , . , "", .

+3

Source: https://habr.com/ru/post/1780778/


All Articles