Exemple #1
0
        public ActionResult ScheduleOfCourses(string listTermDate)
        {
            try
            {
                DateTime result;
                var      scheduleOfCourses = new StudentScheduleOfCourses();
                bool     isValidDate       = DateTime.TryParse(listTermDate, out result);

                if (isValidDate)
                {
                    IScheduleOfCoursesService scheduleOfCoursesService = new ScheduleOfCoursesService();
                    var termList = scheduleOfCoursesService.GetStudentScheduleOfTerm(StudentNo);

                    IEnumerable <string> list = termList;

                    if (termList.Count != 0)
                    {
                        ViewData["TermsDateList"] = new SelectList(list, listTermDate);
                        scheduleOfCourses         = scheduleOfCoursesService.GetStudentClassSchedule(StudentNo, listTermDate);
                    }
                }

                return(View("ScheduleOfCourses", scheduleOfCourses));
            }
            catch (Exception ex)
            {
                _logger.Error("Exception Occurred. StudentNo: " + StudentNo + " listTermDate: " + listTermDate, ex);

                Response.Redirect(AppHelper.SharedUrl("Reply/Error"));

                return(null);
            }
        }
Exemple #2
0
        public ActionResult ScheduleOfCourses()
        {
            try
            {
                IScheduleOfCoursesService scheduleOfCoursesService = new ScheduleOfCoursesService();
                var termList = scheduleOfCoursesService.GetStudentScheduleOfTerm(StudentNo);

                IEnumerable <string> list = termList;

                var scheduleOfCourses = new StudentScheduleOfCourses();
                if (termList.Count != 0)
                {
                    ViewData["TermsDateList"] = new SelectList(list, termList[0]);
                    scheduleOfCourses         = scheduleOfCoursesService.GetStudentClassSchedule(StudentNo, termList[0]);
                }

                return(View(scheduleOfCourses));
            }
            catch (Exception ex)
            {
                _logger.Error("Exception Occurred. StudentNo: " + StudentNo, ex);

                Response.Redirect(AppHelper.SharedUrl("Reply/Error"));

                return(null);
            }
        }
        public void Verify_ScheduleOfCoursesService_TestScheduleOfCoursesRepository_GetStudentScheduleOfTerm_Returns_Data_Against_Valid_TestStudent()
        {
            IScheduleOfCoursesService scheduleOfCoursesRepository = new ScheduleOfCoursesService(new TestScheduleOfCoursesRepository());
            var scheduleList = scheduleOfCoursesRepository.GetStudentScheduleOfTerm(TestConstants.DbStudentUserId);

            Assert.IsNotNull(scheduleList);
            Assert.IsTrue(scheduleList.Count > 0);
        }
        public void Verify_ScheduleOfCoursesService_ScheduleOfCoursesRepository_GetStudentScheduleOfTerm_Returns_Empty_Data_Against_Invalid_DbStudent()
        {
            IScheduleOfCoursesService scheduleOfCoursesService = new ScheduleOfCoursesService(new SqlScheduleOfCoursesRepository());
            var scheduleList = scheduleOfCoursesService.GetStudentScheduleOfTerm(TestConstants.InvalidUserId);

            Assert.IsNotNull(scheduleList);
            Assert.IsTrue(scheduleList.Count == 0);
        }