/// <summary>
        /// 관심과목으로 추가하는 메서드
        /// </summary>
        /// <param name="id">현재 사용자의 아이디</param>
        /// <param name="dataControl">데이터 정보를 관리해주는 객체</param>
        /// <param name="readAndWriteExcelFile">액셀 데이터를 관리해주는 객체</param>
        public void AddInterest(string id, DataControl dataControl, ReadAndWriteExcelFile readAndWriteExcelFile)
        {
            string number, division, major;

            drawUI.AddInterestQuestionMajor();
            major = drawUI.GetConsoleIdNumber(10);
            if (major.Equals("back"))
            {
                return;
            }
            drawUI.AddInterestQuestionNumber();
            number = drawUI.GetConsoleIdNumber(6);
            if (number.Equals("back"))
            {
                return;
            }
            drawUI.AddInterestQuestionDivision();
            division = drawUI.GetConsoleIdNumber(3);
            if (division.Equals("back"))
            {
                return;
            }

            //각각 전공, 학수번호, 분반에 대한 예외처리
            if (!exceptionHandler.CheckLectureMajor(major))
            {
                drawUI.MajorError();
                return;
            }
            else if (!exceptionHandler.CheckLectureNumber(number))
            {
                drawUI.NumberError();
                return;
            }
            else if (!exceptionHandler.CheckLectureDivision(division))
            {
                drawUI.DivisionError();
                return;
            }

            //이미 추가되어있는 과목은 아닌지
            if (dataControl.CheckInterestList(number))
            {   //입력한 정보의 수업이 존재한다면
                if (readAndWriteExcelFile.GetInterestLecture(id, major, number, division) != null)
                {
                    dataControl.AddInterestList(readAndWriteExcelFile.GetInterestLecture(id, major, number, division), id);
                    drawUI.AddSuccess();
                }
                else
                {
                    drawUI.AddFailed();
                }
            }

            else
            {
                drawUI.AddFailed();
            }
        }
Exemple #2
0
        /// <summary>
        /// 수강신청 할 과목에 대한 정보를 받고 수강신청해주는 메서드
        /// </summary>
        /// <param name="id">현 사용자의 아이디</param>
        /// <param name="dataControl">데이터를 관리해주는 객체</param>
        /// <param name="readAndWriteExcelFile">엑셀 정보를 관리해주는 객체</param>
        public void AddRegister(string id, DataControl dataControl, ReadAndWriteExcelFile readAndWriteExcelFile)
        {
            string number, division, major;

            drawUI.AddInterestQuestionMajor();
            major = drawUI.GetConsoleIdNumber(10);
            if (major.Equals("back"))
            {
                return;
            }
            drawUI.AddInterestQuestionNumber();
            number = drawUI.GetConsoleIdNumber(6);
            if (number.Equals("back"))
            {
                return;
            }
            drawUI.AddInterestQuestionDivision();
            division = drawUI.GetConsoleIdNumber(3);
            if (division.Equals("back"))
            {
                return;
            }

            if (!exceptionHandler.CheckLectureMajor(major))
            {
                drawUI.MajorError();
                return;
            }
            else if (!exceptionHandler.CheckLectureNumber(number))
            {
                drawUI.NumberError();
                return;
            }
            else if (!exceptionHandler.CheckLectureDivision(division))
            {
                drawUI.DivisionError();
                return;
            }


            if (dataControl.CheckRegisterList(number))
            {
                if (readAndWriteExcelFile.GetRegisterLecture(id, major, number, division) != null)
                {
                    dataControl.AddRegisterList(readAndWriteExcelFile.GetRegisterLecture(id, major, number, division), id);
                }
                else
                {
                    drawUI.AddFailed();
                }
            }

            else
            {
                drawUI.AddFailed();
            }
        }