コード例 #1
0
    private object GridVariants_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        if (sourceName.Equals("variantName", StringComparison.OrdinalIgnoreCase))
        {
            var drv   = UniGridFunctions.GetDataRowView(sender as DataControlFieldCell);
            var issue = new IssueInfo(drv.Row);

            string navigateUrl = EmailBuilderHelper.GetNavigationUrl(Issue.IssueNewsletterID, issue.IssueID, 2);

            return(new HyperLink
            {
                NavigateUrl = navigateUrl,
                Text = HTMLHelper.HTMLEncode(issue.GetVariantName())
            });
        }

        if (sourceName.Equals("delete", StringComparison.OrdinalIgnoreCase))
        {
            var dr           = UniGridFunctions.GetDataRowView(parameter);
            int issueId      = Convert.ToInt32(dr["IssueID"]);
            var deleteButton = (CMSGridActionButton)sender;
            deleteButton.Enabled = (OriginalVariant.IssueID != issueId) && Enabled;
        }

        return(parameter);
    }
コード例 #2
0
    private void GridVariants_OnAction(string actionName, object actionArgument)
    {
        if (actionName.Equals("delete", StringComparison.OrdinalIgnoreCase))
        {
            int deletedIssueId = ValidationHelper.GetInteger(actionArgument, 0);
            EmailABTestService.DeleteVariant(deletedIssueId);

            var variants = IssueHelper.GetIssueVariants(ParentIssueId, additionalWhereCondition: null);
            int redirectToIssueId;

            // Handle the situation when deleted variant was the actually displayed variant or entire A/B test was deleted as well.
            if ((variants != null) && variants.Any())
            {
                if (Issue.IssueID != deletedIssueId)
                {
                    // Don't redirect, leave current location unchanged.
                    return;
                }

                // Switch to first available variant
                redirectToIssueId = variants.First().IssueID;
            }
            else
            {
                // Suppose the entire A/B test was removed so switch to the original issue
                redirectToIssueId = ParentIssueId;
            }

            string url = EmailBuilderHelper.GetNavigationUrl(Issue.IssueNewsletterID, redirectToIssueId, 2);
            URLHelper.Redirect(url);
        }
    }
コード例 #3
0
    /// <summary>
    /// Handler for email properties save action.
    /// </summary>
    private void RightPanelSave(object sender, EmailBuilderEventArgs eventArgs)
    {
        if (eventArgs.FullRefresh)
        {
            mIsFullRefresh = true;

            ScriptHelper.RegisterStartupScript(Page, typeof(string), "RefreshParent", ScriptHelper.GetScript(REFRESH_PARENT_SCRIPT));
            return;
        }

        var issueNavigationUrl = EmailBuilderHelper.GetNavigationUrl(eventArgs.NewsletterID, eventArgs.IssueID, IsInAutomation, eventArgs.SelectedTabIndex, eventArgs.SelectedTabIndex == 1);

        if (IsDialog)
        {
            issueNavigationUrl = URLHelper.PropagateUrlParameters(issueNavigationUrl, "dialog", "returnhandler");
            issueNavigationUrl = ApplicationUrlHelper.AppendDialogHash(issueNavigationUrl);
        }

        URLHelper.Redirect(issueNavigationUrl);
    }
コード例 #4
0
    /// <summary>
    /// When dialog's OK button for new variant action is clicked.
    /// </summary>
    protected void btnSaveDialog_Click(object sender, EventArgs e)
    {
        if (String.IsNullOrWhiteSpace(txtVariantName.Text))
        {
            errorMessage.Text = GetString("newsletter.variantdisplaynamemissing");
            return;
        }

        try
        {
            string    variantName = txtVariantName.Text.Truncate(VARIANT_NAME_SIZE);
            IssueInfo newVariant  = EmailABTestService.CreateVariant(variantName, Issue.IssueID);

            string navigateUrl = EmailBuilderHelper.GetNavigationUrl(Issue.IssueNewsletterID, newVariant.IssueID, 2);
            URLHelper.Redirect(navigateUrl);
        }
        catch (InvalidOperationException exception)
        {
            Service.Resolve <IEventLogService>().LogException("Newsletter", "ADDVARIANT", exception);
            errorMessage.Text = GetString("emailbuilder.generalerror");
        }
    }
コード例 #5
0
    /// <summary>
    /// Handler for email properties save action.
    /// </summary>
    private void EmailProperties_Save(object sender, EmailBuilderEventArgs eventArgs)
    {
        string issueNavigationUrl = EmailBuilderHelper.GetNavigationUrl(eventArgs.NewsletterID, eventArgs.IssueID, selectedTabIndex: 1, includeSaveMessage: true);

        URLHelper.Redirect(issueNavigationUrl);
    }