/// <summary> /// Executes the command /// </summary> /// <param name="cmdParams"></param> public void Execute(StartNextJobSearchMilestoneCommandParams cmdParams) { // Retrieve the specified job search var search = _serviceFactory.GetService <JobSearchByIdQuery>().WithJobSearchId(cmdParams.JobSearchId).Execute(); if (search == null) { throw new MJLEntityNotFoundException(typeof(JobSearch), cmdParams.JobSearchId); } // If the job search has no current milestone, do nothing if (search.CurrentMilestoneId == null) { return; } // Determine if the current milestone has been completed var progress = new JobSearchMilestoneProgress(search); if (progress.TotalProgress == 1) { search.CurrentMilestone = search.CurrentMilestone.NextMilestone; if (search.CurrentMilestone == null) { search.MilestonesCompleted = true; } _serviceFactory.GetService <IUnitOfWork>().Commit(); } }
/// <summary> /// Executes the command /// </summary> /// <param name="cmdParams"></param> public void Execute(StartNextJobSearchMilestoneCommandParams cmdParams) { // Retrieve the specified job search var search = _serviceFactory.GetService<JobSearchByIdQuery>().WithJobSearchId(cmdParams.JobSearchId).Execute(); if (search == null) throw new MJLEntityNotFoundException(typeof(JobSearch), cmdParams.JobSearchId); // If the job search has no current milestone, do nothing if (search.CurrentMilestoneId == null) return; // Determine if the current milestone has been completed var progress = new JobSearchMilestoneProgress(search); if (progress.TotalProgress == 1) { search.CurrentMilestone = search.CurrentMilestone.NextMilestone; if (search.CurrentMilestone == null) search.MilestonesCompleted = true; _serviceFactory.GetService<IUnitOfWork>().Commit(); } }