// GET: /Weighting/ public ActionResult Index() { try { SiteUser su = ((SiteUser)Session["SiteUser"]); ModelServices modelServices = new ModelServices(); int userAssignedDistrict = su.Districts[0].Id; int schoolYearId = modelServices.SchoolYearId(); WeightingModel data = new WeightingModel(); data.SchoolYear = modelServices.SchoolYearDescription(); data.SummaryList = modelServices.GetWeightingSummary(userAssignedDistrict, schoolYearId); data.DistrictName = modelServices.GetDistrictName(userAssignedDistrict); data.DropDown = new DropDownData(); data.DropDown.Year = new YearDropDown(modelServices.SchoolYearDropDownData()); data.DropDown.Year.SelectedYear = schoolYearId; return View("Index", data); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }
public TeachersController() { _db = new dbTIREntities(); _modelServices = new ModelServices(); ViewBag.SchoolYear = _modelServices.SchoolYearDescription(); }
public ActionResult SummaryReportById(int teacherId, bool viewMeetExceedSummary = true) { try { SetNavigationLinksUrl(); SetViewBag(viewMeetExceedSummary); ViewBag.SummaryLink = "SummaryReportById"; ViewBag.TeacherFilter = teacherId; bool unAuthorizedRequest = false; SiteUser su = ((SiteUser)Session["SiteUser"]); ModelServices modelServices = new ModelServices(); StudentService studentService = new StudentService(su, entities); int defaultDistrict = su.Districts[0].Id; int schoolYearId = modelServices.SchoolYearId(); int[] userSchools = modelServices.getSchoolsByUserId(su.EdsUserId).ToArray(); var dropdownTeachers = modelServices.TeacherDropDownDataBySchoolAndYear(userSchools, schoolYearId, defaultDistrict); unAuthorizedRequest = dropdownTeachers.Where(x => x.Id == teacherId).Count() == 0 ? true : false; if (unAuthorizedRequest) { return RedirectToAction("AccessDenied", "Error"); } TIRSummaryModel data = new TIRSummaryModel(); data.SchoolYear = modelServices.SchoolYearDescription(); data.DropDown = new DropDownData(); data.DropDown.Year = new YearDropDown(modelServices.SchoolYearDropDownData()); data.DropDown.Year.SelectedYear = schoolYearId; data.DropDown.District = new DistrictDropDown(modelServices.DistrictDropDownDataByUser(su.EdsUserId)); data.DropDown.Teacher = new TeacherDropDown(dropdownTeachers); data.DropDown.Teacher.SelectedTeacher = teacherId; data.DropDown.Race = new RaceDropDown(modelServices.DropDownDataForRace(), true); data.DropDown.Gender = new GenderDropDown(modelServices.DropDownDataForGender(), true); data.DropDown.SchoolClass = new ClassDropDown(modelServices.GetClassesByTeacher(schoolYearId, new[] { teacherId })); var filterParameter = new FilterParameter { ClassId = classDefaultValue, Teacher = teacherId, School = userSchools.First(), Year = schoolYearId, SchoolYear = data.SchoolYear }; data.SummaryList = modelServices.GetSummaryReport(filterParameter); data.DropDown.School = new SchoolDropDown(modelServices.GetSchoolDropDownData(su.EdsUserId, schoolYearId)); var reportFilterViewModel = ReportsFilterHelper.PopulateReportFilterViewModel(filterParameter, modelServices, su); ViewBag.ReportFilters = reportFilterViewModel; return View("SummaryReport", data); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }
public ActionResult SummaryReport(bool viewMeetExceedSummary = true) { try { SetNavigationLinksUrl(); ViewBag.SummaryLink = "SummaryReport"; SetViewBag(viewMeetExceedSummary); SiteUser su = ((SiteUser)Session["SiteUser"]); ModelServices modelServices = new ModelServices(); StudentService studentService = new StudentService(su, entities); int defaultDistrict = su.Districts[0].Id; int schoolYearId = modelServices.SchoolYearId(); int[] userSchools = modelServices.getSchoolsByUserId(su.EdsUserId).ToArray(); TIRSummaryModel data = new TIRSummaryModel(); data.SchoolYear = modelServices.SchoolYearDescription(); data.DropDown = new DropDownData(); data.DropDown.Year = new YearDropDown(modelServices.SchoolYearDropDownData()); data.DropDown.Year.SelectedYear = schoolYearId; data.DropDown.District = new DistrictDropDown(modelServices.DistrictDropDownDataByUser(su.EdsUserId)); data.DropDown.Race = new RaceDropDown(modelServices.DropDownDataForRace(), true); data.DropDown.Race.SelectedRace = -1; data.DropDown.Gender = new GenderDropDown(modelServices.DropDownDataForGender(), true); data.DropDown.Gender.SelectedGender = -1; data.DropDown.School = new SchoolDropDown(modelServices.GetSchoolDropDownData(su.EdsUserId, schoolYearId)); if (su.isTeacher) { data.DropDown.Teacher = new TeacherDropDown( new List<DropDownIdName>() { new DropDownIdName() { Id = su.EdsUserId, Name = su.UserFullName } }); data.DropDown.SchoolClass = new ClassDropDown(modelServices.GetClassesByTeacher(schoolYearId, new[] { su.EdsUserId })); } else // data administrator and eds administrator { int[] schoolsTeacher = modelServices.getTeachersBySchoolsId(userSchools).ToArray(); data.DropDown.Teacher = new TeacherDropDown(modelServices.TeacherDropDownDataBySchoolAndYear(userSchools, schoolYearId, defaultDistrict)); data.DropDown.SchoolClass = new ClassDropDown(modelServices.GetClassesByTeacher(schoolYearId, schoolsTeacher)); } var filterParameter = new FilterParameter { ClassId = classDefaultValue, Teacher = su.EdsUserId, School = userSchools.First(), Year = schoolYearId, SchoolYear = data.SchoolYear }; data.SummaryList = modelServices.GetSummaryReport(filterParameter); var reportFilterViewModel = ReportsFilterHelper.PopulateReportFilterViewModel(filterParameter, modelServices, su); ViewBag.ReportFilters = reportFilterViewModel; return View(data); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }