private ShortStudentAttendanceViewData(Student student, IList <string> alerts, IList <AttendanceStatByClassViewData> statByClassView) { StudentInfo = StudentViewData.Create(student); Alerts = alerts; StatByClass = statByClassView; TotalAttendanceCount = statByClassView.Sum(x => x.AttendanceCount); }
public static StudentClassAttendanceOldViewData Create(ClassAttendanceDetails attendance, StudentClassAttendance studentAttendance, AttendanceReason reason) { var res = new StudentClassAttendanceOldViewData { PersonId = studentAttendance.StudentId, ClassId = attendance.Class.Id, ClassName = attendance.Class.Name, Date = studentAttendance.Date, AttendanceReasonId = studentAttendance.AttendanceReasonId, Student = StudentViewData.Create(studentAttendance.Student), Level = studentAttendance.Level, IsPosted = attendance.IsPosted, AbsentPreviousDay = studentAttendance.AbsentPreviousDay, ReadOnly = studentAttendance.ReadOnly, ReadOnlyReason = studentAttendance.ReadOnlyReason, FullClassReadOnly = attendance.ReadOnly, FullClassReadOnlyReason = attendance.ReadOnlyReason, IsDailyAttendancePeriod = attendance.IsDailyAttendancePeriod }; if (reason != null) { res.AttendanceReason = AttendanceReasonViewData.Create(reason); } return(res); }
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); }
public static StudentAnnouncementViewData Create(StudentAnnouncementDetails studentAnnouncement, IList <AnnouncementAttachmentInfo> attachments) { return(new StudentAnnouncementViewData(studentAnnouncement) { StudentInfo = StudentViewData.Create(studentAnnouncement.Student), Attachments = attachments.Select(x => AnnouncementAttachmentViewData.Create(x, true)).ToList(), }); }
public static GradeStudentViewData Create(Student person, bool?isWithDrawn) { var res = new GradeStudentViewData { StudentInfo = StudentViewData.Create(person), IsWithDrawn = isWithDrawn }; res.StudentInfo.IsWithDrawn = isWithDrawn; return(res); }
public static SearchViewData Create(Student student) { return(new PersonSearchViewData { Description = student.FullName(), Id = student.Id.ToString(), SearchType = (int)SearchTypeEnum.Persons, ShortPersonInfo = StudentViewData.Create(student) }); }
public static StudentDateAttendanceViewData Create(StudentDateAttendance attendance, IList <AttendanceReason> reasons) { return(new StudentDateAttendanceViewData { Date = attendance.Date, Student = StudentViewData.Create(attendance.Student), DailyAttendance = StudentDailyAttendanceViewData.Create(attendance.DailyAttendance, reasons), PeriodAttendances = StudentPeriodAttendanceViewData.Create(attendance.StudentPeriodAttendances, reasons), CheckInCheckOuts = CheckInCheckOutViewData.Create(attendance.CheckInCheckOuts) }); }
protected DisciplineView(ClassDisciplineDetails discipline, int currentPersonId, bool canEdit) { Id = discipline.Id; StudentId = discipline.StudentId; Student = StudentViewData.Create(discipline.Student); DisciplineTypes = DisciplineTypeViewData.Create(discipline.Infractions.ToList()); ClassName = discipline.Class.Name; TeacherId = discipline.Class.PrimaryTeacherRef; Editable = canEdit || currentPersonId == TeacherId; Description = discipline.Description; ClassId = discipline.ClassId; }
protected StudentClassAttendanceViewData(StudentClassAttendance studentAttendance) { StudentId = studentAttendance.StudentId; ClassId = studentAttendance.ClassId; AbsentPreviousDay = studentAttendance.AbsentPreviousDay; AttendanceReasonId = studentAttendance.AttendanceReasonId; Student = StudentViewData.Create(studentAttendance.Student); ReadOnly = studentAttendance.ReadOnly; ReadOnlyReason = studentAttendance.ReadOnlyReason; Date = studentAttendance.Date; Level = studentAttendance.Level; }
public static AttendanceSeatingChartViewData Create(SeatingChartInfo seatingChart , IList <StudentClassAttendanceOldViewData> classAttendance, IList <Student> students) { var res = new AttendanceSeatingChartViewData { Columns = seatingChart.Columns, Rows = seatingChart.Rows, SeatingList = new List <IList <AttendanceSeatingChartItemViewData> >(), NotSeatingStudents = new List <StudentClassAttendanceOldViewData>(), IsScheduled = classAttendance.Count > 0, IsDailyAttendancePeriod = classAttendance.Count > 0 && classAttendance.First().IsDailyAttendancePeriod }; var notSeatingStudents = students.Where(x => seatingChart.SeatingList.All(y => y.All(z => x.Id != z.StudentId))).OrderBy(x => x.LastName).ThenBy(x => x.FirstName).ToList(); foreach (var notSeatingStudent in notSeatingStudents) { var classAtt = classAttendance.FirstOrDefault(x => x.Student.Id == notSeatingStudent.Id) ?? new StudentClassAttendanceOldViewData { Student = StudentViewData.Create(notSeatingStudent) }; res.NotSeatingStudents.Add(classAtt); } classAttendance.Where(x => seatingChart.SeatingList.All(y => y.All(z => x.Student.Id != z.StudentId))).ToList(); foreach (var seats in seatingChart.SeatingList) { var seatingItems = new List <AttendanceSeatingChartItemViewData>(); foreach (var seat in seats) { StudentClassAttendanceOldViewData classAtt = null; var student = students.FirstOrDefault(x => x.Id == seat.StudentId); if (student != null) { classAtt = classAttendance.FirstOrDefault(x => x.Student.Id == student.Id) ?? new StudentClassAttendanceOldViewData { Student = StudentViewData.Create(student) } } ; seatingItems.Add(AttendanceSeatingChartItemViewData.Create(seat, classAtt)); } res.SeatingList.Add(seatingItems); } return(res); } }
protected AnnouncementViewData PrepareAnnouncmentViewData(AnnouncementDetails ann, IList <AnnouncementAttachmentInfo> attachments, IList <AttachmentInfo> attrAttachmentInfo) { Trace.Assert(Context.PersonId.HasValue); if (ann.ClassAnnouncementData?.SisActivityId != null) { ann.StudentAnnouncements = SchoolLocator.StudentAnnouncementService.GetStudentAnnouncements(ann.Id); ann.GradingStudentsCount = ann.StudentAnnouncements.Count(x => x.IsGraded); } var annViewData = AnnouncementDetailedViewData.Create(ann, Context.PersonId.Value, attachments, attrAttachmentInfo, Context.Claims); if (ann.StudentAnnouncements?.Count > 0) { var nonStudentsAtts = ann.AnnouncementAttachments.Where(x => ann.StudentAnnouncements.All(st => x.Attachment.PersonRef != st.StudentId)).Select(x => x.Id).ToList(); annViewData.AnnouncementAttachments = annViewData.AnnouncementAttachments.Where(x => nonStudentsAtts.Contains(x.Id)).ToList(); } annViewData.Applications = ApplicationLogic.PrepareAnnouncementApplicationInfo(SchoolLocator, MasterLocator, ann.Id); annViewData.ApplicationsCount = annViewData.Applications.Count; annViewData.AssessmentApplicationId = MasterLocator.ApplicationService.GetAssessmentId(); if (annViewData.Applications.Count > 0) { annViewData.ApplicationName = annViewData.Applications.Count == 1 ? annViewData.Applications.First().Name : annViewData.Applications.Count.ToString(); annViewData.IsAssessmentAttached = annViewData.Applications.Any(a => a.Id == annViewData.AssessmentApplicationId); } if (ann.AnnouncementGroups != null) { annViewData.Recipients = AdminAnnouncementGroupViewData.Create(ann.AnnouncementGroups); } if (ann.AdminAnnouncementStudents != null) { annViewData.AdminAnnouncementStudents = StudentViewData.Create(ann.AdminAnnouncementStudents.Select(x => x.Student).ToList()); } return(annViewData); }