Пример #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            this.recipientRepository = EcmFactory.GetDefaultFactory().Bl.RecipientRepository;

            NameValueCollection parameters = this.GetSublayoutParams();

            var val = parameters["Show List"];

            this.showList = (val != null) && val == "1";

            val = parameters["Recipient Lists"];
            this.rawIncludeRecipientLists = val ?? string.Empty;

            val = parameters["Exclude Lists"];
            if (!string.IsNullOrEmpty(val))
            {
                this.excludeRecipientLists = Data.ID.ParseArray(val);
            }

            val         = parameters["Manager root"];
            this.rootId = val ?? string.Empty;

            if (this.SubscriptionInfos != null && this.showList)
            {
                foreach (var info in this.SubscriptionInfos)
                {
                    this.AddSrcComboBox(info);
                }
            }
        }
        private static void SetStatisticsOnCampaignItem(MessageItem messageItem, DateTime dateMessageSent, DateTime dateMessageFinished)
        {
            var itemUtil     = new ItemUtilExt();
            var campaignItem = itemUtil.GetItem(messageItem.CampaignId);

            using (new EditContext(campaignItem))
            {
                campaignItem["StartDate"] = DateUtil.ToIsoDate(dateMessageSent);
                campaignItem[CampaignclassificationItem.FieldIDs.Channel] = EcmFactory.GetDefaultFactory().Io.EcmSettings.CampaignClassificationChannel;
                campaignItem["EndDate"] = DateUtil.ToIsoDate(dateMessageFinished);
            }
        }
        private void SendEmailToContact(Job job, ContactData contact, MessageItem messageItem)
        {
            var customValues = new ExmCustomValues
            {
                DispatchType    = DispatchType.Normal,
                Email           = contact.PreferredEmail,
                MessageLanguage = messageItem.TargetLanguage.ToString(),
                ManagerRootId   = messageItem.ManagerRoot.InnerItem.ID.ToGuid(),
                MessageId       = messageItem.InnerItem.ID.ToGuid()
            };

            EcmFactory.GetDefaultFactory().Bl.DispatchManager.EnrollOrUpdateContact(contact.ContactId, new DispatchQueueItem(), messageItem.PlanId.ToGuid(), Constants.SendCompletedStateName, customValues);

            GenerateEventService.GenerateSent(messageItem.ManagerRoot.Settings.BaseURL, contact.ContactId, messageItem, messageItem.StartTime);
            job.CompletedEmails++;
        }
        private static void SetStatisticsInEXMDatabase(Job job, MessageItem messageItem, DateTime dateMessageSent, DateTime dateMessageFinished)
        {
            var sleepTime = 1000;

            for (var i = 0; i < RETRY_COUNT; i++)
            {
                try
                {
                    EcmFactory.GetDefaultFactory().Gateways.EcmDataGateway.SetMessageStatisticData(messageItem.CampaignId.ToGuid(), dateMessageSent, dateMessageFinished, FieldUpdate.Set(messageItem.SubscribersIds.Value.Count), FieldUpdate.Set(messageItem.SubscribersIncludeCount.Value), FieldUpdate.Set(messageItem.SubscribersExcludeCount.Value), FieldUpdate.Set(messageItem.SubscribersGlobalOptOutCount.Value));
                    return;
                }
                catch (Exception)
                {
                    job.Status = $"Setting Statistics in the EXM database (retry {i} of {RETRY_COUNT})";
                    Thread.Sleep(sleepTime);
                    sleepTime += 1000;
                }
            }
        }
        private void SendEmailToContact(ContactData contact, MessageItem messageItem)
        {
            var customValues = new ExmCustomValues
            {
                DispatchType    = DispatchType.Normal,
                Email           = contact.PreferredEmail,
                MessageLanguage = messageItem.TargetLanguage.ToString(),
                ManagerRootId   = messageItem.ManagerRoot.InnerItem.ID.ToGuid(),
                MessageId       = messageItem.InnerItem.ID.ToGuid()
            };

            EcmFactory.GetDefaultFactory()
            .Bl.DispatchManager.EnrollOrUpdateContact(contact.ContactId, new DispatchQueueItem(),
                                                      messageItem.PlanId.ToGuid(), Sitecore.Modules.EmailCampaign.Core.Constants.SendCompletedStateName,
                                                      customValues);

            ExmEventsGenerator.GenerateSent(_managerRoot.Settings.BaseURL, new ID(contact.ContactId), messageItem.InnerItem.ID,
                                            messageItem.StartTime);
            _specification.Job.CompletedEmails++;
        }
        private void AdjustEmailStats(MessageItem messageItem, SendingProcessData sendingProcessData,
                                      DateTime dateMessageSent, DateTime dateMessageFinished)
        {
            var deployAnalytics = new DeployAnalytics();

            deployAnalytics.Process(new DispatchNewsletterArgs(messageItem, sendingProcessData));

            messageItem.Source.StartTime = dateMessageSent;
            messageItem.Source.EndTime   = dateMessageFinished;

            var innerItem = messageItem.InnerItem;

            using (new EditContext(innerItem))
            {
                innerItem.RuntimeSettings.ReadOnlyStatistics = true;
                innerItem[FieldIDs.Updated] = DateUtil.ToIsoDate(dateMessageSent);
            }

            var itemUtil     = new ItemUtilExt();
            var campaignItem = itemUtil.GetItem(messageItem.CampaignId);

            using (new EditContext(campaignItem))
            {
                campaignItem["StartDate"] = DateUtil.ToIsoDate(dateMessageSent);
                campaignItem[CampaignclassificationItem.FieldIDs.Channel] =
                    EcmFactory.GetDefaultFactory().Io.EcmSettings.CampaignClassificationChannel;
                campaignItem["EndDate"] = DateUtil.ToIsoDate(dateMessageFinished);
            }

            EcmFactory.GetDefaultFactory()
            .Gateways.EcmDataGateway.SetMessageStatisticData(messageItem.CampaignId.ToGuid(), dateMessageSent,
                                                             dateMessageFinished, FieldUpdate.Set(messageItem.SubscribersIds.Value.Count),
                                                             FieldUpdate.Set(messageItem.SubscribersIncludeCount.Value),
                                                             FieldUpdate.Set(messageItem.SubscribersExcludeCount.Value),
                                                             FieldUpdate.Set(messageItem.SubscribersGlobalOptOutCount.Value));
        }
Пример #7
0
        public MessageReportController(IEmailLandingPagesRepository emailLandingPagesRepository, IContactsStatesRepository contactsStatesRepository, IMessageStatisticsService messageStatisticsService, SortParameterFactory sortParameterFactory)
        {
            Assert.ArgumentNotNull(emailLandingPagesRepository, "emailLandingPagesRepository");
            Assert.ArgumentNotNull(contactsStatesRepository, "contactsStatesRepository");
            Assert.ArgumentNotNull(sortParameterFactory, "sortParameterFactory");
            this.emailLandingPagesRepository = emailLandingPagesRepository;
            this.contactsStatesRepository    = contactsStatesRepository;
            this.messageStatisticsService    = messageStatisticsService;
            this.sortParameterFactory        = sortParameterFactory;
            this.bestPagesMappings           = new Dictionary <string, string>();
            this.bestPagesMappings.Add("ValuePerVisit", "Most Relevant");
            this.bestPagesMappings.Add("Value", "Most Valuable");
            this.bestPagesMappings.Add("Visits", "Most Clicked");
            this.bestPagesMappings.Add("Attention", "Most Attention");
            this.bestPagesMappings.Add("Potential", "Most Potential");
            ItemUtilExt        itemUtilExt        = CoreFactory.Instance.GetItemUtilExt();
            ReportDataProvider reportDataProvider = Sitecore.Configuration.Factory.CreateObject("reporting/dataProvider", true) as ReportDataProvider;

            this.contactsStatesDataSource = new Sitecore.Support.Modules.EmailCampaign.Statistics.DataSources.ContactsStatesDataSource(EcmFactory.GetDefaultFactory(), CoreFactory.Instance, new ReportDataProviderExt(reportDataProvider, itemUtilExt), RecipientRepository.GetDefaultInstance());
        }