Example #1
0
        // GET: Report
        /// <summary>
        /// Returns an individual overall report for a student
        /// </summary>
        /// <param name="id">Student ID to generate Report for</param>
        /// <returns>Report data</returns>
        public ActionResult OverallReport(string id = null)
        {
            var CurrentId = DataSourceBackend.Instance.IdentityBackend.GetCurrentStudentID(HttpContext);

            // Todo: Remove when identity is fully hooked up
            // Hack, to keep the current system working, while the identity system is slowly hooked up everywhere.  If the user is not logged in, then the passed in user will work, if the user is logged in, then the passed in user is ignored.
            if (string.IsNullOrEmpty(CurrentId))
            {
                CurrentId = id;
            }

            ViewBag.StudentId = CurrentId;  //TODO: Remove this when identity is fully hooked up

            if (DataSourceBackend.Instance.IdentityBackend.BlockExecptForRole(CurrentId, UserRoleEnum.StudentUser))
            {
                return(RedirectToAction("Roster", "Portal"));
            }

            var myStudent = DataSourceBackend.Instance.StudentBackend.Read(CurrentId);

            if (myStudent == null)
            {
                return(RedirectToAction("Error", "Home"));
            }


            var myReport = new SchoolYearReportViewModel()
            {
                StudentId = CurrentId,
            };

            var myReturn = ReportBackend.Instance.GenerateOverallReport(myReport);

            return(View(myReturn));
        }
Example #2
0
        // GET: Report
        /// <summary>
        /// Returns an individual overall report for a student
        /// </summary>
        /// <param name="id">Student ID to generate Report for</param>
        /// <returns>Report data</returns>
        public ActionResult OverallReport(string id = null)
        {
            var CurrentId = DataSourceBackend.Instance.IdentityBackend.GetCurrentStudentID(HttpContext);

            if (DataSourceBackend.Instance.IdentityBackend.BlockExecptForRole(CurrentId, UserRoleEnum.TeacherUser))
            {
                return(RedirectToAction("Login", "Admin"));
            }

            var myStudent = DataSourceBackend.Instance.StudentBackend.Read(id);

            if (myStudent == null)
            {
                return(RedirectToAction("Error", "Home"));
            }


            var myReport = new SchoolYearReportViewModel()
            {
                StudentId = id,
            };

            var myReturn = ReportBackend.Instance.GenerateOverallReport(myReport);

            return(View(myReturn));
        }
        public void Models_SchoolYearReportViewModel_Default_Instantiate_Should_Pass()
        {
            // Act
            var result = new SchoolYearReportViewModel();

            // Assert
            Assert.IsNotNull(result, TestContext.TestName);
        }