private IList <CourseOffering> FetchTerms(int pageNumber, bool showFirstTerm = false) { Dictionary <int, DateTime> terms = null; IEnrollmentService service = new EnrollmentService(); terms = service.FetchTermsForOnlineEnrollment(); int selectedTerm = 0; if (showFirstTerm) { selectedTerm = terms.First().Key; Session[UserController.SessionKeyCourseOfferingTermId] = selectedTerm; } else { selectedTerm = Convert.ToInt32(Session[UserController.SessionKeyCourseOfferingTermId]); } var studentNo = Session[UserController.SessionKeyStudentNo].ToString(); ViewData["enrollmentTerms"] = terms; // Load Terms var courseOffering = GetCourseOffering(service, studentNo, selectedTerm, pageNumber); return(courseOffering); }
public EnrollmentsController(EnrollmentService enrollmentService, IMapper mapper, IConfiguration configuration, DatabaseContext context) { _mapper = mapper; _context = context; _configuration = configuration; _enrollmentService = enrollmentService; }
public CourseSummariesController(DatabaseContext databaseContext, IMapper mapper, EnrollmentService enrollmentService, EnrollmentStepService enrollmentStepService) { _context = databaseContext; _mapper = mapper; _enrollmentService = enrollmentService; _enrollmentStepService = enrollmentStepService; }
public ActionResult EnrollmentCourseByTerm(int enrollmentTerms) { var studentNo = Session[UserController.SessionKeyStudentNo].ToString(); Session[UserController.SessionKeyCourseOfferingTermId] = enrollmentTerms; try { int selectedTerm = Convert.ToInt32(Session[UserController.SessionKeyCourseOfferingTermId]); IEnrollmentService service = new EnrollmentService(); // Fill Term List Dictionary <int, DateTime> terms = null; terms = service.FetchTermsForOnlineEnrollment(); ViewData["enrollmentTerms"] = terms; var courseOffering = GetCourseOffering(service, studentNo, selectedTerm, 1); return(View("Enroll", courseOffering)); } catch (Exception ex) { _logger.Error("Exception Occurred. StudentNo: " + studentNo, ex); Response.Redirect(AppHelper.SharedUrl("Reply/Error")); return(null); } }
public void EnrollmentService_SqlEnrollmentRepository_UnEnroll_a_Enrolled_Student() { IEnrollmentService service = new EnrollmentService(new SqlEnrollmentRepository()); // First enroll a student // var courseEnrollment = new CourseEnrollment { CourseOfferingNo = 0, StudentId = -98, GradeNo = 1, StatusId = 1, ImportDate = DateTime.Now, ImportConversion = "Student Portal" }; int isEnrolled = service.EnrollStudent(courseEnrollment); Assert.AreEqual(1, isEnrolled); // Then Un-Enroll that student // var isUnEnrolled = service.UnEnrollStudent(courseEnrollment.StudentId, courseEnrollment.CourseOfferingNo); Assert.IsTrue(isUnEnrolled); }
public void ValidStudentEnrollment_Should_EnrollStudentInCourse() { // ARRANGE var courseId = 1; var studentId = 1; var mockCourseRepository = new MockCourseRepository(); mockCourseRepository.GetIncludingProfessorsStudents(courseId, new Course { Students = new List <Student>(), Credits = 2 }); var mockStudent = new Student { Courses = new List <Course> { new Course { Credits = 1 } } }; var mockStudentRepository = new MockStudentRepository(); mockStudentRepository.GetIncludingCourses(studentId, mockStudent); // ACT var enrollmentService = new EnrollmentService(mockCourseRepository.Object, mockStudentRepository.Object); var result = enrollmentService.Enroll(1, 1); // ASSERT result.Should().BeEmpty("Successfully enrolling in a course should not return validation errors"); }
public void EnrollmentService_SqlEnrollmentRepository_Fetches_List_of_Terms() { IEnrollmentService service = new EnrollmentService(new SqlEnrollmentRepository()); Dictionary <int, DateTime> terms = service.FetchTermsForOnlineEnrollment(); Assert.IsNotNull(terms); }
public EnrollmentCtrl(EnrollmentScope scope, EnrollmentService service, Sce sce) : base(scope, service, sce) { this.scope = scope; this.service = service; this.scope.courseList = new List <Course>(); this.scope.studentList = new List <Student>(); scope.gridOpts.columnDefs = new List <ColumnDef> { new ColumnDef { name = "AC", width = 50, enableSorting = false, cellTemplate = "<div style='text-align:center'><a ng-click=\"getExternalScopes().EditAction(row)\" href=\"javascript:;\"> <i class=\"fa fa-pencil\"></i> </a><a ng-click=\"getExternalScopes().RemoveAction(row)\" href=\"javascript:;\"> <i class=\"fa fa-trash\"></i> </a></div>" } , new ColumnDef { name = "Course", field = "Course_Title" } , new ColumnDef { name = "Student", field = "Student_FirstName" } , new ColumnDef { name = "Grade" } }; scope.gridOpts.onRegisterApi = gridApi => { gridApi.paging.on.pagingChanged(scope, (newPage, pageSize) => { this.pageNo = newPage; this.pageSize = pageSize; this.GetPaged(); }); }; this.GetPaged(); this.LoadRelationalData(); }
public async Task EnrollStudentInCourseSection_Should_ReturnStudentNotFound( EnrollmentService enrollmentService) { var result = await enrollmentService.EnrollStudentInCourseSection(1, 1); result.Status.Should().Be(EnrollmentResultStatus.StudentNotFound); }
protected void grdPatienOrder_SelectedIndexChanged(object sender, EventArgs e) { string theUrl = string.Empty; //DataTable theDT = (DataTable)grdPatienBill.DataSource; // DataRow theDR = theDT.Rows[grdPatienBill.SelectedIndex]; int orderId = int.Parse(grdPatienOrder.SelectedDataKey.Values["Id"].ToString()); int patientId = int.Parse(grdPatienOrder.SelectedDataKey.Values["PatientPk"].ToString()); int moduleId = int.Parse(grdPatienOrder.SelectedDataKey.Values["ModuleId"].ToString()); if (moduleId <= 0) { EnrollmentService es = new EnrollmentService(patientId); List <PatientEnrollment> pe = es.GetPatientEnrollment(CurrentSession.Current); if (pe != null) { moduleId = pe.FirstOrDefault().ServiceAreaId; base.Session["TechnicalAreaName"] = pe.FirstOrDefault().ServiceArea.Name; } } else { base.Session["TechnicalAreaName"] = this.GetModuleName(moduleId); } // patientID = Int32.Parse(theDR.ItemArray[0].ToString()); base.Session["PatientId"] = patientId; base.Session["PatientVisitId"] = orderId; base.Session["TechnicalAreaId"] = moduleId; Session["PatientInformation"] = null; theUrl = "~/Laboratory/LabResultPage.aspx"; base.Session[SessionKey.LabClient] = null; Response.Redirect(theUrl, false); }
public void EnrollmentService_SqlEnrollmentRepository_UnEnrollStudent_returns_false_if_Student_is_Not_Enrolled() { // Case 1: course offering exists but student is not enrolled // IEnrollmentService service = new EnrollmentService(new TestEnrollmentRepository()); int studentId = -123; int courseOfferingNo = 604; try { // This line should throw an exception service.UnEnrollStudent(studentId, courseOfferingNo); // This should not be executed. In case of a duplicate entry // above line must throw an exception. Assert.Fail(); } catch (Exception) { // Nothing to do, since in this scenario exception must be thrown } // Case 2: course offering does not exists but student exists // studentId = 2593; courseOfferingNo = -123; try { // This line should throw an exception service.UnEnrollStudent(studentId, courseOfferingNo); // This should not be executed. In case of a duplicate entry // above line must throw an exception. Assert.Fail(); } catch (Exception) { // Nothing to do, since in this scenario exception must be thrown } // Case 3: both course offering and student do not exist // studentId = 2593; courseOfferingNo = 604; try { // This line should throw an exception service.UnEnrollStudent(studentId, courseOfferingNo); // This should not be executed. In case of a duplicate entry // above line must throw an exception. Assert.Fail(); } catch (Exception) { // Nothing to do, since in this scenario exception must be thrown } }
public EnrollmentSummariesController(DatabaseContext databaseContext, IMapper mapper, IConfiguration configuration, EnrollmentStepService enrollmentStepService, EnrollmentService enrollmentService) { _configuration = configuration; _context = databaseContext; _mapper = mapper; _enrollmentStepService = enrollmentStepService; _enrollmentService = enrollmentService; }
protected override async Task OnInitializedAsync() { Id = Id ?? "1"; Student = await StudentService.GetStudent(int.Parse(Id)); Enrollments = (await EnrollmentService.GetEnrollmentBySID(int.Parse(Id))).ToList(); //Student = (await StudentService.GetStudent(int.Parse(Id))).ToList(); }
public PaymentsController(IConfiguration configuration, IMapper mapper, DatabaseContext context, EnrollmentStepService enrollmentStepService, EnrollmentService enrollmentService) { _configuration = configuration; _context = context; _mapper = mapper; _enrollmentStepService = enrollmentStepService; _enrollmentService = enrollmentService; }
public ContractsController(IMapper mapper, IConfiguration configuration, EnrollmentStepService enrollmentStepService, EnrollmentService enrollmentService, ContractService contractService) { _configuration = configuration; _mapper = mapper; _enrollmentStepService = enrollmentStepService; _enrollmentService = enrollmentService; _contractService = contractService; }
public ActionResult UnEnroll(string CourseOfferingNo, int pageNumber) { CourseEnrollment CourseEnrollment = new CourseEnrollment(); var studentNo = Session[UserController.SessionKeyStudentNo].ToString(); try { IEnrollmentService service = new EnrollmentService(); bool isUnEnroll = service.UnEnrollStudent(int.Parse(studentNo), int.Parse(CourseOfferingNo)); int selectedTerm = Convert.ToInt32(Session[UserController.SessionKeyCourseOfferingTermId]); // Load Terms Dictionary <int, DateTime> terms = null; terms = service.FetchTermsForOnlineEnrollment(); ViewData["enrollmentTerms"] = terms; // Load Course var courseOffering = GetCourseOffering(service, studentNo, selectedTerm, pageNumber); //int totalRows = 0; //var courseOffering = service.FetchCourseOfferings(Convert.ToInt32(studentNo), selectedTerm, out totalRows, pageNumber, PageSize); //int totalPages = totalRows / PageSize; //ViewData["pageNumberLast"] = totalPages; ////int pageNumber = 1; //// Decrement page number only if it doesn't pass the minimum page number. //ViewData["pageNumberPrev"] = (pageNumber <= 1) ? 1 : pageNumber - 1; //ViewData["pageNumberCurrent"] = pageNumber; //// Increment page number only if it doesn't pass the maximum page number. //ViewData["pageNumberNext"] = (pageNumber >= totalPages) ? totalPages : pageNumber + 1; if (isUnEnroll) { ViewData["successMsgUnEnroll"] = "1"; } else { var sb = new StringBuilder(); sb.AppendFormat("Unable to enroll student. EnrollStudent returned: {0}, EnrollmentData:{1}", isUnEnroll, CourseEnrollment); _logger.Warn(sb.ToString()); Response.Redirect(AppHelper.SharedUrl("Reply/Error")); } return(View("Enroll", courseOffering)); } catch (Exception ex) { var sb = new StringBuilder(); sb.AppendFormat("Exception Occurred. StudentNo: {0}, EnrollmentData:{1}", studentNo, CourseEnrollment); _logger.Error(sb.ToString(), ex); Response.Redirect(AppHelper.SharedUrl("Reply/Error")); return(null); } }
protected override async Task OnInitializedAsync() { Id = Id ?? "1"; Student = await StudentService.GetStudent(int.Parse(Id)); Students = (await StudentService.GetAllStudents()).ToList(); Courses = (await CourseService.GetAllCourses()).ToList(); Enrollments = (await EnrollmentService.GetAllEnrollments()).ToList(); }
public void EnrollmentService_TestEnrollmentRepository_UnEnroll_a_Enrolled_Student() { IEnrollmentService service = new EnrollmentService(new TestEnrollmentRepository()); int studentId = 1; int courseOfferingNo = 1; bool isEnrolled = service.UnEnrollStudent(studentId, courseOfferingNo); Assert.IsNotNull(isEnrolled); }
public void Setup() { var unitOfWorkFactory = new Mock <IUnitOfWorkFactory>(); unitOfWorkFactory.Setup(x => x.GetUnitOfWork()).Returns(unitOfWork.Object); unitOfWork.Setup(x => x.EnrollmentRepository).Returns(enrollmentRepository.Object); enrollmentService = new EnrollmentService(unitOfWorkFactory.Object); }
public async Task<IActionResult> Index(EnrollmentService es) { if (ModelState.IsValid) { es = DatabaseModel; await TryUpdateModelAsync(es); } return View(es); }
public void GetEnrollments() { IEnrollmentService enrollmentService = new EnrollmentService(new PlugUnitOfWork(new PlugDbContextFactory())); var outputResult = enrollmentService.GetEnrollments(new Plug.Models.Input <System.Guid> { Arguments = new System.Guid("66EA3A48-49E7-41D4-B36A-BBD86922FAC5") }); Assert.IsTrue(outputResult.Sucess); }
public IActionResult Index(EnrollmentService model) { if (ModelState.IsValid) { return(Ok(model)); } else { return(HttpBadRequest(ModelState)); } }
public void DropEnrolledScheduleTest() { //// Arrange var errors = new List <string>(); var mockRepository = new Mock <IEnrollmentRepository>(); var enrollmentService = new EnrollmentService(mockRepository.Object); //// Act enrollmentService.EnrollSchedule(string.Empty, -1, ref errors); //// Assert Assert.AreEqual(1, errors.Count); }
public void GetCourseErrorTest() { //// Arrange var errors = new List <string>(); var mockRepository = new Mock <IEnrollmentRepository>(); var enrollmentService = new EnrollmentService(mockRepository.Object); //// Act enrollmentService.GetCourse(-1, ref errors); //// Assert Assert.AreEqual(1, errors.Count); }
public void EnrollmentService_SqlEnrollmentRepository_Fetches_CourseOfferings_for_a_Student_to_Enroll_against_Term() { IEnrollmentService service = new EnrollmentService(new SqlEnrollmentRepository()); int studentId = 1; int termId = 1; int pageNumber = 1; int pageSize = 5; int totalRows = 0; IList <CourseOffering> courseOfferings = service.FetchCourseOfferings(studentId, termId, out totalRows, pageNumber, pageSize); Assert.IsNotNull(courseOfferings); }
public static StringBuilder Formify(EnrollmentService model) { var builder = new StringBuilder(); var set = new HashSet <object>(); Visit(builder, set, "", model); if (builder[builder.Length - 1] == '&') { builder.Length--; } return(builder); }
public async Task EnrollStudentInCourseSection_Should_ReturnCourseNotFound( EnrollmentService enrollmentService, Student student, SchoolContext schoolContext) { student.Person = null; schoolContext.Add(student); await schoolContext.SaveChangesAsync(); var result = await enrollmentService.EnrollStudentInCourseSection(student.StudentId, 1); result.Status.Should().Be(EnrollmentResultStatus.CourseSectionNotFound); }
public void DeleteEnrollmentErrorTest() { //// Arrange var errors = new List <string>(); var mockRepository = new Mock <IEnrollmentRepository>(); var enrollmentService = new EnrollmentService(mockRepository.Object); //// Act enrollmentService.DeleteEnrollment(null, -1, ref errors); //// Assert Assert.AreEqual(2, errors.Count); }
public PanelController( TeacherProfileService teacherProfileService, PackageService packageService, EnrollmentService enrollmentService, StudentInfoService studentInfoService, ImageService imageService, AssignmentService assignmentService ) { _imageService = imageService; _teacherProfileService = teacherProfileService; _packageService = packageService; _enrollmentService = enrollmentService; _studentInfoService = studentInfoService; _assignmentService = assignmentService; }
// GET: Student public ActionResult ViewEnrollments() { List <enrollment> list = new List <enrollment>(); list = new EnrollmentService().GenEnrollments(); List <enrollment> returnEnroll = new List <enrollment>(); foreach (enrollment e in list) { if (e.userID == int.Parse(Session["loggedUser"].ToString())) { returnEnroll.Add(e); } } return(View(returnEnroll)); }
public void EnrollmentService_TestEnrollmentRepository_Enrolls_Student_in_a_Class_Offered_in_a_Term() { IEnrollmentService service = new EnrollmentService(new TestEnrollmentRepository()); var courseEnrollment = new CourseEnrollment { CourseOfferingNo = 0, StudentId = 0, GradeNo = 1, StatusId = 1, ImportDate = DateTime.Now, ImportConversion = "Student Portal" }; int isEnrolled = service.EnrollStudent(courseEnrollment); Assert.AreEqual(1, isEnrolled); }