/// <summary>
        /// Adds the specific newsletter to campaign. If the newsletter does not exists it is created.
        /// </summary>
        /// <param name="campaign">Campaign where the newsletter is added.</param>
        /// <param name="issueGuid">Guid of the newsletter issue.</param>
        public static void AddNewsletterAsset(CampaignInfo campaign, Guid issueGuid)
        {
            var issue = ProviderHelper.GetInfoByGuid(PredefinedObjectType.NEWSLETTERISSUE, issueGuid, campaign.CampaignSiteID);

            if (issue == null)
            {
                return;
            }

            var newsletter = ProviderHelper.GetInfoById(PredefinedObjectType.NEWSLETTER, issue.GetValue("IssueNewsletterID").ToInteger(0));

            if (newsletter == null)
            {
                return;
            }

            var source = newsletter.GetValue("NewsletterDisplayName").ToString().Replace(' ', '_').ToLowerInvariant();

            issue.SetValue("IssueUseUTM", true);
            issue.SetValue("IssueUTMCampaign", campaign.CampaignUTMCode);
            issue.SetValue("IssueUTMSource", source);
            issue.Update();

            CreateNewsletterAsset(campaign.CampaignID, issueGuid);
        }
Exemple #2
0
        public static void AddNewsletterAsset(CampaignInfo campaign, Guid issueGuid)
        {
            var infoByGuid = ProviderHelper.GetInfoByGuid("newsletter.issue", issueGuid, campaign.CampaignSiteID);

            if (infoByGuid == null)
            {
                return;
            }

            var infoById = ProviderHelper.GetInfoById("newsletter.newsletter",
                                                      infoByGuid.GetValue("IssueNewsletterID").ToInteger(0));

            if (infoById == null)
            {
                return;
            }

            var lowerInvariant = infoById.GetValue("NewsletterDisplayName").ToString().Replace(' ', '_')
                                 .ToLowerInvariant();

            infoByGuid.SetValue("IssueUseUTM", true);
            infoByGuid.SetValue("IssueUTMCampaign", campaign.CampaignUTMCode);
            infoByGuid.SetValue("IssueUTMSource", lowerInvariant);
            infoByGuid.Update();
            CreateNewsletterAsset(campaign.CampaignID, issueGuid);
        }
        /// <summary>
        /// Generates campaign.
        /// </summary>
        /// <param name="campaignData">Campaign data for generating.</param>
        private void GenerateCampaign(CampaignData campaignData)
        {
            var siteName = mSite.SiteName;
            var campaign = CampaignInfoProvider.GetCampaignInfo(campaignData.CampaignName, siteName);

            if (campaign != null)
            {
                return;
            }

            campaign = new CampaignInfo
            {
                CampaignName         = campaignData.CampaignName,
                CampaignDisplayName  = campaignData.CampaignDisplayName,
                CampaignDescription  = campaignData.CampaignDescription,
                CampaignOpenFrom     = campaignData.CampaignOpenFrom,
                CampaignCalculatedTo = campaignData.CampaignOpenFrom,
                CampaignOpenTo       = campaignData.CampaignOpenTo,
                CampaignSiteID       = mSite.SiteID,
                CampaignUTMCode      = campaignData.CampaignUTMCode
            };

            CampaignInfoProvider.SetCampaignInfo(campaign);

            /* Add email to campaign promotion section  */
            CampaignDataGeneratorHelpers.AddNewsletterAsset(campaign, campaignData.CampaignEmailPromotion);
            var issue = ProviderHelper.GetInfoByGuid(PredefinedObjectType.NEWSLETTERISSUE, campaignData.CampaignEmailPromotion, campaign.CampaignSiteID);

            if (issue != null)
            {
                issue.SetValue("IssueStatus", 5);
                issue.SetValue("IssueMailoutTime", campaignData.CampaignOpenFrom);

                issue.Update();
            }

            /* Add page assets to campaign content inventory section */
            foreach (var assetUrlGuid in campaignData.CampaignContentInventory)
            {
                CampaignDataGeneratorHelpers.AddPageAsset(campaign.CampaignID, assetUrlGuid);
            }

            /* Add conversions to campaign report setup section */
            foreach (var conversion in campaignData.CampaignReportSetup)
            {
                CampaignDataGeneratorHelpers.CreateConversion(campaign.CampaignID, conversion);
            }
        }
Exemple #4
0
        private void GenerateCampaign(CampaignData campaignData)
        {
            var siteName = _mSite.SiteName;

            if (CampaignInfoProvider.GetCampaignInfo(campaignData.CampaignName, siteName) != null)
            {
                return;
            }

            var campaignInfo = new CampaignInfo
            {
                CampaignName         = campaignData.CampaignName,
                CampaignDisplayName  = campaignData.CampaignDisplayName,
                CampaignDescription  = campaignData.CampaignDescription,
                CampaignOpenFrom     = campaignData.CampaignOpenFrom,
                CampaignCalculatedTo = campaignData.CampaignOpenFrom,
                CampaignOpenTo       = campaignData.CampaignOpenTo,
                CampaignSiteID       = _mSite.SiteID,
                CampaignUTMCode      = campaignData.CampaignUtmCode
            };

            CampaignInfoProvider.SetCampaignInfo(campaignInfo);
            CampaignDataGeneratorHelpers.AddNewsletterAsset(campaignInfo, campaignData.CampaignEmailPromotion);
            var infoByGuid = ProviderHelper.GetInfoByGuid("newsletter.issue", campaignData.CampaignEmailPromotion,
                                                          campaignInfo.CampaignSiteID);

            if (infoByGuid != null)
            {
                infoByGuid.SetValue("IssueStatus", 5);
                infoByGuid.SetValue("IssueMailoutTime", campaignData.CampaignOpenFrom);
                infoByGuid.Update();
            }

            foreach (var pagePath in campaignData.CampaignContentInventory)
            {
                CampaignDataGeneratorHelpers.AddPageAsset(campaignInfo.CampaignID, pagePath);
            }

            foreach (var conversionData in campaignData.CampaignReportSetup)
            {
                CampaignDataGeneratorHelpers.CreateConversion(campaignInfo.CampaignID, conversionData);
            }
        }