public HonorariumTeacher(Teacher teacher, Course course, decimal honorariumPerHour)
 {
     this.Teacher = teacher;
     this.Course = course;
     this.HonorariumPerHour = honorariumPerHour;
     this.TeacherId = this.CalculateTeacherId();
     this.CourseId = this.CalculateCourseId();
 }
Esempio n. 2
0
 public void AddTeachersToCourse(Teacher teacher)
 {
     this.teachersInCourse.Add(teacher);
 }
Esempio n. 3
0
        public void ExecuteCreate(string[] commandWords)
        {
            string[] cW = commandWords;
            switch (cW[1])
            {
                case "course_participant":
                    Person courseParticipant = new CourseParticipant(cW[2], cW[3], cW[4],
                        cW[5], this.ConvertStrintIntoDateTime(cW[6]), cW[7], cW[8], cW[9], cW[10],
                        this.ConvertStrintIntoDateTime(cW[11]), ESallaryType.Monthly,
                        decimal.Parse(cW[13]));
                    this.ExecuteAdd(courseParticipant);
                    break;
                case "teacher":
                    Person teacher = new Teacher(cW[2], cW[3], cW[4],
                        cW[5], this.ConvertStrintIntoDateTime(cW[6]), cW[7], cW[8], cW[9], cW[10],
                        this.ConvertStrintIntoDateTime(cW[11]), ESallaryType.Monthly,
                        decimal.Parse(cW[13]));
                    this.ExecuteAdd(teacher);
                    break;
                case "secretary":
                    Person secretary = new Secretary(cW[2], cW[3], cW[4],
                        cW[5], this.ConvertStrintIntoDateTime(cW[6]), cW[7], cW[8], cW[9], cW[10],
                        this.ConvertStrintIntoDateTime(cW[11]), ESallaryType.Monthly,
                        decimal.Parse(cW[13]));
                    this.ExecuteAdd(secretary);
                     break;
                case "adult_language_course":
                     string courseName = CourseInputer.CourseNameCreator(cW[2]);
                     ECourseActivityStatus status = CourseInputer.CourseActivityCreator(cW[3]);
                     EGroupType groupType = CourseInputer.GroupTypeCreator(cW[4]);
                     ECoursePlace coursePlace = cW[5] == "local" ? ECoursePlace.Local : ECoursePlace.Online;
                     decimal coursePrice = decimal.Parse(cW[6]);
                     IList<IPerson> coursists = CourseInputer.GetCoursistsInCourse(cW[7]);
                     IList<IPerson> teachers = CourseInputer.GetTeachersInCourse(cW[8]);
                     IList<IClassInfo> conductedClasses = new List<IClassInfo>();
                     EAge age = EAge.Adults;
                     ELanguage language = CourseInputer.GetLanguage(cW[11]);
                     ELanguageLevelForAdults level = CourseInputer.LanguageLevelAdults("a1");
                     LanguageCourseForAdults languageCourseAdults = new LanguageCourseForAdults(courseName, status, groupType,
                         coursePlace, coursePrice, coursists, teachers, conductedClasses, age, language, level);
                     Course.Add(languageCourseAdults);
                     break;
                case "class":
                     ICourse courseToAddToClass = null;

                     ulong courseId = ulong.Parse(cW[5].Split('_')[1]);
                     foreach (var currentCourse in Course.CourseList)
                     {
                         if (currentCourse.Id == courseId)
                         {
                             courseToAddToClass = currentCourse;
                         }
                     }

                     ITeacher teacherToAddToClass = null;

                    ulong teacherId = ulong.Parse(cW[6].Split('_')[1]);
                     foreach (var currentTeacher in Person.GetAllTeachers())
                     {
                         if (currentTeacher.Id == teacherId)
                         {
                             teacherToAddToClass = (ITeacher)currentTeacher;
                         }
                     }

                     string[] conductionDateString = cW[2].Split('_')[1].Split('.');
                     int conductionDateYear = int.Parse(conductionDateString[2]);
                     int conductionDateMonth = int.Parse(conductionDateString[1]);
                     int conductionDateDay = int.Parse(conductionDateString[0]);
                     DateTime conductionDate = new DateTime(conductionDateYear, conductionDateMonth, conductionDateDay);

                    string[] startHourStringArray = cW[3].Split('_')[2].Split(':');
                    int startHourHour = int.Parse(startHourStringArray[0]);
                    int startHourMinutes = int.Parse(startHourStringArray[1]);
                    DateTime startHour = new DateTime(conductionDateYear, conductionDateMonth, conductionDateDay, startHourHour, startHourMinutes, 0);

                    string[] endHourStringArray = cW[4].Split('_')[2].Split(':');
                    int endHourHour = int.Parse(endHourStringArray[0]);
                    int endHourMinutes = int.Parse(endHourStringArray[1]);
                    DateTime endHour = new DateTime(conductionDateYear, conductionDateMonth, conductionDateDay, endHourHour, endHourMinutes, 0);

                    ClassInfo currentClass = new ClassInfo(conductionDate, startHour, endHour, teacherToAddToClass, courseToAddToClass);

                    bool presentTeacher = false;

                    foreach (var teacherInCourse in courseToAddToClass.TeachersInCourse)
                    {
                        if(teacherInCourse.Id == teacherToAddToClass.Id)
                        {
                            presentTeacher = true;
                            break;
                        }
                    }

                    if (presentTeacher == true)
                    {
                        courseToAddToClass.AddConductedClass(currentClass);
                    }
                    else
                    {
                        throw new ArgumentException(String.Format("There's no teacher with ID {0} who conducts classes in the course with ID {1}",
                            teacherToAddToClass.Id, courseToAddToClass.Id));
                    }
                     break;
                default:
                    break;
            }
        }