Beispiel #1
0
        public Loan(Person lender, Person borrower, decimal principle, decimal interestRate, DateTime openingDate)
        {
            _Lender = lender;
            _Borrower = borrower;
            _InitialPrinciple = principle;
            _APR = interestRate;
            _OpeningDate = openingDate;

            _Payments = new SortedList<DateTime, Payment>();
        }
Beispiel #2
0
        public PersonViewModel(IMessageBus messenger, Person person)
        {
            myPerson = person;
            this.LoansInRepayment =
                myPerson
                .Borrowed
                .Where(l => l.OutstandingBalance(DateTime.Now) > 0)
                .Select(l => new LoanViewModel(myMessenger, l));

            myMessenger = messenger;
            myMessenger
                .Listen<Person>("BalanceChanged")
                .ObserveOnDispatcher()
                .Subscribe(
                    p =>
                    {
                        if (p == myPerson)
                            NotifyPropertyChanged("Balance");
                    });
        }
Beispiel #3
0
        public bool Borrow(Person lender, decimal amount)
        {
            Contract.Requires(lender != null);
            Contract.Requires(amount > 0);

            if (!lender.Withdraw(amount))
            {
                return false;
            }
            else
            {
                this.Deposit(amount);
            }

            var loan = new Loan(lender, this, amount, 6.0m);
            this._Borrowed.Add(loan);
            lender._Lent.Add(loan);
            return true;
        }
Beispiel #4
0
 public Loan(Person lender, Person borrower, decimal principle, decimal interest)
     : this(lender, borrower, principle, interest, DateTime.Now)
 {
 }