public Job StartCreateListJob(ListSettings settings) { _activeJob = new Job(); settings.Job = _activeJob; var options = new JobOptions("ExperienceGeneratorExmLists-" + _activeJob.Id, "ExperienceGenerator", Context.Site.Name, this, "GenerateList", new object[] { settings }); Sitecore.Jobs.JobManager.Start(options); return(_activeJob); }
public Job StartJob(ExmGeneratorSettings settings) { _activeJob = new Job(); settings.Job = _activeJob; var options = new DefaultJobOptions("ExperienceGeneratorExm-" + _activeJob.Id, "ExperienceGenerator", Context.Site.Name, this, "GenerateCampaignData", new object[] { settings }); Sitecore.Jobs.JobManager.Start(options); return(_activeJob); }
private static void ClearCounters(Job job) { job.CompletedContacts = 0; job.CompletedEmails = 0; job.CompletedEvents = 0; job.CompletedLists = 0; job.TargetContacts = 0; job.TargetEmails = 0; job.TargetEvents = 0; job.TargetLists = 0; }
private void CreateDataForCampaign(Job job, KeyValuePair <Guid, CampaignSettings> keyValuePair) { var campaignId = keyValuePair.Key; var campaign = keyValuePair.Value; var campaignItem = Context.Database.GetItem(new ID(campaignId)); job.JobName = $"Generating data for campaign {campaignItem.Name}"; try { var createDataService = new GenerateCampaignDataService(campaignId, campaign); createDataService.CreateData(job); } finally { job.JobName = ""; } }
private void CreateDataForAllCampaigns(Job job, Dictionary <Guid, CampaignSettings> settings) { foreach (var keyValuePair in settings) { if (job.JobStatus == JobStatus.Cancelling) { return; } ClearCounters(job); try { CreateDataForCampaign(job, keyValuePair); } catch (Exception ex) { Log.Error($"EXM Generator failed for campaign: {keyValuePair.Key}", ex, this); job.LastException = ex.ToString(); throw; } } }