コード例 #1
0
        public void RegisterStudentForReAdmissionTest()
        {
            int termId = 13;

            int studentNum = GetLastStudentNum();

            Assert.AreNotEqual(0, studentNum);

            CentennialDA dao     = new CentennialDA();
            Student      student = dao.FindStudentByStudentNum($"test{studentNum}");

            Assert.IsNotNull(student);

            int studentId = student.StudentId;

            student.StudentCanRegister = false;
            dao.UpdateStudent(student);
            bool registrationEnabled = dao.StudentCanRegister(studentId);

            Assert.IsFalse(registrationEnabled);

            bool hasRegistration = dao.HasValidRegistration(studentId, termId);

            Assert.IsFalse(hasRegistration);

            dao.EnableStudentCanRegister(studentId);
            registrationEnabled = dao.StudentCanRegister(studentId);
            Assert.IsTrue(registrationEnabled);

            dao.ProgramRegistrationReAdmit(termId, studentId);
            hasRegistration = dao.HasValidRegistration(studentId, termId);
            Assert.IsTrue(hasRegistration);
        }
コード例 #2
0
 private bool SetStudentCanRegister(Student student)
 {
     if (student.StudentCanRegister)
     {
         return(true);
     }
     if (dao.EnableStudentCanRegister(student.StudentId))
     {
         student.StudentCanRegister = true;
         Session["student"]         = student;
         return(true);
     }
     return(false);
 }