private string GetUniqueClicksRate(DataRowView rowView)
    {
        var issueSentEmails = DataHelper.GetIntValue(rowView.Row, "IssueSentEmails");
        if (issueSentEmails == 0)
        {
            return string.Empty;
        }

        var issueId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueID"), 0);
        var clicks = IssueHelper.GetIssueTotalUniqueClicks(issueId);
        var delivered = GetDelivered(rowView.Row);

        return FormatRate(clicks, delivered);
    }
    /// <summary>
    /// Gets a clickable click links 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 GetUniqueClicks(DataRowView rowView)
    {
        var issueSentEmails = DataHelper.GetIntValue(rowView.Row, "IssueSentEmails");
        if (issueSentEmails == 0)
        {
            return string.Empty;
        }

        var issueId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueID"), 0);
        var clicks = IssueHelper.GetIssueTotalUniqueClicks(issueId);

        if (clicks <= 0)
        {
            return ZERO;
        }

        var url = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.NEWSLETTER, "Newsletter.Issue.Reports.Clicks", issueId);
        return $@"<a href=""#"" onclick=""modalDialog('{url}', 'NewsletterTrackedLinks', '1000px', '700px'); return false;"">{clicks}</a>";
    }
    protected object grdElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName)
        {
        case "IssueVariantName":
        {
            DataRowView drv    = (DataRowView)parameter;
            string      result = ValidationHelper.GetString(drv["IssueVariantName"], string.Empty);

            // Issue has not been sent yet => get mail out time from scheduled task
            if (ValidationHelper.GetInteger(drv["IssueID"], 0) == WinnerIssueID)
            {
                result += " " + GetString("newsletterabtest.winner");
            }

            return(result);
        }

        case "MailoutTime":
        {
            string      result = null;
            DataRowView drv    = (DataRowView)parameter;
            DateTime    dt     = ValidationHelper.GetDateTime(drv["IssueMailoutTime"], DateTimeHelper.ZERO_TIME);

            if (dt == DateTimeHelper.ZERO_TIME)
            {
                // Issue has not been sent yet => get mail out time from scheduled task
                int      taskId = ValidationHelper.GetInteger(drv["IssueScheduledTaskID"], 0);
                TaskInfo task   = TaskInfoProvider.GetTaskInfo(taskId);
                if (task != null)
                {
                    if (task.TaskNextRunTime < DateTime.Now)
                    {
                        result = String.Format("{0} {1}", task.TaskNextRunTime.ToString(), GetString("newsletterissue_send.asap"));
                    }
                    else
                    {
                        result = task.TaskNextRunTime.ToString();
                    }
                    dt = task.TaskNextRunTime;
                }
                else
                {
                    result = GetString("general.na");
                }
            }
            else
            {
                result = dt.ToString();
            }

            if (mHighestMailoutTime < dt)
            {
                mHighestMailoutTime = dt;
            }

            return(result);
        }

        case "IssueStatus":
            IssueStatusEnum status = IssueStatusEnum.Idle;
            if ((parameter != DBNull.Value) && (parameter != null))
            {
                status = (IssueStatusEnum)parameter;
            }
            return(IssueHelper.GetStatusFriendlyName(status, null));

        case "IssueOpenedEmails":
            return(GetOpenedEmails(parameter as DataRowView));

        case "UniqueClicks":
            int issueId = ValidationHelper.GetInteger(parameter, 0);
            return(GetUniqueClicks(IssueHelper.GetIssueTotalUniqueClicks(issueId), issueId));
        }
        return(parameter);
    }