public BorrowBookTransaction(LibraryUser libUser, BookCopy bookCopy) : base(bookCopy) { _BookCopyService = new BookCopyService(); _HolidayService = new HolidayService(); _BookInfoService = new BookService(); _SectionService = new SectionService(); var bookInfo = _BookInfoService.BookInfoOf(BookCopy); var section = _SectionService.GetBookSection(bookInfo); if (section == null) { throw new InvalidOperationException("The book does not belong to a section."); } if (section.MaxDaysAllowedForBorrowing == 0) { TransactionType = "Not Allowed For Borrowing."; } bookTransInfo = new TransactionInfo { BookCopyId = BookCopy.Id, LibraryUserId = libUser.Id, BorrowDate = TransactionDate, ExpectedReturnDate = _HolidayService.GetNonHolidayDateFrom(TransactionDate.AddDays(section.MaxDaysAllowedForBorrowing)) }; }
private Order(string name, string email, string whatsapp, Districts districts, string address, string note, PaymentMethod paymentMethod, Func <DateTime, string> orderNumberGenerator) : this() { this.Customer = new OrderCustomer(name, email, whatsapp, address, districts); this.TransactionDate = DateTime.Now; this.OrderNumber = orderNumberGenerator.Invoke(this.TransactionDate); this.Payment = new OrderPayment(paymentMethod); this.Note = note; this.DueDateConfirmation = TransactionDate.AddDays(1); this.Status = OrderStatus.DRAFT; }