Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
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 = "";
            }
        }
Ejemplo n.º 5
0
        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;
                }
            }
        }