Exemplo n.º 1
0
        public void Generate()
        {
            CampaignInfoProvider.GetCampaigns().WhereStartsWith("CampaignName", "DancingGoat.")
            .OnSite(_mSite.SiteID).ToList()
            .ForEach(CampaignInfoProvider.DeleteCampaignInfo);

            GenerateCoffeeClubMembershipCampaign();
            GenerateCafePromotionSampleCampaign();

            GenerateCampaignObjective(CampaignCafeSamplePromotionRunning, ConversionFormsubmissionTryFreeSample, 600);
            GenerateCampaignObjective(CampaignCafeSamplePromotionFinished, ConversionFormsubmissionTryFreeSample, 50);

            GenerateActivities(CampaignCafeSamplePromotionRunning, _campaignCafeSamplePromotionRunningHits, CampaignCafeSamplePromotionRunningContactsCount);
            GenerateActivities(CampaignCafeSamplePromotionFinished, _campaignCafeSamplePromotionFinishedHits, CampaignCafeSamplePromotionFinishedContactsCount);

            var result = new CalculateCampaignConversionReportTask().Execute(new TaskInfo
            {
                TaskSiteID = _mSite.SiteID
            });

            if (!string.IsNullOrEmpty(result))
            {
                throw new InvalidOperationException($"Exception message: '{result}'");
            }
        }
Exemplo n.º 2
0
    /// <summary>
    /// Reload data from node to controls.
    /// </summary>
    private void ReloadData()
    {
        ucConversionSelector.Value = Node.DocumentTrackConversionName;
        txtConversionValue.Value   = Node.DocumentConversionValue;

        var campaignsListWithNameAndLink = CampaignInfoProvider.GetCampaigns()
                                           .Source(s => s.Join <CampaignAssetInfo>("CampaignID", "CampaignAssetCampaignID"))
                                           .WhereEquals("CampaignAssetAssetGuid", Node.NodeGUID)
                                           .WhereEquals("CampaignAssetType", TreeNode.OBJECT_TYPE)
                                           .Columns("CampaignDisplayName", "CampaignID")
                                           .Select(campaign => new
        {
            EncodedCampaignDisplayName = HTMLHelper.HTMLEncode(campaign.CampaignDisplayName),
            CampaignEditLink           = URLHelper.GetAbsoluteUrl(Service.Entry <IUILinkProvider>().GetSingleObjectLink(CampaignInfo.TYPEINFO.ModuleName, CAMPAIGN_ELEMENT_CODENAME,
                                                                                                                        new ObjectDetailLinkParameters
            {
                ObjectIdentifier         = campaign.CampaignID,
                AllowNavigationToListing = true
            }))
        });

        if (campaignsListWithNameAndLink.Any())
        {
            listViewCampaings.DataSource = campaignsListWithNameAndLink;
            listViewCampaings.DataBind();
            ucConversionSelector.Enabled = false;
            txtConversionValue.Enabled   = false;
            smrtpEditInCampaign.Visible  = true;
            smrtpEditInCampaign.Content  = GetString("om.analyticSettings.editInCampain");
        }
        else
        {
            pnlTrackedCampaigns.Visible = false;
        }
    }
Exemplo n.º 3
0
    private static IList <CampaignListItemViewModel> GetCampaigns()
    {
        var now = DateTime.Now;

        return(CampaignInfoProvider.GetCampaigns()
               .OnSite(SiteContext.CurrentSiteID)
               .ToList()
               .OrderBy(campaign => (int)campaign.GetCampaignStatus(now))
               .ThenBy(campaign => campaign.CampaignDisplayName)
               .Select(campaign => CreateCampaignViewModel(campaign, now))
               .ToList());
    }
Exemplo n.º 4
0
    /// <summary>
    /// Replace value in ActivityCampaign field where <see cref="CampaignInfo.CampaignName"/> is stored by <see cref="CampaignInfo.CampaignID"/>.
    /// </summary>
    /// <param name="step">Step to be replaced.</param>
    private static void UpdateCustomActivityStep(WorkflowStepInfo step)
    {
        var parameters   = step.StepActionParameters;
        var campaignName = parameters.GetValue("ActivityCampaign");
        var campaign     = CampaignInfoProvider.GetCampaigns()
                           .WhereEquals("CampaignName", campaignName)
                           .FirstOrDefault();

        if (campaign == null)
        {
            return;
        }

        parameters.SetValue("ActivityCampaign", campaign.CampaignID);
        WorkflowStepInfoProvider.SetWorkflowStepInfo(step);
    }
        /// <summary>
        /// Performs campaigns sample data generating.
        /// </summary>
        public void Generate()
        {
            CampaignInfoProvider.GetCampaigns()
            .WhereStartsWith("CampaignName", "DancingGoatMVC.")
            .OnSite(mSite.SiteID)
            .ToList()
            .ForEach(CampaignInfoProvider.DeleteCampaignInfo);

            /* Generate campaigns. */
            GenerateCafePromotionSampleCampaign();

            /* Generate campaign objectives */
            GenerateCampaignObjective(CAMPAIGN_CAFE_SAMPLE_PROMOTION_RUNNING, CONVERSION_FORMSUBMISSION_COFFEE_SAMPLE_LIST, 600);
            GenerateCampaignObjective(CAMPAIGN_CAFE_SAMPLE_PROMOTION_FINISHED, CONVERSION_FORMSUBMISSION_COFFEE_SAMPLE_LIST, 50);

            /* Generate activities */
            GenerateActivities(CAMPAIGN_CAFE_SAMPLE_PROMOTION_RUNNING, CAMPAIGN_CAFE_SAMPLE_PROMOTION_RUNNING_HITS, CAMPAIGN_CAFE_SAMPLE_PROMOTION_RUNNING_CONTACTS_COUNT);
            GenerateActivities(CAMPAIGN_CAFE_SAMPLE_PROMOTION_FINISHED, CAMPAIGN_CAFE_SAMPLE_PROMOTION_FINISHED_HITS, CAMPAIGN_CAFE_SAMPLE_PROMOTION_FINISHED_CONTACTS_COUNT);

            new CalculateCampaignConversionReportTask().Execute(new TaskInfo()
            {
                TaskSiteID = mSite.SiteID
            });
        }
Exemplo n.º 6
0
    /// <summary>
    /// Loads form data.
    /// </summary>
    private void LoadForm()
    {
        var       isABTest = false;
        IssueInfo issue    = null;

        if (IssueID > 0)
        {
            // Get issue object
            issue = IssueInfoProvider.GetIssueInfo(IssueID);
            if (issue != null)
            {
                if (NewsletterID == 0)
                {
                    // Set newsletter ID
                    NewsletterID = issue.IssueNewsletterID;
                }

                if (!RequestHelper.IsPostBack())
                {
                    txtDisplayName.Text    = issue.IssueDisplayName;
                    txtSubject.Text        = issue.IssueSubject;
                    chkIssueUseUTM.Checked = issue.IssueUseUTM;
                }

                isABTest = issue.IssueIsABTest;
            }
        }

        // Get newsletter object
        if (Newsletter != null)
        {
            issueTemplate.WhereCondition = GetAvailableEmailTemplatesWhere(issue);

            if (TemplateID > 0)
            {
                // Set selected value
                issueTemplate.Value = TemplateID;
            }

            if ((TemplateID <= 0) && (issue != null) && (issue.IssueTemplateID != TemplateID))
            {
                // Change selected value
                issueTemplate.Value = TemplateID = issue.IssueTemplateID;
                issueTemplate.Reload(false);
            }

            // Prevent selecting none value in campaign selector if there is no campaign
            if (mAreCampaignsAvailable && CampaignInfoProvider.GetCampaigns().OnSite(SiteContext.CurrentSiteID).Count == 0)
            {
                radUTMCampaignExisting.Checked = false;
                radUTMCampaignExisting.Enabled = false;
                selectorUTMCampaign.Enabled    = false;
                radUTMCampaignNew.Checked      = true;
                mUTMCampaignTextBox.Enabled    = true;
            }

            // Initialize inputs and content controls
            if (!RequestHelper.IsPostBack())
            {
                txtSenderName.Text     = issue != null ? issue.IssueSenderName : Newsletter.NewsletterSenderName;
                txtSenderEmail.Text    = issue != null ? issue.IssueSenderEmail : Newsletter.NewsletterSenderEmail;
                txtIssueUTMSource.Text = issue != null ? issue.IssueUTMSource : string.Empty;
                txtPreheader.Text      = issue != null ? issue.IssuePreheader : string.Empty;

                if (issue != null)
                {
                    if (mAreCampaignsAvailable && (CampaignInfoProvider.GetCampaignByUTMCode(issue.IssueUTMCampaign, SiteContext.CurrentSiteName) != null))
                    {
                        selectorUTMCampaign.Value = issue.IssueUTMCampaign;
                        selectorUTMCampaign.Reload(false);
                        selectorUTMCampaign.Enabled = true;

                        radUTMCampaignExisting.Checked = true;
                        radUTMCampaignNew.Checked      = false;
                        mUTMCampaignTextBox.Enabled    = false;
                    }
                    else
                    {
                        mUTMCampaignTextBox.Text    = issue.IssueUTMCampaign;
                        mUTMCampaignTextBox.Enabled = true;

                        radUTMCampaignExisting.Checked = false;
                        radUTMCampaignNew.Checked      = true;
                        selectorUTMCampaign.Enabled    = false;
                    }
                }
            }
            else
            {
                if (issue != null && !pnlUTMParameters.Visible)
                {
                    if (string.IsNullOrEmpty(txtIssueUTMSource.Text.Trim()))
                    {
                        txtIssueUTMSource.Text = Normalize(Newsletter.NewsletterName + "_" + txtSubject.Text.Trim());
                    }

                    if (string.IsNullOrEmpty(mUTMCampaignTextBox.Text.Trim()))
                    {
                        mUTMCampaignTextBox.Text = Newsletter.NewsletterName.ToLower(CultureInfo.CurrentCulture);
                    }
                }
            }

            mUTMCampaignTextBox.Attributes["placeholder"] = Newsletter.NewsletterName.ToLower(CultureInfo.CurrentCulture);
        }

        txtIssueUTMMedium.Text   = DEFAULT_UTM_MEDIUM;
        btnSubmit.Enabled        = Enabled;
        txtDisplayName.Enabled   = Enabled && IsDisplayNameFieldEnabled(issue);
        txtPreheader.Enabled     = Enabled;
        chkIssueUseUTM.Enabled   = pnlIssueUTMCampaign.Enabled = pnlIssueUTMMedium.Enabled = pnlIssueUTMSource.Enabled = Enabled;
        txtSubject.Enabled       = txtSenderEmail.Enabled = txtSenderName.Enabled = issueTemplate.Enabled = Enabled;
        pnlUTMParameters.Visible = chkIssueUseUTM.Checked;

        InitTooltips(isABTest);
    }
Exemplo n.º 7
0
    /// <summary>
    /// Reloads control data.
    /// </summary>
    /// <param name="forceReload">Indicates if force reload should be used</param>
    public override void ReloadData(bool forceReload)
    {
        var isABTest = false;

        if (!mLoaded || forceReload)
        {
            IssueInfo issue = null;
            if (IssueID > 0)
            {
                // Get issue object
                issue = IssueInfoProvider.GetIssueInfo(IssueID);
                if (issue != null)
                {
                    if (NewsletterID == 0)
                    {
                        // Set newsletter ID
                        NewsletterID = issue.IssueNewsletterID;
                    }

                    if (string.IsNullOrEmpty(txtSubject.Text) || forceReload)
                    {
                        txtSubject.Text          = issue.IssueSubject;
                        chkShowInArchive.Checked = issue.IssueShowInNewsletterArchive;
                        chkIssueUseUTM.Checked   = issue.IssueUseUTM;
                    }

                    isABTest = issue.IssueIsABTest;
                }
            }

            // Get newsletter object
            if (Newsletter != null)
            {
                // Modify where condition of template selector if issue exists
                string issueTemplateWhere = (issue != null) ? string.Format(" OR TemplateID IN (SELECT IssueTemplateID From Newsletter_NewsletterIssue WHERE IssueID={0})", issue.IssueID) : string.Empty;

                // Initialize template selector
                issueTemplate.WhereCondition = String.Format("(TemplateType='{0}') AND (TemplateID IN (SELECT NewsletterTemplateID FROM Newsletter_Newsletter WHERE NewsletterID={1})" +
                                                             " OR TemplateID IN (SELECT TemplateID FROM Newsletter_EmailTemplateNewsletter WHERE NewsletterID={1}){2}) AND (TemplateSiteID={3})",
                                                             EmailTemplateType.Issue, NewsletterID, issueTemplateWhere, Newsletter.NewsletterSiteID);

                if (TemplateID > 0)
                {
                    // Set selected value
                    issueTemplate.Value = TemplateID;
                }

                if ((forceReload || (TemplateID <= 0)) && (issue != null) && (issue.IssueTemplateID != TemplateID))
                {
                    // Change selected value
                    issueTemplate.Value = TemplateID = issue.IssueTemplateID;

                    issueTemplate.Reload(forceReload);
                }

                if (TemplateID <= 0)
                {
                    // Get ID of default template
                    issueTemplate.Value = TemplateID = Newsletter.NewsletterTemplateID;
                }

                // Prevent selecting none value in campaign selector if there is no campaign
                if (CampaignInfoProvider.GetCampaigns().OnSite(SiteContext.CurrentSiteID).Count == 0)
                {
                    radUTMCampaignExisting.Checked = false;
                    radUTMCampaignExisting.Enabled = false;
                    selectorUTMCampaign.Enabled    = false;
                    radUTMCampaignNew.Checked      = true;
                    txtIssueUTMCampaign.Enabled    = true;
                }

                // Initialize inputs and content controls
                if (!RequestHelper.IsPostBack() || forceReload)
                {
                    txtSenderName.Text     = (issue != null ? issue.IssueSenderName : Newsletter.NewsletterSenderName);
                    txtSenderEmail.Text    = (issue != null ? issue.IssueSenderEmail : Newsletter.NewsletterSenderEmail);
                    txtIssueUTMSource.Text = (issue != null ? issue.IssueUTMSource : string.Empty);

                    if (issue != null)
                    {
                        if (CampaignInfoProvider.GetCampaignByUTMCode(issue.IssueUTMCampaign, SiteContext.CurrentSiteName) != null)
                        {
                            selectorUTMCampaign.Value = issue.IssueUTMCampaign;
                            selectorUTMCampaign.Reload(forceReload);

                            selectorUTMCampaign.Enabled = true;

                            radUTMCampaignExisting.Checked = true;
                            radUTMCampaignNew.Checked      = false;
                            txtIssueUTMCampaign.Enabled    = false;
                        }
                        else
                        {
                            txtIssueUTMCampaign.Text    = issue.IssueUTMCampaign;
                            txtIssueUTMCampaign.Enabled = true;

                            radUTMCampaignExisting.Checked = false;
                            radUTMCampaignNew.Checked      = true;
                            selectorUTMCampaign.Enabled    = false;
                        }
                    }
                }
                else
                {
                    if (issue != null)
                    {
                        if (string.IsNullOrEmpty(txtIssueUTMSource.Text.Trim()))
                        {
                            txtIssueUTMSource.Text = Normalize(Newsletter.NewsletterName + "_" + txtSubject.Text.Trim());
                        }

                        if (string.IsNullOrEmpty(txtIssueUTMCampaign.Text.Trim()))
                        {
                            txtIssueUTMCampaign.Text = Newsletter.NewsletterName.ToLower();
                        }
                    }
                }

                contentBody.NewsletterID = NewsletterID;
                contentBody.IssueID      = IssueID;
                contentBody.TemplateID   = TemplateID;
                contentBody.Enabled      = Enabled;
                contentBody.ReloadData(forceReload);

                // Set simple/advanced options visibility
                InitSimpleAdvancedOptions();

                txtIssueUTMCampaign.Attributes["placeholder"] = Newsletter.NewsletterName.ToLower();

                // Set flag
                mLoaded = true;
            }
        }

        txtIssueUTMMedium.Text   = DEFAULT_UTM_MEDIUM;
        chkShowInArchive.Enabled = txtSubject.Enabled = txtSenderEmail.Enabled = txtSenderName.Enabled = issueTemplate.Enabled = Enabled;
        chkIssueUseUTM.Enabled   = pnlIssueUTMCampaign.Enabled = pnlIssueUTMMedium.Enabled = pnlIssueUTMSource.Enabled = Enabled;
        pnlUTMParameters.Visible = chkIssueUseUTM.Checked;

        InitTooltips(isABTest);
    }