コード例 #1
0
ファイル: College.cs プロジェクト: Andreybest/AcademIT-Lab4
        public void AddHeadman(string firstName, string lastName, int age, string phoneNumber, int group, int scholarship = Headman.MinScholarship, int knowlageLevel = (int)EKnowlageLevel.average)
        {
            int groupIndex = FindGroupIndex(group);

            if (groupIndex == -1)
            {
                throw new NonExistingGroupException();
            }

            if (FindStudentIndex(firstName, lastName) != -1)
            {
                throw new ExistingFullNameException();
            }

            if (StudentGroups[groupIndex].GroupHeadmanExists())
            {
                throw new GroupHeadmanAlreadyExistException();
            }

            Headman headman = new Headman(firstName, lastName, age, phoneNumber, group, scholarship, knowlageLevel);

            StudentGroups[groupIndex].AddStudent(headman);
            StudentGroups[groupIndex].AddHeadman(headman);
            Students.Add(headman);
        }
コード例 #2
0
 public bool AddHeadman(Headman headman)
 {
     if (!GroupHeadmanExists())
     {
         GroupHeadman = headman;
         return(true);
     }
     return(false);
 }
コード例 #3
0
 private void RemoveHeadman()
 {
     GroupHeadman = null;
 }