Example #1
0
        /// <summary>
        /// 무엇에 대해서 검색할지 위의 메서드에서 정해지면
        /// 여기서 검색을 한다.
        /// </summary>
        /// <param name="mode">어떤 열에 대해서 검색할지</param>
        /// <param name="id">현 사용자 아이디</param>
        /// <param name="dataControl">데이터 정보 관리하는 객체</param>
        /// <param name="readAndWriteExcelFile">액셀 데이터를 관리하는 객체</param>
        public void Search(string mode, string id, DataControl dataControl, ReadAndWriteExcelFile readAndWriteExcelFile)
        {
            int    search = 0, count = 0;
            string searchInformation;

            if (mode.Equals(TimeTableConstants.SEARCH_MAJOR))
            {
                search = 2; drawUI.SearchQuestion(mode);
            }
            else if (mode.Equals(TimeTableConstants.SEARCH_NUMBER))
            {
                search = 3; drawUI.SearchQuestion(mode);
            }
            else if (mode.Equals(TimeTableConstants.SEARCH_SUBJECT))
            {
                search = 5; drawUI.SearchQuestion(mode);
            }
            else if (mode.Equals(TimeTableConstants.SEARCH_GRADE))
            {
                search = 7; drawUI.SearchQuestion(mode);
            }
            else if (mode.Equals(TimeTableConstants.SEARCH_PROFESSOR))
            {
                search = 11; drawUI.SearchQuestion(mode);
            }
            else if (mode.Equals(TimeTableConstants.SEARCH_INTEREST))
            {
                dataControl.MyInterestLectures(id);
                AddRegister(id, dataControl, readAndWriteExcelFile); //수강신청
                return;
            }
            searchInformation = drawUI.GetConsoleIdNumber(25);
            if (searchInformation.Equals("back"))//esc 눌렀을때
            {
                return;
            }
            if (searchInformation.Length < 1)
            {
                Search(mode, id, dataControl, readAndWriteExcelFile);
                return;
            }
            count = readAndWriteExcelFile.PrintWeFound(searchInformation, search, TimeTableConstants.REGISTER, dataControl);

            if (count.Equals(0))    //검색결과가 없을때
            {
                drawUI.SearchFailed();
            }
            else
            {
                AddRegister(id, dataControl, readAndWriteExcelFile);
            }
        }