/// <summary> /// Hàm lấy thông tin về nhóm học sinh. /// </summary> /// <param name="classID"></param> (""/ khác "") nếu (lấy toàn bộ học sinh/ lấy những học sinh theo mã lớp /// <returns></returns> public List <Student> GetStudents(string classID, bool getKhoi = false, string _orderBy = "ClassID, Firstname, Surname") { return(studentDA.GetStudents(classID, getKhoi, _orderBy)); }
public double GetClassAverageScore(string _classID, string _subjectID = "", int _semester = 3) { double result = -1.0; if (string.IsNullOrEmpty(_subjectID)) { if (_semester == 3) { scoreDA.GetClassAverageScore(_classID, out result, _semester, _subjectID); } else { studentDA = new StudentDA(); List <Student> students = new List <Student>(); students = studentDA.GetStudents(_classID); foreach (Student student in students) { List <AverageScore> averageScores = new List <AverageScore>(); scoreDA.GetAverageScore(student.ID, Int32.Parse(student.GetGrade), averageScores); if (averageScores[_semester - 1].Value > 0) { result += averageScores[_semester - 1].Value; } else { result = -1.0; break; } } if (students.Count < 1) { return(-1.0); } result = result / students.Count; } } else { studentDA = new StudentDA(); List <Student> students = new List <Student>(); students = studentDA.GetStudents(_classID); if (_semester == 3) { foreach (Student student in students) { double score; scoreDA.GetAverageYearSubjectScore(student.ID, _subjectID, Int32.Parse(student.GetGrade), out score); result += score; } } else { foreach (Student student in students) { double score; scoreDA.GetAverageSubjectScore(student.ID, Int32.Parse(student.GetGrade), _semester, _subjectID, out score); result += score; } } if (students.Count < 1) { return(-1.0); } result = result / students.Count; } return(result); }