/// <summary> /// 책을 빌리는 창을 띄워주고 /// 책을 고르고 빌리는 역할을 한다. /// </summary> /// <param name="bookList">책 정보 리스트</param> /// <param name="rentalList">대여자 리스트</param> /// <param name="id">현재 사용자 명</param> public void RentBookPage(string id) { printAboutBooks.Category(); bookDAO.SearchAll(); PrintNo(LibraryConstants.RENTBOOK); if (no.Equals("0")) { return; } if (!dBExceptionHandler.IsInAlreadyRentDB(id, bookList[Convert.ToInt32(no) - 1].Isbn)) { printAboutBooks.RentalResult("F A I L E D"); } else if (bookDAO.GetBook(bookList[Convert.ToInt32(no) - 1].Isbn).Count > 0) { Book book = bookDAO.GetBook(bookList[Convert.ToInt32(no) - 1].Isbn); bookDAO.EditBookCount(bookList[Convert.ToInt32(no) - 1].Isbn, --book.Count); logDAO.AddLog(DateTime.Now, book.Name, "도서 대여"); rentalDataDAO.AddAfterRent(new RentalData(bookList[Convert.ToInt32(no) - 1].Isbn, book.Name, book.Pbls, book.Author, id, new DateTime(now.Year, now.Month + 1, now.Day + 10), 0, 0)); printAboutBooks.RentalResult("S U C C E S S"); } else { printAboutBooks.RentalResult("F A I L E D (연장 횟수 초과)"); } printAboutBooks.PressAnyKey(); }
public void EditWhichOne() { bool exitFlag = true; while (exitFlag) { printAboutBooks.WriteEditWhich(); mode = Console.ReadLine(); switch (mode) { case LibraryConstants.EDIT_COUNT: PrintCountRead(); if (count.Equals("-1")) { return; } else if (count.Equals("-2")) { return; } else { if (!dBExceptionHandler.IsInBookDB(deleteName)) { bookDAO.EditBookCount(deleteName, Convert.ToInt32(count)); logDAO.AddLog(DateTime.Now, deleteName, "도서 수량 수정"); //drawAboutBooks.EditResult("S U C C E S S"); } else { //drawAboutBooks.EditResult("F A I L E D"); } } return; case LibraryConstants.EDIT_PRICE: PrintEditPrice(); if (price.Equals("0")) { return; } else if (price.Equals("1")) { return; } else { if (!dBExceptionHandler.IsInBookDB(deleteName)) { bookDAO.EditBookPrice(deleteName, Convert.ToInt32(price)); logDAO.AddLog(DateTime.Now, deleteName, "도서 가격 수정"); //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; } } }