Ejemplo n.º 1
0
        /// <summary>
        /// 검색 기능을 담당하는 메소드
        /// </summary>
        /// <param name="list"></param>
        public void PrintSearch()
        {
            bool exitFlag = true;

            while (exitFlag)
            {
                printAboutControlMembers.SearchMenu();
                id = Console.ReadLine();
                Console.Clear();
                switch (id)
                {
                case LibraryConstants.SEARCH_WITH_NAME:
                    SearchSub(LibraryConstants.SEARCH_WITH_NAME);
                    if (search.Equals("0"))
                    {
                        return;
                    }
                    printAboutControlMembers.Category();
                    logDAO.AddLog(DateTime.Now, search, "회원 검색");
                    memberDAO.SearchWithQuary("select * from member where name like \"%" + search + "%\"");
                    printAboutControlMembers.PressAnyKey();
                    break;

                case LibraryConstants.SEARCH_WITH_RESIDENT_NUMBER:
                    SearchSub(LibraryConstants.SEARCH_WITH_RESIDENT_NUMBER);
                    if (search.Equals("0"))
                    {
                        return;
                    }
                    printAboutControlMembers.Category();
                    logDAO.AddLog(DateTime.Now, search, "회원 검색");
                    memberDAO.SearchWithQuary("select * from member where residentNumber like \"%" + search + "%\"");
                    printAboutControlMembers.PressAnyKey();
                    break;

                case LibraryConstants.SEARCH_WITH_ID:
                    SearchSub(LibraryConstants.SEARCH_WITH_ID);
                    if (search.Equals("0"))
                    {
                        return;
                    }
                    printAboutControlMembers.Category();
                    logDAO.AddLog(DateTime.Now, search, "회원 검색");
                    memberDAO.SearchWithQuary("select * from member where id like \"%" + search + "%\"");
                    printAboutControlMembers.PressAnyKey();
                    break;

                case LibraryConstants.SEARCH_WITH_PASSWORD:
                    SearchSub(LibraryConstants.SEARCH_WITH_PASSWORD);
                    if (search.Equals("0"))
                    {
                        return;
                    }
                    printAboutControlMembers.Category();
                    logDAO.AddLog(DateTime.Now, search, "회원 검색");
                    memberDAO.SearchWithQuary("select * from member where password like \"%" + search + "%\"");
                    printAboutControlMembers.PressAnyKey();
                    break;

                case LibraryConstants.SEARCH_WITH_ADDRESS:
                    SearchSub(LibraryConstants.SEARCH_WITH_ADDRESS);
                    if (search.Equals("0"))
                    {
                        return;
                    }
                    printAboutControlMembers.Category();
                    logDAO.AddLog(DateTime.Now, search, "회원 검색");
                    memberDAO.SearchWithQuary("select * from member where address like \"%" + search + "%\"");
                    printAboutControlMembers.PressAnyKey();
                    break;

                case LibraryConstants.SEARCH_WITH_PHONE:
                    SearchSub(LibraryConstants.SEARCH_WITH_PHONE);
                    if (search.Equals("0"))
                    {
                        return;
                    }
                    printAboutControlMembers.Category();
                    logDAO.AddLog(DateTime.Now, search, "회원 검색");
                    memberDAO.SearchWithQuary("select * from member where phoneNumber like \"%" + search + "%\"");
                    printAboutControlMembers.PressAnyKey();
                    break;

                case LibraryConstants.SEARCH_WITH_AGE:
                    SearchSub(LibraryConstants.SEARCH_WITH_AGE);
                    if (search.Equals("0"))
                    {
                        return;
                    }
                    printAboutControlMembers.Category();
                    logDAO.AddLog(DateTime.Now, search, "회원 검색");
                    memberDAO.SearchWithQuary("select * from member where age like \"%" + search + "%\"");
                    printAboutControlMembers.PressAnyKey();
                    break;

                case LibraryConstants.RETURN_BACK:
                    exitFlag = false;
                    return;

                default:
                    break;
                }
            }
        }