/// <summary> /// 책을 빌리는 창을 띄워주고 /// 책을 고르고 빌리는 역할을 한다. /// </summary> /// <param name="bookList">책 정보 리스트</param> /// <param name="rentalList">대여자 리스트</param> /// <param name="id">현재 사용자 명</param> public void RentBookPage(string id) { drawAboutBooks.Category(); bookDAO.SearchAll(); DrawNo(); if (choice.Equals("0")) { return; } if (!databaseException.IsInAlreadyRentDB(id, choice)) { drawAboutBooks.RentalResult("F A I L E D"); } else if (bookDAO.GetBook(choice).Count > 0) { Book book = bookDAO.GetBook(choice); bookDAO.EditBookCount(choice, --book.Count); rentalDataDAO.AddAfterRent(new RentalData(choice, book.Name, book.Pbls, book.Author, id, new DateTime(now.Year, now.Month + 1, now.Day + 10), 0)); drawAboutBooks.RentalResult("S U C C E S S"); } else { drawAboutBooks.RentalResult("F A I L E D (연장 횟수 초과)"); } drawAboutBooks.PressAnyKey(); }
/// <summary> /// 책 빌리는 작업을 하는 메소드 /// </summary> /// <param name="bookList">책 정보 리스트</param> /// <param name="rentalList">대여자 리스트</param> /// <param name="id">현재 사용자명</param> public void ReturnBook(string id) { DrawNo(id); if (no.Equals("0")) { return; } if (databaseException.IsInAlreadyRentDB(id, no)) { drawAboutBooks.ReturnResult("F A I L E D !"); } else { rentalDataDAO.ChangeAfterReturnBook(id, no); bookDAO.EditBookCount(no, ++bookDAO.GetBook(no).Count); drawAboutBooks.ReturnResult("S U C C E S S !"); } drawAboutBooks.PressAnyKey(); }
public void EditWhichOne() { bool exitFlag = true; while (exitFlag) { drawAboutBooks.WriteEditWhich(); mode = Console.ReadLine(); switch (mode) { case LibraryConstants.EDIT_COUNT: DrawCountRead(); if (count.Equals("-1")) { return; } if (count.Equals("-2")) { return; } if (!databaseException.IsInBookDB(deleteName)) { bookDAO.EditBookCount(deleteName, Convert.ToInt32(count)); //drawAboutBooks.EditResult("S U C C E S S"); } else { //drawAboutBooks.EditResult("F A I L E D"); } return; case LibraryConstants.EDIT_PRICE: DrawEditPrice(); if (price.Equals("0")) { return; } if (price.Equals("1")) { return; } if (!databaseException.IsInBookDB(deleteName)) { bookDAO.EditBookPrice(deleteName, Convert.ToInt32(price)); //drawAboutBooks.EditResult("S U C C E S S"); } else { //drawAboutBooks.EditResult("F A I L E D"); } return; case LibraryConstants.EDIT_EXIT: exitFlag = false; break; default: break; } } }