Beispiel #1
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>
    /// <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.GetMultiSubscriberOpenedIssueActivityCount(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));
        }

        return("0");
    }
 /// <summary>
 /// Unique opens value must not be higher then the count of subscribers.
 /// </summary>
 private void GenerateOpenedEmailToIssue(int issueId, int uniqueOpens, IList <string> subscribersEmails)
 {
     for (var i = 0; i < uniqueOpens; i++)
     {
         var openedEmail = new OpenedEmailInfo
         {
             OpenedEmailEmail   = subscribersEmails[i],
             OpenedEmailIssueID = issueId,
             OpenedEmailTime    = GetRandomDate(DateTime.Now.AddMonths(-1), DateTime.Now.AddDays(-1)),
         };
         OpenedEmailInfoProvider.SetOpenedEmailInfo(openedEmail);
     }
 }
 private void GenerateOpenedEmailToIssue(
     int issueId,
     int uniqueOpens,
     IList <string> subscribersEmails)
 {
     for (var index = 0; index < uniqueOpens; ++index)
     {
         var infoObj = new OpenedEmailInfo();
         infoObj.OpenedEmailEmail   = subscribersEmails[index];
         infoObj.OpenedEmailIssueID = issueId;
         var now  = DateTime.Now;
         var from = now.AddMonths(-1);
         now = DateTime.Now;
         var to = now.AddDays(-1.0);
         infoObj.OpenedEmailTime = GetRandomDate(from, to);
         OpenedEmailInfoProvider.SetOpenedEmailInfo(infoObj);
     }
 }
    /// <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");
        }
    }
Beispiel #5
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 and persona members
                    openedEmails += OpenedEmailInfoProvider.GetMultiSubscriberOpenedIssueActivityCount(winner.IssueID);
                }
            }
        }

        return(openedEmails);
    }