Ejemplo n.º 1
0
 public static StudentStandardizedTestStats Create(StudentDetailsInfo student, decimal?gradeAvg, ShortStudentAbsenceInfo absences, int?infractions,
                                                   IList <StandardizedTestStatsViewData> standardizedTestStats)
 {
     return(new StudentStandardizedTestStats
     {
         Student = StudentDetailsViewData.Create(student, gradeAvg, absences, infractions),
         StandardizedTestsStats = standardizedTestStats
     });
 }
Ejemplo n.º 2
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
     });
 }
Ejemplo n.º 3
0
        public IList <StudentDetailsInfo> GetClassStudentsDetails(int classId, bool?isEnrolled = null)
        {
            Trace.Assert(Context.SchoolLocalId.HasValue);

            using (var uow = Read())
            {
                var studentsDetails = new StudentDataAccess(uow).GetDetailsByClass(classId, isEnrolled);
                var ethnicitiesIds  = studentsDetails
                                      .Where(x => x.PrimaryPersonEthnicity != null)
                                      .Select(x => x.PrimaryPersonEthnicity.EthnicityRef).ToList();
                var ethnicities = new DataAccessBase <Ethnicity, int>(uow).GetByIds(ethnicitiesIds);

                var languagesIds = studentsDetails
                                   .Where(x => x.PrimaryPersonLanguage != null)
                                   .Select(x => x.PrimaryPersonLanguage.LanguageRef).ToList();
                var languages = new DataAccessBase <Language, int>(uow).GetByIds(languagesIds);

                var countriesIds = studentsDetails
                                   .Where(x => x.PrimaryPersonNationality != null)
                                   .Select(x => x.PrimaryPersonNationality.CountryRef).ToList();
                var countries = new DataAccessBase <Country, int>(uow).GetByIds(countriesIds);

                IList <int> counselorsIds = new List <int>();

                foreach (var student in studentsDetails)
                {
                    var currentStudentSchool = student.StudentSchools.FirstOrDefault(x => x.SchoolRef == Context.SchoolLocalId);
                    if (currentStudentSchool?.CounselorRef != null)
                    {
                        counselorsIds.Add(currentStudentSchool.CounselorRef.Value);
                    }
                }
                var counselors = new PersonDataAccess(uow).GetByIds(counselorsIds);

                return(StudentDetailsInfo.Create(studentsDetails, ethnicities, languages, countries, counselors, Context.SchoolLocalId.Value));
            }
        }
Ejemplo n.º 4
0
        public StudentDetailsInfo GetStudentDetailsInfo(int studentId, int syId)
        {
            var sy = ServiceLocator.SchoolYearService.GetSchoolYearById(syId);

            using (var uow = Read())
            {
                var       studentDetails = new StudentDataAccess(uow).GetDetailsById(studentId, syId);
                Ethnicity ethnicity      = null;
                Country   country        = null;
                Language  language       = null;
                Person    counselor      = null;

                if (studentDetails.PrimaryPersonEthnicity != null)
                {
                    ethnicity = new DataAccessBase <Ethnicity, int>(uow).GetById(studentDetails.PrimaryPersonEthnicity.EthnicityRef);
                }

                if (studentDetails.PrimaryPersonLanguage != null)
                {
                    language = new DataAccessBase <Language, int>(uow).GetById(studentDetails.PrimaryPersonLanguage.LanguageRef);
                }

                if (studentDetails.PrimaryPersonNationality != null)
                {
                    country = new DataAccessBase <Country, int>(uow).GetById(studentDetails.PrimaryPersonNationality.CountryRef);
                }

                var studentSchool = studentDetails.StudentSchools.FirstOrDefault(x => x.SchoolRef == sy.SchoolRef);
                if (studentSchool?.CounselorRef != null)
                {
                    counselor = new PersonDataAccess(uow).GetById(studentSchool.CounselorRef.Value);
                }

                return(StudentDetailsInfo.Create(studentDetails, ethnicity, language, country, counselor, studentSchool));
            }
        }
Ejemplo n.º 5
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);
        }