public LanguageCourseForAdults(string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace, decimal price, IList <IPerson> studentsInCourse, IList <IPerson> teachersInCourse, IList <IClassInfo> conductedClasses, EAge age, ELanguage language, ELanguageLevelForAdults languageLevelForAdults) : base(courseName, activityStatus, groupType, coursePlace, price, studentsInCourse, teachersInCourse, conductedClasses, age) { this.Language = language; this.LanguageLevel = languageLevelForAdults; }
public LanguageCourseForAdults(string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace, decimal price, IList<IPerson> studentsInCourse, IList<IPerson> teachersInCourse, IList<IClassInfo> conductedClasses, EAge age, ELanguage language, ELanguageLevelForAdults languageLevelForAdults) : base(courseName, activityStatus, groupType, coursePlace, price, studentsInCourse, teachersInCourse, conductedClasses, age) { this.Language = language; this.LanguageLevel = languageLevelForAdults; }
public static string RenderCourseToConsole(string courseType, ulong id, string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace, decimal price, IList <IPerson> studentsInCourse, IList <IPerson> teachersInCourse, EAge age, ECoursePlace place, ELanguage language, ELanguageLevelForAdults languageLevelForAdults) { StringBuilder sb = new StringBuilder(); sb.AppendLine(new string('*', 30)); sb.AppendLine(new string('*', 30)); sb.AppendFormat("{0}", courseType).AppendLine(); sb.AppendFormat("{0}", id).AppendLine(); sb.AppendFormat("{0}", courseName).AppendLine(); sb.AppendFormat("{0}", activityStatus).AppendLine(); sb.AppendFormat("{0}", groupType).AppendLine(); sb.AppendFormat("{0}", coursePlace).AppendLine(); sb.AppendFormat("{0}", age).AppendLine(); sb.AppendFormat("{0}", language).AppendLine(); sb.AppendFormat("{0}", languageLevelForAdults).AppendLine(); sb.AppendFormat("{0} lev(s)", price).AppendLine().AppendLine(); sb.AppendLine(new string('-', 30)); sb.AppendLine("Teachers leading the course: ").AppendLine(); foreach (var teacher in teachersInCourse) { sb.AppendFormat("{0}", teacher.ToString()).AppendLine().AppendLine(); } sb.AppendLine(new string('-', 30)); sb.AppendLine().AppendLine(); sb.AppendLine(new string('-', 30)); sb.AppendLine("Students taking part in the course: ").AppendLine(); foreach (var student in studentsInCourse) { sb.AppendFormat("{0}", student.ToString()).AppendLine().AppendLine(); } sb.AppendLine(new string('-', 30)); sb.AppendLine().AppendLine(); sb.AppendLine(new string('*', 30)); sb.AppendLine(new string('*', 30)); return(sb.ToString()); }
public static string RenderCourseToConsole(string courseType, ulong id, string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace, decimal price, IList<IPerson> studentsInCourse, IList<IPerson> teachersInCourse, EAge age, ECoursePlace place, ELanguage language, ELanguageLevelForAdults languageLevelForAdults) { StringBuilder sb = new StringBuilder(); sb.AppendLine(new string('*', 30)); sb.AppendLine(new string('*', 30)); sb.AppendFormat("{0}", courseType).AppendLine(); sb.AppendFormat("{0}", id).AppendLine(); sb.AppendFormat("{0}", courseName).AppendLine(); sb.AppendFormat("{0}", activityStatus).AppendLine(); sb.AppendFormat("{0}", groupType).AppendLine(); sb.AppendFormat("{0}", coursePlace).AppendLine(); sb.AppendFormat("{0}", age).AppendLine(); sb.AppendFormat("{0}", language).AppendLine(); sb.AppendFormat("{0}", languageLevelForAdults).AppendLine(); sb.AppendFormat("{0} lev(s)", price).AppendLine().AppendLine(); sb.AppendLine(new string('-', 30)); sb.AppendLine("Teachers leading the course: ").AppendLine(); foreach (var teacher in teachersInCourse) { sb.AppendFormat("{0}", teacher.ToString()).AppendLine().AppendLine(); } sb.AppendLine(new string('-', 30)); sb.AppendLine().AppendLine(); sb.AppendLine(new string('-', 30)); sb.AppendLine("Students taking part in the course: ").AppendLine(); foreach (var student in studentsInCourse) { sb.AppendFormat("{0}", student.ToString()).AppendLine().AppendLine(); } sb.AppendLine(new string('-', 30)); sb.AppendLine().AppendLine(); sb.AppendLine(new string('*', 30)); sb.AppendLine(new string('*', 30)); return sb.ToString(); }
public static ELanguageLevelForAdults LanguageLevelAdults(string level) { ELanguageLevelForAdults output = new ELanguageLevelForAdults(); var lev = new ELanguageLevelForAdults().GetType().GetEnumValues(); foreach (var l in lev) { string levelToString = l.ToString(); string levelToLower = levelToString.ToLower(); if (levelToLower == level) { output = (ELanguageLevelForAdults)l; break; } } return(output); }
public static ELanguageLevelForAdults LanguageLevelAdults(string level) { ELanguageLevelForAdults output = new ELanguageLevelForAdults(); var lev = new ELanguageLevelForAdults().GetType().GetEnumValues(); foreach (var l in lev) { string levelToString = l.ToString(); string levelToLower = levelToString.ToLower(); if (levelToLower == level) { output = (ELanguageLevelForAdults)l; break; } } return output; }
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; } }