/// <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();
        }
        /// <summary>
        /// 책을 삭제할때 기본 키 값인 No값을 체크해주는 메소드
        /// </summary>
        /// <param name="list">책 정보 리스트</param>
        public void DeleteSub()
        {
            printAboutBooks.Category();
            bookDAO.SearchAll();

            printAboutBooks.WriteBookNo();
            deleteName = Console.ReadLine();
            if (deleteName.Equals("0"))
            {
                return;
            }
            if (!exceptionHandler.CheckBookNo(deleteName))
            {
                DeleteSub();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 기본 메뉴창을 띄우는 메소드
        /// </summary>
        /// <param name="list">책의 리스트</param>
        public void BookManagement()
        {
            bool flag = true;

            while (flag)
            {
                printAboutBooks.ManagementMenu();
                mode = Console.ReadLine();
                switch (mode)
                {
                case LibraryConstants.ADD_MODE:
                    libraryManagement.PrintAdd();
                    break;

                case LibraryConstants.EDIT_MODE:
                    libraryManagement.PrintEdit();
                    break;

                case LibraryConstants.DELETE_MODE:
                    libraryManagement.PrintDelete();
                    break;

                case LibraryConstants.SEARCH_MODE:
                    libraryManagement.PrintSearch();
                    break;

                case LibraryConstants.PRINT_MODE:
                    bookDAO.SearchAll();
                    printAboutBooks.PressAnyKey();
                    break;

                case LibraryConstants.GO_BEFORE:
                    flag = false;
                    break;

                default:
                    break;
                }
            }
        }