Ejemplo n.º 1
0
        public IList <InfractionSummaryInfo> GetStudentInfractionSummary(int studentId, int?gradingPeriodId)
        {
            var syId = ServiceLocator.SchoolYearService.GetCurrentSchoolYear().Id;
            var stiDisciplineSummary = ConnectorLocator.StudentConnector.GetStudentDisciplineSummary(studentId, syId, gradingPeriodId);
            var infractions          = ServiceLocator.InfractionService.GetInfractions(true);

            return(InfractionSummaryInfo.Create(stiDisciplineSummary.Infractions.ToList(), infractions));
        }
Ejemplo n.º 2
0
        public static StudentSummaryInfo Create(Student student, NowDashboard nowDashboard
                                                , IList <Data.School.Model.Infraction> infractions, IList <AnnouncementComplex> anns, IMapper <StudentAnnouncement, Score> mapper)
        {
            var res = new StudentSummaryInfo
            {
                StudentInfo = student,
                ClassRank   = nowDashboard.ClassRank != null?ClassRankInfo.Create(nowDashboard.ClassRank) : null,
                                  CurrentSectionId           = nowDashboard.CurrentSectionId,
                                  TotalDisciplineOccurrences = nowDashboard.Infractions.Any() ? nowDashboard.Infractions.Sum(x => x.Occurrences) : 0,
                                  InfractionSummaries        = InfractionSummaryInfo.Create(nowDashboard.Infractions.ToList(), infractions),
                                  StudentAnnouncements       = new List <StudentAnnouncement>(),
                                  Attendances            = ShortStudentClassAttendanceSummary.Create(nowDashboard.SectionAttendance.ToList()),
                                  CurrentAttendanceLevel = nowDashboard.CurrentAttendanceStatus
            };

            if (nowDashboard.DailyAttendance == null)
            {
                nowDashboard.DailyAttendance = new StudentDailyAbsenceSummary {
                    Absences = 0, Tardies = 0, Presents = 0
                }
            }
            ;
            res.DailyAttendance = DailyAbsenceSummaryInfo.Create(nowDashboard.DailyAttendance);

            var scores = nowDashboard.Scores.Where(x => !string.IsNullOrEmpty(x.ScoreValue)).ToList();

            foreach (var score in scores)
            {
                var ann = anns.FirstOrDefault(x => x.ClassAnnouncementData.SisActivityId == score.ActivityId);
                if (ann == null)
                {
                    continue;
                }
                var studentAnn = new StudentAnnouncement {
                    AnnouncementId = ann.Id
                };
                mapper.Map(studentAnn, score);
                res.StudentAnnouncements.Add(studentAnn);
            }
            return(res);
        }
    }