Beispiel #1
0
        private void GenerateCampaignObjective(
            string campaignName,
            string conversionName,
            int objectiveValue)
        {
            var campaignInfo = CampaignInfoProvider.GetCampaignInfo(campaignName, _mSite.SiteName);

            if (campaignInfo == null)
            {
                return;
            }

            var campaignConversionInfo = CampaignConversionInfoProvider.GetCampaignConversions()
                                         .WhereEquals("CampaignConversionDisplayName", conversionName)
                                         .WhereEquals("CampaignConversionCampaignID", campaignInfo.CampaignID)
                                         .FirstOrDefault();

            if (campaignConversionInfo == null)
            {
                return;
            }

            CampaignObjectiveInfoProvider.SetCampaignObjectiveInfo(new CampaignObjectiveInfo
            {
                CampaignObjectiveCampaignID           = campaignInfo.CampaignID,
                CampaignObjectiveCampaignConversionID = campaignConversionInfo.CampaignConversionID,
                CampaignObjectiveValue = objectiveValue
            });
        }
        /// <summary>
        /// Creates conversion for the campaign.
        /// </summary>
        /// <param name="campaignId">ID of the campaign.</param>
        /// <param name="conversionData">Campaign conversion data for generating.</param>
        public static void CreateConversion(int campaignId, CampaignConversionData conversionData)
        {
            var conversion = CampaignConversionInfoProvider.GetCampaignConversions()
                             .WhereEquals("CampaignConversionCampaignID", campaignId)
                             .WhereEquals("CampaignConversionActivityType", conversionData.ConversionActivityType)
                             .WhereEquals("CampaignConversionItemID", conversionData.ConversionItemID)
                             .WhereEquals("CampaignConversionURL", conversionData.ConversionUrl)
                             .WhereEquals("CampaignConversionIsFunnelStep", conversionData.ConversionIsFunnelStep)
                             .ToList().FirstOrDefault();

            if (conversion != null)
            {
                return;
            }

            conversion = new CampaignConversionInfo
            {
                CampaignConversionName         = conversionData.ConversionName,
                CampaignConversionDisplayName  = conversionData.ConversionDisplayName,
                CampaignConversionCampaignID   = campaignId,
                CampaignConversionActivityType = conversionData.ConversionActivityType,
                CampaignConversionItemID       = conversionData.ConversionItemID.GetValueOrDefault(),
                CampaignConversionIsFunnelStep = conversionData.ConversionIsFunnelStep,
                CampaignConversionOrder        = conversionData.ConversionOrder,
                CampaignConversionURL          = conversionData.ConversionUrl
            };

            CampaignConversionInfoProvider.SetCampaignConversionInfo(conversion);
        }
    private IEnumerable <CampaignConversionViewModel> GetConversions(int campaignId)
    {
        var service = Service.Resolve <ICampaignConversionService>();

        return(CampaignConversionInfoProvider.GetCampaignConversions()
               .WhereEquals("CampaignConversionCampaignID", campaignId)
               .OrderBy("CampaignConversionOrder")
               .ToList()
               .Select(service.GetConversionViewModel));
    }