Esempio n. 1
0
        /// <summary>
        /// 수강신청을 하는 메서드
        /// </summary>
        /// <param name="register">수강신청 과목정보</param>
        /// <param name="id">현 사용자 아이디</param>
        public void AddRegisterList(RegisterLectureVO register, string id)
        {
            int count = 0;

            if (!exceptionHandler.CheckSameTimeRegisted(registerLectureList, id, register.Time))
            {
                drawUI.ThatTimeNo();
                return;
            }
            for (int index = 0; index < studentList.Count; index++)
            {
                if (studentList[index].Id.Equals(id) && (studentList[index].RegistePoint + Convert.ToInt32(register.Credit[0] - '0')) < 22)
                {
                    studentList[index].RegistePoint += Convert.ToInt32(register.Credit[0] - '0');
                    break;
                }
                count++;
            }
            if (studentList.Count.Equals(count))
            {
                return;
            }
            else
            {
                for (int index = 0; index < interestLectureList.Count; index++)
                {
                    if (interestLectureList[index].Major.Equals(register.Major) && interestLectureList[index].Number.Equals(register.Number) && interestLectureList[index].Division.Equals(register.Division))
                    {
                        interestLectureList.RemoveAt(index);
                    }
                }
                registerLectureList.Add(register);
                drawUI.AddSuccess();
            }
        }
        /// <summary>
        /// 학과정보, 학수번호, 분반 정보를 가지고 엑셀정보에서 수강신청 할 과목 정보를 불러온다.
        /// </summary>
        /// <param name="id">현재 사용자</param>
        /// <param name="major">학과 정보</param>
        /// <param name="number">학수 번호</param>
        /// <param name="division">분반</param>
        /// <returns>수강신청하고자 하는 과목 정보</returns>
        public RegisterLectureVO GetRegisterLecture(string id, string major, string number, string division)
        {
            RegisterLectureVO register = new RegisterLectureVO();
            int count = 1;

            for (int row = 2; row <= lectureInformation.GetLength(0); row++)
            {
                if (Regex.IsMatch(lectureInformation[row, 2].ToString(), major) && lectureInformation[row, 3].Equals(number) && lectureInformation[row, 4].Equals(division))
                {
                    register.Id         = id;
                    register.No         = lectureInformation[row, 1].ToString();
                    register.Major      = lectureInformation[row, 2].ToString();
                    register.Number     = lectureInformation[row, 3].ToString();
                    register.Division   = lectureInformation[row, 4].ToString();
                    register.Name       = lectureInformation[row, 5].ToString();
                    register.Completion = lectureInformation[row, 6].ToString();
                    register.Grade      = lectureInformation[row, 7].ToString();
                    register.Credit     = lectureInformation[row, 8].ToString();
                    register.Time       = lectureInformation[row, 9].ToString();
                    if (lectureInformation[row, 10] != null)
                    {
                        register.Room = lectureInformation[row, 10].ToString();
                    }
                    else
                    {
                        register.Room = "";
                    }
                    register.Professor = lectureInformation[row, 11].ToString();
                    register.Language  = lectureInformation[row, 12].ToString();

                    return(register);
                }
                count++;
            }
            if (count.Equals(lectureInformation.GetLength(0)))
            {
                return(null);
            }
            else
            {
                return(register);
            }
        }