public EducationPlan GenerateEducationPlan(RestEducationPlan educationPlan, EducationPlan oldEducationplan)
        {
            System.Diagnostics.Debug.WriteLine("parameters " + new JavaScriptSerializer().Serialize(educationPlan) + ", old: " + new JavaScriptSerializer().Serialize(educationPlan));
            if (educationPlan == null)
            {
                _logger.Error("ArgumentNullException: educationPlan");
                throw new ArgumentNullException("educationPlan");
            }

            _logger.Debug(string.Format(_culture, "GenerateEducationPlan for employee {0}", educationPlan.NameEmployee));

            _planner.StartDate    = educationPlan.InPaymentFrom;
            _planner.EndDate      = educationPlan.EmployableFrom;
            _planner.BlockedDates = educationPlan.BlockedDates;

            var           educationplanData = Mapper.Map <EducationPlanData>(educationPlan);
            CourseProfile profile           = null;

            if (educationPlan.ProfileId != 0)
            {
                _logger.Debug(string.Format(_culture, "ProfileId exists: {0}", educationPlan.ProfileId));
                profile = _profileDataMapper.FindById(educationPlan.ProfileId);
                educationplanData.Profile   = profile.Name;
                educationplanData.ProfileId = educationPlan.ProfileId;
            }

            var educationPlanCourses = educationPlan.Courses.Where(course => !course.Code.StartsWith("OLC"));

            _logger.Debug("Find courses from service");
            IEnumerable <Integration.Course>             courses       = _courseService.FindCourses(educationPlanCourses.Select(course => course.Code));
            List <OpleidingsplanGenerator.Models.Course> coursesToPlan = ConvertCourses(courses, profile, educationPlan.Courses);

            List <OpleidingsplanGenerator.Models.PinnedCourseImplementation> implementationConstraints = new List <OpleidingsplanGenerator.Models.PinnedCourseImplementation>();

            if (educationPlan.ImplementationConstraints != null)
            {
                implementationConstraints = ConvertImplementationConstraints(educationPlan.ImplementationConstraints);
            }

            if (oldEducationplan == null)
            {
                _planner.PlanCoursesWithOlc(coursesToPlan, implementationConstraints);
            }
            else
            {
                _planner.PlanCoursesWithOlcInOldEducationPlan(coursesToPlan, oldEducationplan, implementationConstraints);
            }

            _planner.AddModules(_moduleDataMapper.FindAll());

            OverrideRestCourse(_planner, educationPlan.Courses);

            var output = _educationPlanOutputter.GenerateEducationPlan(educationplanData);

            System.Diagnostics.Debug.WriteLine("parameters " + new JavaScriptSerializer().Serialize(output));

            return(output);
        }
Beispiel #2
0
 public Module FindModuleById(long id)
 {
     return(_moduleDataMapper.FindById(id));
 }
Beispiel #3
0
 public CourseProfile FindProfileById(long id)
 {
     return(_profileDataMapper.FindById(id));
 }