public ActionResult TransferStudentProgram(ProgramRegistration model) { if (dao.TransferStudentToProgram(model.TermId, model.StudentId, model.ProgramId, model.CurrentSemester)) { // transfer success return(RedirectToAction("Index")); } else { // transfer fail return(View("EditProgramRegistration", model)); } }
public string ProgramTransfer(int TermId, int ProgramId) { Student student = (Student)Session["student"]; int studentId = student.StudentId; int toSemester = dao.GetCurrentSemesterInStudentProgram(studentId, ProgramId); if (dao.TransferStudentToProgram(TermId, studentId, ProgramId, toSemester)) { return("Program transferred successfully."); } else { return("A problem occured during program transfer operation."); } }
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)); }