Beispiel #1
0
 public void login()
 {
     Console.Clear();
     share.getDisplay().loginDisplay("Member Login");
     //Console.SetCursorPosition(22, 6);
     inputId = share.getException().loginId();
     Console.SetCursorPosition(22, 10);
     inputPwd = share.getException().inputpwd(); //패스워드 *표시 하는 예외처리
     share.getMemberTable().loginUsingDB(inputId, inputPwd);
 }
Beispiel #2
0
        public void mainMenu()
        {
            Console.Clear();
            share.getDisplay().mainMenuDisplay();
            input = share.getException().exceptKey("1", "2", "3", "/");

            if (input == "1")   //등록한 정보가 있으면 로그인 창으로
            {
                Console.Clear();
                share.getLogin().login();
            }
            else if (input == "2") //회원 등록하기
            {
                Console.Clear();
                share.getMember().addMember("Membership Join");
                mainMenu();
            }
            else if (input == "3") //종료
            {
                Console.WriteLine("                            프로그램 종료합니다 ");
            }
            else if (input == "/")
            {
                share.getLogin().adminLogin();
            } //숨겨진 관리자 모드 오직 관리자만이 아는 명령어
        }
Beispiel #3
0
        public void addMember(string message)                                      //회원정보 등록할 때 필요하다.
        {
            share.getDisplay().status(message);                                    //등록 시 보일 디스플레이
            string memeberId = share.getException().inputIdWhenAdd("\t ID");       //ID의 예외처리 6~10자리 사이 숫자와영어 조합만 가능

            string memberPwd      = share.getException().exceptString("Password"); //회원정보 등록할 때는 비밀번호가 보이게 한다.
            string memberName     = share.getException().exceptName("Name");
            string memberBirthday = share.getException().onlySixNumDigits();

            share.getMemberTable().addMemberInDB(memeberId, memberPwd, memberName, memberBirthday); //데이터베이스에 정보 추가
        }
        public void rentBook() //대출
        {
            share.getBookTable().booksAllSearchOfDB();
            Console.WriteLine("\n\n\t목록을 보고 빌리고 싶은 No와 책 이름을 입력해주세요");

            bookNo   = share.getException().checkNoWhenRent();
            bookName = share.getException().checkNameNo(bookNo);
            int cnt = share.getRentTable().rentCount(share.getLoginId());

            if (cnt <= 3) //3권 만 빌릴 수 있다 대출 제한
            {
                share.getBookTable().changeRenting("대출 불가능", bookNo);
                share.getRentTable().addRentTable(bookNo, bookName);
                cnt++;
            }
            else if (cnt > 3)
            {
                Console.Clear();
                Console.WriteLine("\n\n\n\n");
                Console.WriteLine("\t 대출은 최대 3권까지만 가능합니다.");
                System.Threading.Thread.Sleep(800);
                share.getMenu().menuOnLogin();
            }
        }
Beispiel #5
0
        public void addBook(string message) //관리자 모드일 때 등록가능
        {
            Console.Clear();
            Console.WriteLine("\t\t - {0} -          ", message);
            Console.WriteLine(" ");
            string no       = share.getException().inputNo();
            string bookName = share.getException().exceptString("Book Title");

            string author = share.getException().exceptString("Author"); //회원정보 등록할 때는 보이게 한다.

            string price = share.getException().onlyNumPrice("Price");

            share.getBookTable().addBookInDB(no, bookName, author, price, "대출 가능");
        }
Beispiel #6
0
        public void searchBooks(string titleOrAuthorOr, string searchWord) //검색할 때 카테고리를 분류해 찾을 키워드를 입력한다
        {
            int cnt = 0, count = 3;

            Console.Clear();
            conn = new MySqlConnection(strConn);  // conncet MySQL
            conn.Open();
            String          sql    = "select * from book where " + titleOrAuthorOr + " like '" + searchWord + "%" + "';";
            MySqlCommand    cmd    = new MySqlCommand(sql, conn);
            MySqlDataReader reader = cmd.ExecuteReader();

            share.getDisplay().bookBar();
            while (reader.Read())
            {
                no       = reader["no"].ToString();
                bookname = reader["bookname"].ToString();
                author   = reader["author"].ToString();
                price    = reader["price"].ToString();
                renting  = reader["isRent"].ToString();
                if (bookname.Contains(searchWord) || author.Contains(searchWord) || price.Contains(searchWord)) //키워드가 포함되면 출력
                {
                    cnt++;
                    Console.SetCursorPosition(8, count);
                    Console.Write(no);
                    Console.SetCursorPosition(15, count);
                    Console.Write(bookname);
                    Console.SetCursorPosition(58, count);
                    Console.Write(author);
                    Console.SetCursorPosition(80, count);
                    Console.Write(price);
                    Console.SetCursorPosition(95, count);
                    Console.Write(renting);
                    count += 2;
                }
            }
            if (cnt == 0)
            {
                Console.Clear();
                Console.WriteLine("\t\t" + titleOrAuthorOr + " 내에서 " + searchWord + "에 대한 검색결과가 없습니다");
                Thread.Sleep(800);
            }
            reader.Close();
            conn.Close();
            share.getException().goBack("booksearch");
        }