/// <summary>
    /// Gets a clickable opened emails counter based on the values from datasource.
    /// </summary>
    /// <param name="rowView">A <see cref="DataRowView" /> that represents one row from UniGrid's source</param>
    /// <returns>A link with detailed statistics about opened emails</returns>
    private string GetOpenedEmails(DataRowView rowView)
    {
        // Get issue ID
        int issueId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueID"), 0);

        // Get opened emails count from issue record
        int openedEmails = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueOpenedEmails"), 0);

        if (mOnlineMarketingEnabled)
        {
            // Get number of emails opened by contact group members
            openedEmails += OpenedEmailInfoProvider.GetContactGroupOpens(issueId);
        }

        // Add winner variant data if it is an A/B test and a winner has been selected
        if (ValidationHelper.GetBoolean(DataHelper.GetDataRowViewValue(rowView, "IssueIsABTest"), false))
        {
            openedEmails += GetWinnerVariantOpenes(issueId);
        }

        if (openedEmails > 0)
        {
            return(string.Format(@"<a href=""#"" onclick=""ShowOpenedBy({0})"">{1}</a>", issueId, openedEmails));
        }
        else
        {
            return("0");
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Gets a clickable opened emails counter based on the values from datasource.
    /// </summary>
    /// <param name="rowView">A <see cref="DataRowView" /> that represents one row from UniGrid's source</param>
    private string GetOpenedEmails(DataRowView rowView)
    {
        // Get issue ID
        int issueId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueID"), 0);

        // Get opened emails count from issue record
        int openedEmails = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueOpenedEmails"), 0);

        if (OnlineMarketingEnabled)
        {
            // Get number of emails opened by contact group members
            openedEmails += OpenedEmailInfoProvider.GetContactGroupOpens(issueId);
        }

        if (openedEmails > 0)
        {
            return(string.Format(@"<a href=""#"" onclick=""ShowOpenedBy({0})"">{1}</a>", issueId, openedEmails));
        }
        else
        {
            return("0");
        }
    }
    /// <summary>
    /// Gets number of opened e-mails of winner variant issue.
    /// </summary>
    /// <param name="issueId">ID of parent issue</param>
    private int GetWinnerVariantOpenes(int issueId)
    {
        int openedEmails = 0;

        ABTestInfo test = ABTestInfoProvider.GetABTestInfoForIssue(issueId);

        if ((test != null) && (test.TestWinnerIssueID > 0))
        {
            IssueInfo winner = IssueInfoProvider.GetIssueInfo(test.TestWinnerIssueID);
            if (winner != null)
            {
                // Get opened emails count from winner issue
                openedEmails += winner.IssueOpenedEmails;

                if (mOnlineMarketingEnabled)
                {
                    // Get number of emails opened by contact group members
                    openedEmails += OpenedEmailInfoProvider.GetContactGroupOpens(winner.IssueID);
                }
            }
        }

        return(openedEmails);
    }