コード例 #1
0
 public static StudentDetailsViewData Create(StudentDetailsInfo student, decimal?gradeAvg, ShortStudentAbsenceInfo absences, int?infractions)
 {
     return(new StudentDetailsViewData
     {
         Id = student.Id,
         DisplayName = student.DisplayName(),
         FullName = student.FullName(),
         FirstName = student.FirstName,
         LastName = student.LastName,
         Gender = student.Gender,
         Role = RoleViewData.Create(CoreRoles.STUDENT_ROLE),
         IsHispanic = student.IsHispanic,
         Ethnicity = student.Ethnicity != null?EthnicityViewData.Create(student.Ethnicity) : null,
                         Absences = absences != null?decimal.Round(absences.NumberOfAbsences) : (decimal?)null,
                                        Discipline = infractions ?? 0,
                                        GradeAvg = gradeAvg.HasValue ? decimal.Round(gradeAvg.Value, 2) : (decimal?)null,
                                        IsIEPActive = student.IsIEPActive,
                                        IsRetainedFromPrevSchoolYear = false,
                                        TotalOfDaysEnrolled = absences?.NumberOfDaysEnrolled
     });
 }
コード例 #2
0
        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);
        }