Example #1
0
        private static void CreateNewsletterAsset(int campaignId, Guid nodeGuid)
        {
            if (CampaignAssetInfoProvider.GetCampaignAssets().WhereEquals("CampaignAssetCampaignID", campaignId)
                .WhereEquals("CampaignAssetAssetGuid", nodeGuid).ToList().FirstOrDefault() != null)
            {
                return;
            }

            CampaignAssetInfoProvider.SetCampaignAssetInfo(new CampaignAssetInfo
            {
                CampaignAssetType       = "newsletter.issue",
                CampaignAssetCampaignID = campaignId,
                CampaignAssetAssetGuid  = nodeGuid
            });
        }
Example #2
0
        public static void AddPageAsset(int campaignId, string pagePath)
        {
            var nodeGuid = GetDocument(pagePath).NodeGUID;

            if (CampaignAssetInfoProvider.GetCampaignAssets().WhereEquals("CampaignAssetCampaignID", campaignId)
                .WhereEquals("CampaignAssetAssetGuid", nodeGuid).ToList().FirstOrDefault() != null)
            {
                return;
            }

            CampaignAssetInfoProvider.SetCampaignAssetInfo(new CampaignAssetInfo
            {
                CampaignAssetType       = "cms.document",
                CampaignAssetCampaignID = campaignId,
                CampaignAssetAssetGuid  = nodeGuid
            });
        }
        /// <summary>
        /// Adds the specific asset to campaign. If the asset does not exist it is created.
        /// </summary>
        /// <param name="campaignId">ID of the campaign.</param>
        /// <param name="assetUrlGuid">Asset URL GUID.</param>
        public static void AddPageAsset(int campaignId, Guid assetUrlGuid)
        {
            var campaignAsset = CampaignAssetInfoProvider.GetCampaignAssets()
                                .WhereEquals("CampaignAssetCampaignID", campaignId)
                                .WhereEquals("CampaignAssetAssetGuid", assetUrlGuid)
                                .ToList().FirstOrDefault();

            /* If the assest already exists, then do not create it. */
            if (campaignAsset != null)
            {
                return;
            }

            campaignAsset = new CampaignAssetInfo
            {
                CampaignAssetType       = CampaignAssetUrlInfo.OBJECT_TYPE,
                CampaignAssetCampaignID = campaignId,
                CampaignAssetAssetGuid  = assetUrlGuid,
            };

            CampaignAssetInfoProvider.SetCampaignAssetInfo(campaignAsset);

            var campaignAssetUrl = CampaignAssetUrlInfoProvider.GetCampaignAssetUrls()
                                   .WhereEquals("CampaignAssetUrlGuid", assetUrlGuid)
                                   .ToList().FirstOrDefault();

            if (campaignAssetUrl != null)
            {
                return;
            }

            var page = GetDocument("/Landing-pages/Coffee-samples");

            campaignAssetUrl = new CampaignAssetUrlInfo
            {
                CampaignAssetUrlCampaignAssetID = campaignAsset.CampaignAssetID,
                CampaignAssetUrlGuid            = assetUrlGuid,
                CampaignAssetUrlTarget          = page.RelativeURL.Replace("~", string.Empty),
                CampaignAssetUrlPageTitle       = "Coffee samples"
            };

            CampaignAssetUrlInfoProvider.SetCampaignAssetUrlInfo(campaignAssetUrl);
        }
        /// <summary>
        /// Creates newsletter if it does not exist.
        /// </summary>
        /// <param name="campaignId">ID of the campaign.</param>
        /// <param name="nodeGuid">Newsletter node guid.</param>
        private static void CreateNewsletterAsset(int campaignId, Guid nodeGuid)
        {
            var campaignAsset = CampaignAssetInfoProvider.GetCampaignAssets()
                                .WhereEquals("CampaignAssetCampaignID", campaignId)
                                .WhereEquals("CampaignAssetAssetGuid", nodeGuid)
                                .ToList().FirstOrDefault();

            if (campaignAsset != null)
            {
                return;
            }

            campaignAsset = new CampaignAssetInfo
            {
                CampaignAssetType       = PredefinedObjectType.NEWSLETTERISSUE,
                CampaignAssetCampaignID = campaignId,
                CampaignAssetAssetGuid  = nodeGuid,
            };

            CampaignAssetInfoProvider.SetCampaignAssetInfo(campaignAsset);
        }