public static StudentDisplayObject MapStudentToStudentDisplayObject(Student student, IEnumerable<Section> sections, IEnumerable<Assessment> assessments, IEnumerable<StudentAcademicRecord> academicRecords) { var newStudent = new StudentDisplayObject(); try { newStudent.id = student.id; newStudent.name = string.Format("{0} {1}", student.name.firstName, student.name.lastSurName); newStudent.sections = from s in sections select s.id; newStudent.disabilities = from d in student.disabilities select FilterHelper.GetEnumDescription(d.disability); //sometime there's no learning style data if (student.learningStyles != null) { newStudent.auditoryLearning = student.learningStyles.auditoryLearning; newStudent.tactileLearning = student.learningStyles.tactileLearning; newStudent.visualLearning = student.learningStyles.visualLearning; } newStudent.birthDate = student.birthData.birthDate.ToShortDateString(); newStudent.profileThumbnail = student.profileThumbnail; newStudent.race = student.race; newStudent.schoolFoodServicesEligiblity = FilterHelper.GetEnumDescription(student.schoolFoodServicesEligiblity); newStudent.section504Disablities = student.section504Disablities; newStudent.studentCharacteristics = from sc in student.studentCharacteristics select FilterHelper.GetEnumDescription(sc.characteristic); newStudent.languages = student.languages; newStudent.homeLanguages = student.homeLanguages; newStudent.learningStyles = student.learningStyles; newStudent.gradeLevel = FilterHelper.GetEnumDescription(student.gradeLevel); newStudent.economicDisadvantaged = student.economicDisadvantaged; newStudent.hispanicLatinoEthnicity = student.hispanicLatinoEthnicity; newStudent.oldEthnicity = FilterHelper.GetEnumDescription(student.oldEthnicity); newStudent.limitedEnglishProficiency = FilterHelper.GetEnumDescription(student.limitedEnglishProficiency); newStudent.otherName = from son in student.otherName select string.Format("{0} {1}", son.firstName, son.lastSurName); newStudent.studentCharacteristics = from sc in student.studentCharacteristics select FilterHelper.GetEnumDescription(sc.characteristic); newStudent.studentIndicators = from si in student.studentIndicators select si.indicator; newStudent.telephones = student.telephones; newStudent.sex = FilterHelper.GetEnumDescription(student.sex); newStudent.displacementStatus = student.displacementStatus; //get the gpa var studentAcademicRecord = academicRecords.FirstOrDefault(a => a.studentId == student.id); newStudent.cumulativeGradePointAverage = studentAcademicRecord != null ? studentAcademicRecord.cumulativeGradePointAverage : 0; newStudent.assessments = assessments; } catch (Exception e) { ExceptionHelper.LogCaughtException(e); } return newStudent; }
public static StudentDisplayObject MapStudentToStudentDisplayObject(Student student, IEnumerable<Section> sections, IEnumerable<Assessment> assessments) { var newStudent = new StudentDisplayObject(); newStudent.id = student.id; newStudent.name = string.Format("{0} {1}", student.name.firstName, student.name.lastSurName); newStudent.sections = from s in sections select s.id; newStudent.disabilities = from d in student.disabilities select FilterHelper.GetEnumDescription(d.disability).title; newStudent.learningStyles = student.learningStyles; newStudent.assessments = assessments; return newStudent; }