protected StudentInfoViewData(PersonDetails student) : base(student) { var gradeLevels = student.StudentSchoolYears .OrderBy(x => x.SchoolYearRef) .Select(x => IdNameViewData <int> .Create(x.GradeLevelRef, x.GradeLevel.Name)) .ToList(); GradeLevel = gradeLevels.LastOrDefault(); }
public static StudentInfoViewData Create(PersonDetails student, StudentDetailsInfo studentDetails, StudentSummaryInfo studentSummary, IList <ClassDetails> studentClasses, ClassDetails currentClass, Room currentRoom, int currentSchoolYearId) { var res = Create(student); res.DisplayName = studentDetails.DisplayName(includeMiddleName: true); var gradeLevels = student.StudentSchoolYears .OrderBy(x => x.SchoolYearRef) .Select(x => IdNameViewData <int> .Create(x.GradeLevelRef, x.GradeLevel.Name)) .ToList(); var currentStudentSchoolYear = student.StudentSchoolYears.FirstOrDefault(x => x.SchoolYearRef == currentSchoolYearId); if (currentStudentSchoolYear != null) { res.GradeLevel = gradeLevels.First(x => x.Id == currentStudentSchoolYear.GradeLevelRef); } res.IsHispanic = studentDetails.IsHispanic; res.HasMedicalAlert = studentDetails.HasMedicalAlert; res.IsAllowedInetAccess = studentDetails.IsAllowedInetAccess; res.SpecialInstructions = studentDetails.SpecialInstructions; res.SpEdStatus = studentDetails.SpEdStatus; res.IsIEPActive = studentDetails.IsIEPActive; res.IsTitle1Eligible = studentDetails.StudentSchool.IsTitle1Eligible; res.Section504 = !string.IsNullOrWhiteSpace(studentDetails.Section504Qualification) && studentDetails.Section504Qualification.Trim() != "NA"; res.IsHomeless = studentDetails.IsHomeless; res.IsImmigrant = studentDetails.IsImmigrant; res.Language = studentDetails.Language != null ? IdNameViewData <int> .Create(studentDetails.Language.Id, studentDetails.Language.Name) : null; res.Nationality = studentDetails.Country != null ? IdNameViewData <int> .Create(studentDetails.Country.Id, studentDetails.Country.Name) : null; res.Ethnicity = studentDetails.Ethnicity != null ? EthnicityViewData.Create(studentDetails.Ethnicity) : null; res.Lep = studentDetails.LimitedEnglishRef.HasValue; res.LimitedEnglishId = studentDetails.LimitedEnglishRef; res.IsForeignExchange = studentDetails.IsForeignExchange; res.StateIdNumber = studentDetails.StateIdNumber; res.AlternateStudentNumber = studentDetails.AltStudentNumber; res.StudentNumber = studentDetails.StudentNumber; res.OriginalEnrollmentDate = studentDetails.OriginalEnrollmentDate; res.IsRetained = student.StudentSchoolYears.First(x => x.SchoolYearRef == currentSchoolYearId).IsRetained; res.Counselor = studentDetails.Counselor != null ? ShortPersonViewData.Create(studentDetails.Counselor) : null; res.AttendanceBox = StudentHoverBoxViewData <TotalAbsencesPerClassViewData> .Create(studentSummary.DailyAttendance, studentSummary.Attendances, studentClasses); res.DisciplineBox = StudentHoverBoxViewData <DisciplineTypeSummaryViewData> .Create(studentSummary.InfractionSummaries, studentSummary.TotalDisciplineOccurrences); res.GradesBox = StudentHoverBoxViewData <StudentSummaryGradeViewData> .Create(studentSummary.StudentAnnouncements); res.CurrentAttandanceLevel = studentSummary.CurrentAttendanceLevel; res.CurrentClassName = NO_CLASS_SCHEDULED; if (currentClass != null) { res.CurrentClassName = currentClass.Name; } return(res); }