public ActionResult UpdateGrid(string hiddenSchoolFilter, string hiddenSchoolYearFilter) { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); StudentService studentService = new StudentService(siteUser, db); SchoolService schoolService = new SchoolService(siteUser, db); ModelServices modelService = new ModelServices(); ViewBag.DistrictDesc = siteUser.Districts[0].Name; int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(hiddenSchoolYearFilter)); ViewBag.SchoolId = modelService.DropDownDataSchool(hiddenSchoolFilter, siteUser.EdsUserId, schoolYearId, true); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT"); ViewBag.SchoolYearList = schoolService.DropDownDataSchoolYear(hiddenSchoolYearFilter); ViewBag.SchoolYear = hiddenSchoolYearFilter; return View("Index", new SiteModels() { Students = studentService.GetViewData(hiddenSchoolYearFilter, hiddenSchoolFilter) }); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }
// GET: /Students/ public ActionResult Index() { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); StudentService studentService = new StudentService(siteUser, db); SchoolService schoolService = new SchoolService(siteUser, db); ModelServices modelService = new ModelServices(); string currentSchoolYear = schoolService.GetCurrentSchoolYear(); ViewBag.DistrictDesc = siteUser.Districts[0].Name; int schoolYearId = modelService.SchoolYearId(); ViewBag.SchoolId = modelService.DropDownDataSchool("", siteUser.EdsUserId, schoolYearId, true); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT"); //ViewBag.SchoolYear = HelperService.SchoolYearDescription(db); ViewBag.SchoolYearList = schoolService.DropDownDataSchoolYear(currentSchoolYear); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT"); ViewBag.SchoolYear = currentSchoolYear; return View(new SiteModels() { Students = studentService.GetViewData(currentSchoolYear, "", "") }); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }
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"); } }
public void PopulateViewData(StudentExt studentExt) { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); StudentService studentService = new StudentService(siteUser, db); ModelServices modelService = new ModelServices(); studentExt.DistrictId = siteUser.Districts[0].Id; studentExt.DistrictDesc = siteUser.Districts[0].Name; studentExt.StudentClasses = studentExt.StudentId != 0 ? modelService.GetClassesByStudent(studentExt.StudentId, studentExt.SchoolYear) : null; studentExt.SchoolYears = studentExt.StudentId != 0 ? modelService.GetSchoolYearByStudent(studentExt.StudentId) : null; studentExt.DropDown = new DropDownData(); int schoolYearId = modelService.GetSchoolYearId(studentExt.SchoolYear); studentExt.DropDown.School = new SchoolDropDown(modelService.GetSchoolDropDownData(siteUser.EdsUserId, schoolYearId), false); studentExt.DropDown.School.SelectedSchool = studentExt.ServingSchoolId; studentExt.DropDown.Grade = new GradeDropDown(studentService.DropDownDataForGrade()); studentExt.DropDown.Grade.SelectedGrade = (studentExt.GradeLevel != null) ? (int)studentExt.GradeLevel : -1; studentExt.DropDown.Gender = new GenderDropDown(modelService.DropDownDataForGender()); studentExt.DropDown.Gender.SelectedGender = (studentExt.GenderId != null) ? (int)studentExt.GenderId : 1; studentExt.DropDown.Lineage = new LineageDropDown(studentService.DropDownDataForLineage()); studentExt.DropDown.Lineage.SelectedLineage = (studentExt.LineageId != null) ? (int)studentExt.LineageId : -1; studentExt.DropDown.HomeLanguage = new LanguageDropDown(studentService.DropDownDataForLanguage()); studentExt.DropDown.HomeLanguage.SelectedLanguage = (studentExt.HomeLanguageId != null) ? (int)studentExt.HomeLanguageId : -1; studentExt.DropDown.NativeLanguage = new LanguageDropDown(studentService.DropDownDataForLanguage()); studentExt.DropDown.NativeLanguage.SelectedLanguage = (studentExt.NativeLanguageId != null) ? (int)studentExt.NativeLanguageId : -1; studentExt.DropDown.Race = new RaceDropDown(modelService.DropDownDataForRace()); studentExt.DropDown.Race.SelectedRace = (studentExt.RaceId != null) ? (int)studentExt.RaceId : -1; ViewBag.SchoolYear = studentExt.SchoolYear; }
public ActionResult Edit([Bind(Include = "StudentId,StudentSchoolYearId,SchoolYearId,DistrictId,FirstName,MiddleName,LastName,BirthDate,Hispanic,StateId,LocalId,EnrollmentDate,IepIndicator,LepIndicator,FrlIndicator,")] StudentExt studentExt, int hdSchoolId, int? hdLineageId, int hdGradeId, int hdGenderId, int? hdRaceId, int? hdHomeLanguageId, int? hdNativeLanguageId, int schoolYear) { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); StudentService studentService = new StudentService(siteUser, db); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT"); if (ModelState.IsValid) { studentExt.ServingSchoolId = hdSchoolId; studentExt.LineageId = hdLineageId; studentExt.NativeLanguageId = hdNativeLanguageId; studentExt.HomeLanguageId = hdHomeLanguageId; studentExt.RaceId = hdRaceId; studentExt.GradeLevel = (short)hdGradeId; studentExt.GenderId = hdGenderId; studentExt.SchoolYear = schoolYear; if (studentService.IsStudentExist(studentExt.StateId, null, studentExt.StudentId)) { PopulateViewData(studentExt); ModelState.AddModelError("StateId", "State Id already exists"); return View(studentExt); } else if (studentService.IsStudentExist(null, studentExt.LocalId, studentExt.StudentId)) { PopulateViewData(studentExt); ModelState.AddModelError("LocalId", "Local Id already exists"); return View(studentExt); } else { studentService.SaveStudents(studentExt); } } return RedirectToAction("Index"); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }
public ActionResult Edit(int studentId, int schoolYear) { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); StudentService studentService = new StudentService(siteUser, db); ModelServices modelService = new ModelServices(); StudentExt studentExt = studentService.GetStudentDetail(studentId, schoolYear); PopulateViewData(studentExt); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT"); return View(studentExt); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }