示例#1
0
文件: Loan.cs 项目: Aesir/LoanTracker
        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>();
        }
示例#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");
                    });
        }
示例#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;
        }
示例#4
0
文件: Loan.cs 项目: Aesir/LoanTracker
 public Loan(Person lender, Person borrower, decimal principle, decimal interest)
     : this(lender, borrower, principle, interest, DateTime.Now)
 {
 }