/// <summary> /// Method for creating course. /// </summary> /// <param name="courseType">Type of course(Corporate,Online,Offline).</param> /// <param name="platform">Type of platform(.Net,Java,Angular).</param> /// <returns>ICourse.</returns> public static ICourse CreateCourse(CourseType courseType, DeveloperPlatform platform) { AbstractCourseFactory courseFactory = null; switch (courseType) { case CourseType.Online: courseFactory = new OnlineCourseFactoryVersion2(); break; case CourseType.Offline: courseFactory = new OfflineCourseFactory(); break; case CourseType.Corporate: courseFactory = new CorporateCourseFactory(); break; default: courseFactory = null; break; } if (courseFactory != null) { return(courseFactory.CreateCourse(platform)); } else { return(null); } }
public ICourse CreateCourse(DeveloperPlatform developerPlatform) { AbstractCourse course = this.GetCourse(developerPlatform); if (course != null) { course.CreateCourseMaterial(); course.CreateSchedule(); } return(course); }
protected override AbstractCourse GetCourse(DeveloperPlatform developerPlatform) { bool isNotNull = courses.TryGetValue(developerPlatform, out AbstractCourse course); if (isNotNull) { return(course); } else { return(null); } }
private void CheckDeveloperPlatform() { int[] aveableTypes = new int[] { 1, 2, 3, 4, 5 }; int.TryParse(Console.ReadLine(), out int platformNum); if (Array.IndexOf(aveableTypes, platformNum) > -1) { developerPlatform = (DeveloperPlatform)platformNum; Console.Clear(); course = CourseCreator.CreateCourse(courseType, developerPlatform); CheckCourseForNull(course); } else { Console.Clear(); ChooseDeveloperPlatform(); } }
protected abstract AbstractCourse GetCourse(DeveloperPlatform developerPlatform);