// 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 UpdateGrid(string hiddenSchoolFilter, string hiddenSchoolYearFilter) { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); ClassService classService = new ClassService(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.SchoolYear = schoolService.DropDownDataSchoolYear(hiddenSchoolYearFilter); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "CLASS"); return(View("Index", new SiteModels() { SchoolClasses = classService.GetViewData(hiddenSchoolYearFilter, hiddenSchoolFilter) })); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return(View("GeneralError")); } }
public ActionResult Edit( [Bind( Include = "Subject,LocalId,StudentId,FirstName,LastName,Score,AssessmentType,SchoolTerm,SchoolYear,AssessmentDesc,AssessmentId" )] StudentScore studentScore) { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); AssessmentScoreService assessmentService = new AssessmentScoreService(siteUser, db); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT"); tblAssessmentScore assscore = db.tblAssessmentScores.Where( k => k.AssessmentId == studentScore.AssessmentId && k.StudentId == studentScore.StudentId) .ToList() .FirstOrDefault(); assscore.Score = studentScore.Score; assessmentService.UpdateStudentScore(assscore); return(RedirectToAction("Search", TempData["AssessmentModel"])); // return RedirectToAction("Index"); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return(View("GeneralError")); } }
private void PopulateViewData(tblClass tblclass, ClassWizardSteps?defaultWizardStep, bool?showTeachersForDistrict, bool?showStudentsForDistrict) { ViewBag.DefaultWizardStep = defaultWizardStep; ViewBag.ShowTeachersForDistrict = !showTeachersForDistrict.GetValueOrDefault(); ViewBag.ShowStudentsForDistrict = !showStudentsForDistrict.GetValueOrDefault(); var db = new dbTIREntities(); SiteUser siteUser = (SiteUser)Session["SiteUser"]; SchoolService schoolService = new SchoolService(siteUser, db); ClassService classService = new ClassService(siteUser, db); ModelServices modelService = new ModelServices(); int userAssignedDistrict = siteUser.Districts[0].Id; bool filterTeachersByDistrict = showTeachersForDistrict.GetValueOrDefault(); int districtId = userAssignedDistrict; // Get teachers for this class var teachersForThisClass = classService.GetTeachersForThisClass(tblclass); // Get teachers not in this class var teachersNotForThisClass = classService.GetTeachersNotForThisClass(tblclass, filterTeachersByDistrict, districtId); //Get students for this class var studentsForThisClass = classService.GetStudentForThisClass(tblclass); // Get students not for this class var availableStudents = classService.GetStudentNotForThisClass(tblclass, districtId); var availableStudentsForSchool = classService.GetStudentForSchool(tblclass, districtId); // Add data to ViewBag for form ViewBag.TeachersForThisClass = new MultiSelectList(teachersForThisClass, "TeacherId", "FullName", null); ViewBag.AvailableTeachers = new MultiSelectList(teachersNotForThisClass, "TeacherId", "FullName", null); if (showStudentsForDistrict.GetValueOrDefault()) { ViewBag.AvailableStudents = new MultiSelectList(availableStudents, "StudentId", "FullName", null); } else { ViewBag.AvailableStudents = new MultiSelectList(availableStudentsForSchool, "StudentId", "FullName", null); } ViewBag.StudentsForThisClass = new MultiSelectList(studentsForThisClass, "StudentId", "FullName", null); ViewBag.StudentsForThisClassCount = studentsForThisClass.Count(); ViewBag.SchoolId = modelService.DropDownDataSchool(Convert.ToString(tblclass.SchoolId), siteUser.EdsUserId, tblclass.SchoolYearId, false); ViewBag.SchoolYearId = modelService.GetUserSchoolYear(siteUser.EdsUserId, siteUser.Districts[0].Id, tblclass.SchoolYearId); ViewBag.ClassDesc = db.tblClasses.Where(x => x.ClassId == tblclass.ClassId).Select(x => x.ClassDesc).SingleOrDefault(); ViewBag.SubjectId = new SelectList(db.tblSubjects.OrderBy(x => x.SubjectDesc), "SubjectId", "SubjectDesc", tblclass.SubjectId); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "CLASS"); }
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 Index() { try { var db = new dbTIREntities(); SiteUser su = (SiteUser)Session["SiteUser"]; KnowledgeBaseService kbService = new KnowledgeBaseService(su, db); List <KnowledgeBase> KnowledgeBaseItems = new List <KnowledgeBase>(); KnowledgeBaseItems = kbService.GetKnowledgeBase().ToList(); ViewBag.AllowEdit = HelperService.AllowUiEdits(su.RoleDesc, "USER"); return(View(KnowledgeBaseItems)); } 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")); } }