Пример #1
0
        public bool AddSubject(Subject subject)
        {
            bool success = subjectDA.AddSubject(subject);

            if (!success)
            {
                return(false);
            }
            List <Class> classes = new List <Class>();

            (new ClassDA()).GetAllClass(classes);
            int        teachingID = 1000;
            TeachingDA teachingDA = new TeachingDA();

            teachingDA.GetLastTeachingID(ref teachingID);
            foreach (Class @class in classes)
            {
                for (int sem = 1; sem < 3; sem++)
                {
                    Teaching teaching = new Teaching();
                    teaching.ID        = (teachingID + 1).ToString();
                    teaching.ClassID   = @class.ID;
                    teaching.Semester  = sem;
                    teaching.TeacherID = null;
                    teaching.SubjectID = subject.ID;
                    teaching.Year      = DateTime.Now.Year;
                    teaching.Editable  = true;
                    success            = teachingDA.AddTeaching(teaching);
                    teachingID++;
                }
            }
            (new ScoreDA()).AddSubjectScoreForSubject(subject.ID);
            return(success);
        }
Пример #2
0
 public void AddSubject(Subject subject)
 {
     subjectDA.AddSubject(subject);
 }