コード例 #1
0
        private void bAdd_Click(object sender, EventArgs e)
        {
            var studyGroupIndex   = cbStudyGroup.SelectedIndex;
            var subjectIndex      = cbSubject.SelectedIndex;
            var studyGroupSubject = new StudyGroupSubjectModel()
            {
                SubjectID    = _subjects[subjectIndex].Id.Value,
                StudyGroupID = _studyGroups[studyGroupIndex].Id
            };
            var subjectExist = DbService.StudyGroupSubject(studyGroupSubject.StudyGroupID, studyGroupSubject.SubjectID);

            if (subjectExist.Count == 0)
            {
                EventGenerator.GenerateEventsAfterPairing(studyGroupSubject);
                DbService.StudyGroupSubjectInsert(studyGroupSubject);
            }
            CheckSubjects();
            this.Close();
        }