public void ConvertJobs(Period period, List <JobIndexInPeriodDTO> jobIndexInperiodListParam, List <JobIndexDTO> jobIndexListParam) { Console.WriteLine("Starting jobs convert progress..."); jobIndexInperiodList = jobIndexInperiodListParam; jobIndexList = jobIndexListParam; var jobIdList = jobDataProvider.GetJobIds(); totalJobsCount = jobIdList.Count; foreach (var jobId in jobIdList) { var sourceJobDTO = jobDataProvider.GetJobDetails(jobId); var job = jobService.GetByTransferId(sourceJobDTO.TransferId); if (job == null) { var desJobDTO = createDestinationJob(sourceJobDTO); job = jobService.AddJob(desJobDTO); } var sourceJobIndicesForAssignment = jobDataProvider.GetJobIndecesByJobId(jobId); var jobInPriodAssignment = createDestinationJobInPeriod(job, sourceJobIndicesForAssignment); jobInPeriodServiceWrapper.AddJobInPeriod(period.Id, jobInPriodAssignment); jobList.Add(job); Console.WriteLine("Jobs Convert progress state: " + jobList.Count + " From " + totalJobsCount.ToString()); } publisher.Publish(new JobConverted(jobList)); }
private void save() { if (SelectedJobInPeriod == null || !SelectedJobInPeriod.Validate()) { return; } ShowBusyIndicator(); if (actionType == ActionType.AddJobInPeriod) { jobInPeriodService.AddJobInPeriod((res, exp) => appController.BeginInvokeOnDispatcher(() => { HideBusyIndicator(); if (exp != null) { appController.HandleException(exp); } else { finalizeAction(); } }), Period.Id, SelectedJobInPeriod); } else if (actionType == ActionType.ModifyJobInPeriod) { jobInPeriodService.UpdateJobInPeriod((res, exp) => appController.BeginInvokeOnDispatcher(() => { HideBusyIndicator(); if (exp != null) { appController.HandleException(exp); } else { finalizeAction(); } }), Period.Id, SelectedJobInPeriod); } }