Пример #1
0
        public bool AddTeachingForClass(string _classID)
        {
            bool           success;
            List <Subject> subjects = new List <Subject>();

            success = subjectDA.LoadSubjects(subjects);
            if (!success)
            {
                return(false);
            }
            int teachingID = 1000;

            teachingDA.GetLastTeachingID(ref teachingID);
            foreach (Subject subject in subjects)
            {
                for (int sem = 1; sem < 3; sem++)
                {
                    Teaching teaching = new Teaching();
                    teaching.ID        = (teachingID + 1).ToString();
                    teaching.ClassID   = _classID;
                    teaching.Semester  = sem;
                    teaching.TeacherID = null;
                    teaching.SubjectID = subject.ID;
                    teaching.Year      = DateTime.Now.Year;
                    teaching.Editable  = true;
                    success            = teachingDA.AddTeaching(teaching);
                    teachingID++;
                }
            }
            return(true);
        }
Пример #2
0
        public List <Subject> LoadSubjects()
        {
            List <Subject> subjects = new List <Subject>();

            subjectDA.LoadSubjects(subjects);
            return(subjects);
        }
Пример #3
0
        /// <summary>
        /// Lấy tất cả điểm của học sinh có mã [_studentID], trả về Dictionary, mỗi List<Score> tương ứng với mã môn học
        /// </summary>
        /// <param name="_studentID"></param>
        /// <param name="_semester"></param>
        /// <param name="_grade"></param>
        /// <returns></returns>
        public Dictionary <string, List <Score> > GetAllScores(string _studentID, int _semester, int _grade)
        {
            Dictionary <string, List <Score> > result = new Dictionary <string, List <Score> >();
            List <Subject> subjects = new List <Subject>();
            bool           success  = subjectDA.LoadSubjects(subjects);

            if (!success)
            {
                return(result);
            }
            foreach (Subject subject in subjects)
            {
                List <Score> scores = new List <Score>();
                scoreDA.GetStudentScore(_studentID, subject.ID, _semester, _grade, scores);
                result.Add(subject.ID, scores);
            }
            return(result);
        }