Пример #1
0
        public double ComputeNecessaryFee(BookCopy bookCopy, TransactionInfo bookTransInfo)
        {
            var bookInfo = _BookCopyService.GetBookInfo(bookCopy);

            if (bookInfo == null)
            {
                throw new InvalidOperationException("Book copy has no known book information.");
            }

            var section = _SectionService.GetBookSection(bookInfo);

            if (section == null)
            {
                throw new InvalidOperationException("The book does not belong to a section.");
            }

            if (DateTime.Now.Date <= bookTransInfo.ExpectedReturnDate.Date)
            {
                return(0);
            }

            return((DateTime.Now.Date - bookTransInfo.ExpectedReturnDate.Date).Days * section.LateReturningFee);
        }
Пример #2
0
 public ReturnBookIgnorePaymentTransaction(BookCopy bookCopy, TransactionInfo transInfo)
     : base(bookCopy)
 {
     _LastTransaction = transInfo;
 }
Пример #3
0
 public JustReturnBookTransaction(BookCopy bookCopy, TransactionInfo transInfo)
     : base(bookCopy)
 {
     _LastTransaction = transInfo;
     _PaymentService  = new PaymentService();
 }
 public int CompareTo(TransactionInfo other)
 {
     return(this.BorrowDate.Value.CompareTo(other.BorrowDate));
 }