コード例 #1
0
        public ActionResult CreateStudent(Student student)
        {
            if (dao.CreateStudent(ref student))
            {
                Session["student"] = student;
                return(RedirectToAction("CreateProgramRegistration", new { StudentId = student.StudentId }));
            }

            return(View(student));
        }
コード例 #2
0
        public void NewStudentRegistrationTest()
        {
            DateTime registrationDate = new DateTime(2013, 8, 20);
            int      termId = 3, programId = 1, currentSemester = 1;

            int     studentNum = GetNextStudentNum();
            Student student    = new Student
            {
                StudentNum              = $"test{studentNum}",
                StudentLastName         = "LName",
                StudentFirstMidName     = "FName",
                StudentEmail            = "test",
                StudentHasHolds         = false,
                StudentAcademicStanding = true,
                StudentCanRegister      = true,
                StudentStartDate        = registrationDate
            };

            CentennialDA dao = new CentennialDA();

            dao.CreateStudent(ref student);

            int studentId = student.StudentId;

            Assert.AreNotEqual(0, studentId);

            Console.WriteLine($"StudentId for freshly created student: {studentId}");

            dao.ProgramRegistrationNew(termId, programId, currentSemester, studentId);
            bool programRegistrationDone = dao.HasValidRegistration(studentId, termId);

            Assert.IsTrue(programRegistrationDone);

            dao.CreateTranscript(studentId);
            Transcript transcript = dao.GetStudentTranscript(studentId);

            Assert.AreEqual($"test{studentNum}", transcript.studentNumber);
        }
コード例 #3
0
        public void TransferStudentProgramTest()
        {
            // setup student and program
            DateTime registrationDate = new DateTime(2013, 8, 20);
            int      termId = 3, programId = 1, currentSemester = 1;

            int     studentNum = GetNextStudentNum();
            Student student    = new Student
            {
                StudentNum              = $"test{studentNum}",
                StudentLastName         = "LName",
                StudentFirstMidName     = "FName",
                StudentEmail            = "test",
                StudentHasHolds         = false,
                StudentAcademicStanding = true,
                StudentCanRegister      = true,
                StudentStartDate        = registrationDate
            };

            CentennialDA dao = new CentennialDA();

            dao.CreateStudent(ref student);
            int studentId = student.StudentId;

            dao.ProgramRegistrationNew(termId, programId, currentSemester, studentId);
            dao.CreateTranscript(studentId);

            Assert.AreEqual(programId, dao.GetCurrentProgramId(studentId));

            currentSemester = dao.GetCurrentSemesterInStudentProgram(studentId, programId);
            Assert.AreEqual(1, currentSemester);

            // add credits to student's record
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(1, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(2, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(3, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(5, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(6, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(7, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(8, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(17, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(18, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(19, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(21, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(23, "York", "A"));
            dao.AddTransferCredit(studentId, dao.ConvertToTransferCredit(24, "York", "A"));

            // transfer to new program
            programId       = 2;
            termId          = 13;
            currentSemester = dao.GetCurrentSemesterInStudentProgram(studentId, programId);
            Assert.AreEqual(3, currentSemester);

            Transcript transcript = dao.GetStudentTranscript(studentId);
            string     oldProgram = transcript.history[0].program;

            dao.TransferStudentToProgram(termId, studentId, programId, currentSemester);

            transcript = dao.GetStudentTranscript(studentId);
            string newProgram = transcript.history[0].program;

            Assert.AreNotEqual(oldProgram, newProgram);

            Assert.AreEqual(programId, dao.GetCurrentProgramId(studentId));
        }
コード例 #4
0
        public void CancelRegistrationTest()
        {
            // setup student
            DateTime registrationDate = new DateTime(2013, 8, 20);
            int      termId = 3, programId = 1, currentSemester = 1;

            int     studentNum = GetNextStudentNum();
            Student student    = new Student
            {
                StudentNum              = $"test{studentNum}",
                StudentLastName         = "LName",
                StudentFirstMidName     = "FName",
                StudentEmail            = "test",
                StudentHasHolds         = false,
                StudentAcademicStanding = true,
                StudentCanRegister      = true,
                StudentStartDate        = registrationDate
            };

            CentennialDA dao = new CentennialDA();

            dao.CreateStudent(ref student);
            int studentId = student.StudentId;

            dao.ProgramRegistrationNew(termId, programId, currentSemester, studentId);
            dao.CreateTranscript(studentId);

            // enroll in courses
            int coursesToEnroll = 3;

            foreach (TermCourseOption o in dao.GetTermCourses(termId))
            {
                if (coursesToEnroll == 0)
                {
                    break;
                }
                int sectionId = dao.GetSectionsForTermCourse(o.TermCourseId)[0].SectionId;
                dao.AddEnrollment(studentId, sectionId);
                coursesToEnroll--;
            }

            int numberEnrolledCourses = dao.GetNumberEnrolledCourses(studentId, termId);

            Assert.AreEqual(3, numberEnrolledCourses);

            numberEnrolledCourses = dao.GetStudentTranscript(studentId).history[0].records[0].institution.terms[0].courses.Count;
            Assert.AreEqual(3, numberEnrolledCourses);

            numberEnrolledCourses = dao.GetInvoiceInfo(studentId, termId).Invoice.tuition.Count;
            Assert.AreEqual(3, numberEnrolledCourses);

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

            Assert.IsTrue(hasRegistration);

            // cancel registration
            dao.CancelRegistration(studentId, termId);

            numberEnrolledCourses = dao.GetNumberEnrolledCourses(studentId, termId);
            Assert.AreEqual(0, numberEnrolledCourses);

            numberEnrolledCourses = dao.GetStudentTranscript(studentId).history[0].records[0].institution.terms[0].courses.Count;
            Assert.AreEqual(0, numberEnrolledCourses);

            Assert.IsNull(dao.GetInvoiceInfo(studentId, termId));

            hasRegistration = dao.HasValidRegistration(studentId, termId);
            Assert.IsFalse(hasRegistration);
        }