// API를 통해 책을 검색하는 화면 public List <Data.Book> APISearchScreen(Data.DBHandler DB) { string keyword; int count = 0; List <string> searchCount = new List <string>(new string[] { "10개", "20개", "30개", "40개" }); NaverAPI.SearchEngine engine = new NaverAPI.SearchEngine(); ConsoleUI.PrintAPISearchBook(); // 검색어를 입력받는다. Console.SetCursorPosition(14, 11); keyword = inputProcessor.ReadAndCheckString(25, 25, 14, 11); if (keyword == null) { return(null); } Console.SetCursorPosition(14, 13); // 검색 개수를 입력받는다. int index = inputProcessor.ComboBox(searchCount, new CursorPoint(14, 13), " "); if (index == ConstNumber.ESC) { return(null); } count = int.Parse(searchCount[index].Substring(0, 2)); // 로그 기록 DB.InsertLog("관리자", keyword, "도서 검색"); return(engine.SearchBooks(keyword, count)); }
public BookManagement(Data.DBHandler DB, IOException.OutputProcessor outputProcessor) { this.student = null; rentalManager = null; this.outputProcessor = outputProcessor; this.DB = DB; }
public BookManagement(Data.Student student, Data.DBHandler DB, IOException.OutputProcessor outputProcessor) { this.student = student; this.outputProcessor = outputProcessor; this.DB = DB; rentalManager = new RentalManagement(DB, student); }
// 회원들의 정보를 출력한다. public string PrintMemberList(Data.DBHandler DB) { int choice = 0, pressedKey = 0; List <Data.Student> students = null; Console.SetWindowSize(79, 39); Console.Clear(); Console.WriteLine("\n ============================================================================"); Console.WriteLine(" 학 번 이 름 주 소 핸드폰 번호"); Console.WriteLine(" ============================================================================"); while (true) { Console.SetCursorPosition(0, 4); students = DB.GetAllMember(); if (students.Count == 0) { PressAnyKey("멤버가 없습니다."); return(null); } for (int i = 0; i < students.Count; i++) { if (choice == i) { Console.ForegroundColor = ConsoleColor.Red; } students[i].PrintInformation(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); } Console.SetCursorPosition(0, 4 + choice); // 엔터를 치면 선택된 인덱스를 반환한다. pressedKey = inputProcessor.ChoiceByKeyUsableESC(); if (pressedKey == ConstNumber.ENTER) { return(students[choice].StudentNo); } else if (pressedKey == ConstNumber.ESC) { return(null); } if (Console.CursorTop < 4) { Console.SetCursorPosition(Console.CursorLeft, 4); } if (Console.CursorTop > 4 + ((students.Count == 0) ? 1 : students.Count) - 1) { Console.SetCursorPosition(Console.CursorLeft, 4 + ((students.Count == 0) ? 1 : students.Count) - 1); } // 커서 위치에 따른 메뉴 선택 choice = Console.CursorTop - 4; } }
// 로그 전체 보기 public void ViewAllLogs(Data.DBHandler DB) { Console.Clear(); Console.SetWindowSize(111, 40); Console.WriteLine("\n ============================================================================================================"); Console.WriteLine(" 발생시간 실행자 키워드 로그 유형"); Console.WriteLine(" ============================================================================================================"); List <Data.Log> logs = DB.ViewAllLog(); for (int idx = 0; idx < logs.Count; idx++) { Console.WriteLine(logs[idx].PrintLogInformation()); } Console.ReadKey(); }
public RentalManagement(Data.DBHandler DB, Data.Student student) { this.student = student; this.DB = DB; }
public LoginManagement(Data.DBHandler dbHandler) { DB = dbHandler; }
public string PrintRentalList(Data.DBHandler DB, string studentno) { int choice = 0, pressedKey = 0; List <Data.Book> books = null; Console.Clear(); Console.SetWindowSize(170, 39); Console.WriteLine("\n ======================================================================================================================================================================="); Console.WriteLine(" ISBN 도서명 출판사 저자 반납기한 연장횟수"); Console.WriteLine(" ======================================================================================================================================================================="); while (true) { Console.SetCursorPosition(0, 4); books = DB.RentalList(studentno); if (books.Count == 0) { PressAnyKey("대출된 도서가 없습니다."); return(null); } for (int i = 0; i < books.Count; i++) { // 선택된 행이면 빨간색으로 표시 if (choice == i) { Console.ForegroundColor = ConsoleColor.Red; } books[i].PrintDuetoInformation(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); } // 첫 행으로 커서를 옮긴다 Console.SetCursorPosition(0, 4 + choice); // 엔터를 치면 선택된 인덱스를 반환한다. pressedKey = inputProcessor.ChoiceByKeyUsableESC(); if (pressedKey == ConstNumber.ENTER) { return(books[choice].ISBN); } else if (pressedKey == ConstNumber.ESC) { return(null); } // 커서의 위아래 이동 구간을 제한한다. if (Console.CursorTop < 4) { Console.SetCursorPosition(Console.CursorLeft, 4); } if (Console.CursorTop > 4 + ((books.Count == 0) ? 1 : books.Count) - 1) { Console.SetCursorPosition(Console.CursorLeft, 4 + ((books.Count == 0) ? 1 : books.Count) - 1); } // 커서 위치에 따른 메뉴 선택 choice = Console.CursorTop - 4; } }
public MemberManagement(Data.DBHandler DB, IOException.OutputProcessor outputProcessor) { this.outputProcessor = outputProcessor; this.DB = DB; }