Пример #1
0
        public static IList <StudentFinalGradeViewData> Create(FinalGradeInfo finalGrade, ChalkableAverage average, IList <ClaimInfo> claims)
        {
            var res       = new List <StudentFinalGradeViewData>();
            var gradeBook = finalGrade.GradeBook;

            foreach (var student in gradeBook.Students)
            {
                var studentFinalGrade = new StudentFinalGradeViewData {
                    Student = StudentViewData.Create(student)
                };
                if (average != null)
                {
                    var stAvg = gradeBook.Averages.FirstOrDefault(x => x.AverageId == average.AverageId && x.StudentId == student.Id);
                    if (stAvg != null)
                    {
                        studentFinalGrade.CurrentStudentAverage = StudentAveragesViewData.Create(stAvg);
                    }
                }
                studentFinalGrade.StudentAverages = StudentAveragesViewData.Create(gradeBook.Averages.Where(x => x.StudentId == student.Id).ToList());
                IList <StudentAnnouncementDetails> stAnns = gradeBook.Announcements
                                                            .Where(a => a.StudentAnnouncements.Any(stAnn => stAnn.StudentId == student.Id))
                                                            .Select(a => a.StudentAnnouncements.First(stAnn => stAnn.StudentId == student.Id)).ToList();
                studentFinalGrade.StatsByType = StudentGradingByTypeStatsViewData.Create(gradeBook.Announcements.Select(x => x.ClassAnnouncementData).ToList(), stAnns, claims);
                var currentStAttendance = finalGrade.Attendances.FirstOrDefault(x => x.StudentId == student.Id);
                studentFinalGrade.Attendance = FinalStudentAttendanceViewData.Create(currentStAttendance, finalGrade.Attendances);
                var disciplines = finalGrade.Disciplines.Where(x => x.StudentId == student.Id).ToList();
                studentFinalGrade.Disciplines = disciplines.Select(x => new DisciplineTypeSummaryViewData
                {
                    Total = x.Occurrences,
                    Type  = DisciplineTypeViewData.Create(x.Infraction)
                }).ToList();
                res.Add(studentFinalGrade);
            }
            return(res);
        }
Пример #2
0
        public ActionResult List(int?start, int?count)
        {
            var res = SchoolLocator.InfractionService.GetInfractions(true, true).OrderBy(x => x.Name).ToList();

            return(Json(DisciplineTypeViewData.Create(res), 3));
        }