public BookViewModel(Book book, NewEntryModel newEntry)
        {
            _book = book;
            _newEntry = newEntry;

            _otherAccountOptions = new DependentList<AccountHeaderViewModel>(() =>
                from account in _book.Account.Company.Accounts
                orderby account.Name.Value
                select new AccountHeaderViewModel(account)
            );
        }
 public void AddEntry(Book book)
 {
     AccountType accountType = (AccountType)book.Account.Type;
     if (_increase.Value > 0.0)
     {
         if (accountType == AccountType.Asset || accountType == AccountType.Expense)
             book.AddDebit(_date, _id, _description, _account, _increase);
         else
             book.AddCredit(_date, _id, _description, _account, _increase);
     }
     else
     {
         if (accountType == AccountType.Asset || accountType == AccountType.Expense)
             book.AddCredit(_date, _id, _description, _account, _decrease);
         else
             book.AddDebit(_date, _id, _description, _account, _decrease);
     }
 }
 public bool IsValid(Book book)
 {
     return _account.Value != null && _account.Value != book.Account &&
         _date.Value.Year == book.Year.CalendarYear &&
         ((_increase.Value > 0.0 && _decrease.Value == 0.0) ||
          (_decrease.Value > 0.0 && _increase.Value == 0.0));
 }
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                Book newFact = new Book(memento);

                return newFact;
            }
 // Business constructor
 public Entry(
     Book credit
     ,Book debit
     ,DateTime entryDate
     ,byte entryDatePadding
     ,float amount
     ,DateTime created
     ,byte createdPadding
     )
 {
     InitializeResults();
     _credit = new PredecessorObj<Book>(this, GetRoleCredit(), credit);
     _debit = new PredecessorObj<Book>(this, GetRoleDebit(), debit);
     _entryDate = entryDate;
     _entryDatePadding = entryDatePadding;
     _amount = amount;
     _created = created;
     _createdPadding = createdPadding;
 }
 public EntryViewModel(Entry entry, Book book)
 {
     _entry = entry;
     _book = book;
 }