private List <ScoreBranch> GetClassScore(IdentUnit Klasa, List <IdentUnit> lstPrzedmiot) { List <ScoreBranch> ClassScore = new List <ScoreBranch>(); List <SchoolStudent> lstFilteredStudent = new List <SchoolStudent>(); switch (cbSeek.SelectedIndex) { case 0: lstFilteredStudent = lstStudent.Where(x => x.StudentClass.ID == Klasa.ID).Where(x => x.ActivationStatus == true).ToList(); break; case 1: lstFilteredStudent = lstStudent.Where(x => x.StudentClass.ID == Klasa.ID).Where(x => x.ActivationStatus == true).Where(x => x.Student.Name.StartsWith(txtSeek.Text, StringComparison.CurrentCultureIgnoreCase)).ToList(); break; } pbrStudent.Maximum = lstFilteredStudent.Count; pbrStudent.Value = 0; lblStudent.Text = ""; foreach (var FS in lstFilteredStudent.OrderBy(x => x.Student.Name)) { var StudentNode = new ScoreBranch(); StudentNode.Level = 1; StudentNode.Label = FS.Student.Name; StudentNode.Children = GetStudentScore(Klasa, FS.Student.ID, lstPrzedmiot); StudentNode.Children.ForEach(x => StudentNode.Score.AddRange(x.Score)); pbrStudent.Value++; lblStudent.Text = pbrStudent.Value.ToString() + "/" + pbrStudent.Maximum; Refresh(); ClassScore.Add(StudentNode); } return(ClassScore); }
private List <ScoreBranch> GetStudentScore(IdentUnit Klasa, int StudentID, List <IdentUnit> lstPrzedmiot) { List <ScoreBranch> StudentScore = new List <ScoreBranch>(); foreach (var P in lstPrzedmiot) { var SubjectScore = new ScoreBranch(); SubjectScore.Label = P.Name; SubjectScore.Level = 2; SubjectScore.Score = lstWynik.Where(x => x.StudentID == StudentID).Where(x => x.ScoreSubject.SubjectInfo.Subject.SubjectID == P.ID).Select(x => x).ToList(); StudentScore.Add(SubjectScore); } return(StudentScore); }
private List <AbsenceBranch> GetStudentAbsence(IdentUnit Klasa, IdentUnit Student, List <SchoolStudent> StudentAllocation, List <ClassSubject> lstPrzedmiot) { List <AbsenceBranch> StudentAbsence = new List <AbsenceBranch>(); var lstAbsenceByStudent = lstAbsencja.Where(A => A.AbsenceDate <= CurrentDate).Where(x => x.StudentID == Student.ID).ToList(); List <int> ClassID = new List <int>(); StudentAllocation.Select(x => new { x.StudentClass.ID }).Distinct().ToList().ForEach(x => ClassID.Add(x.ID)); var lstLessonByClass = lstLekcja.Where(x => ClassID.Contains(x.Subject.ClassID)).Where(L => L.LessonDate <= CurrentDate).ToList(); foreach (var P in lstPrzedmiot) { var lstSubjectGroup = lstGrupa.Where(sbj => sbj.SubjectID == P.SubjectID).ToList(); var lstLesson = lstLessonByClass.Where(x => x.Subject.SubjectID == P.SubjectID).ToList(); var SubjectNode = GetStudentAbsenceBySubject(P, StudentAllocation, lstLesson, lstAbsenceByStudent, lstSubjectGroup); StudentAbsence.Add(SubjectNode); } return(StudentAbsence); }
private List <AbsenceBranch> GetClassAbsence(IdentUnit Klasa, List <ClassSubject> lstPrzedmiot) { List <AbsenceBranch> ClassAbsence = new List <AbsenceBranch>(); List <SchoolStudent> lstFilteredStudent = new List <SchoolStudent>(); switch (cbSeek.SelectedIndex) { case 0: lstFilteredStudent = lstStudent.Where(x => x.StudentClass.ID == Klasa.ID).Where(x => x.ActivationStatus == true).ToList(); break; case 1: lstFilteredStudent = lstStudent.Where(x => x.StudentClass.ID == Klasa.ID).Where(x => x.ActivationStatus == true).Where(x => x.Student.Name.StartsWith(txtSeek.Text, StringComparison.CurrentCultureIgnoreCase)).ToList(); break; } pbrStudent.Maximum = lstFilteredStudent.Count; pbrStudent.Value = 0; lblStudent.Text = ""; foreach (var S in lstFilteredStudent) { IdentUnit Student = new IdentUnit { ID = S.Student.ID, Name = S.Student.Name }; var lstStudentByAllocation = lstStudent.Where(x => x.Student.ID == Student.ID).ToList(); var StudentNode = new AbsenceBranch(); StudentNode.Level = 1; StudentNode.Children = GetStudentAbsence(Klasa, Student, lstStudentByAllocation, lstPrzedmiot); ComputeAbsence(StudentNode, S.Student.Name); pbrStudent.Value++; lblStudent.Text = pbrStudent.Value.ToString() + "/" + pbrStudent.Maximum; Refresh(); ClassAbsence.Add(StudentNode); } return(ClassAbsence); }