Exemplo n.º 1
0
 private object GetIssueStatus(object issueStatus)
 {
     var status = IssueStatusEnum.Idle;
     if (issueStatus != DBNull.Value && issueStatus != null)
     {
         status = (IssueStatusEnum)issueStatus;
     }
     return IssueHelper.GetStatusFriendlyName(status, null);
 }
Exemplo n.º 2
0
    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);
    }
    /// <summary>
    /// Handles the UniGrid's OnExternalDataBound event.
    /// </summary>
    /// <param name="sender">The sender</param>
    /// <param name="sourceName">Name of the source</param>
    /// <param name="parameter">The data row</param>
    /// <returns>Formatted value to be used in the UniGrid</returns>
    protected object UniGrid_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        string tooltipText = null;
        var    webControl  = sender as WebControl;

        // Prepare a tooltip for the column
        switch (sourceName.ToLowerCSafe())
        {
        case "issueopenedemails":
            tooltipText = GetString(mBounceMonitoringEnabled ? "newsletter.openratetooltip.delivered" : "newsletter.openratetooltip.sent");
            break;

        case "issueclickedlinks":
            tooltipText = GetString(mBounceMonitoringEnabled ? "newsletter.clickratetooltip.delivered" : "newsletter.clickratetooltip.sent");
            break;

        case "deliveryrate":
            tooltipText = GetString("newsletter.deliveryratetooltip");
            break;

        case "unsubscriberate":
            tooltipText = GetString(mBounceMonitoringEnabled ? "newsletter.unsubscriptionratetooltip.delivered" : "newsletter.unsubscriptionratetooltip.sent");
            break;

        default:
            break;
        }

        // If the sender is from a column with a tooltip, append tooltip to the control
        if ((webControl != null) && !String.IsNullOrEmpty(tooltipText))
        {
            ScriptHelper.AppendTooltip(webControl, tooltipText, null);
        }

        switch (sourceName.ToLowerCSafe())
        {
        case "issuesubject":
            return(GetIssueSubject(parameter as DataRowView));

        case "issuestatus":
            IssueStatusEnum status   = EnumHelper.GetDefaultValue <IssueStatusEnum>();
            var             statusID = ValidationHelper.GetInteger(parameter, -1);

            if (Enum.IsDefined(typeof(IssueStatusEnum), statusID))
            {
                status = (IssueStatusEnum)statusID;
            }

            return(IssueHelper.GetStatusFriendlyName(status, null));

        case "issuesentemails":
            var num = ValidationHelper.GetInteger(parameter, 0);
            return((num > 0) ? num.ToString() : String.Empty);

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

        case "issueclickedlinks":
            return(GetClickRate(parameter as DataRowView));

        case "deliveryrate":
            return(GetDeliveryRate(parameter as DataRowView));

        case "unsubscriberate":
            return(GetUnsubscriptionRate(parameter as DataRowView));

        default:
            return(parameter);
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Handles the UniGrid's OnExternalDataBound event.
    /// </summary>
    /// <param name="sender">The sender</param>
    /// <param name="sourceName">Name of the source</param>
    /// <param name="parameter">The data row</param>
    /// <returns>Formatted value to be used in the UniGrid</returns>
    private object UniGrid_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        var webControl = sender as WebControl;

        // Prepare a tooltip for the column
        string tooltipText = GetTooltipText(sourceName);

        // If the sender is from a column with a tooltip, append tooltip to the control
        if ((webControl != null) && !String.IsNullOrEmpty(tooltipText))
        {
            ScriptHelper.AppendTooltip(webControl, tooltipText, null);
        }

        switch (sourceName.ToLowerInvariant())
        {
        case "issuedisplayname":
            return(GetIssueDisplayName(parameter as DataRowView));

        case "issuestatus":
            IssueStatusEnum status   = EnumHelper.GetDefaultValue <IssueStatusEnum>();
            var             statusID = ValidationHelper.GetInteger(parameter, -1);

            if (Enum.IsDefined(typeof(IssueStatusEnum), statusID))
            {
                status = (IssueStatusEnum)statusID;
            }

            return(IssueHelper.GetStatusFriendlyName(status, null));

        case "issuesentemails":
            var num = ValidationHelper.GetInteger(parameter, 0);
            return((num > 0) ? num.ToString() : String.Empty);

        case "issueopenedemailsrate":
            return(GetOpenedEmailsRate(parameter as DataRowView));

        case "issueopenedemails":
            return(GetOpenedEmailsCount(parameter as DataRowView));

        case "issueclickedlinksrate":
            return(GetClickRate(parameter as DataRowView));

        case "issueclickedlinks":
            return(GetClickCount(parameter as DataRowView));

        case "deliveryrate":
            return(GetDeliveryRate(parameter as DataRowView));

        case "delivered":
            return(GetDeliveryCount(parameter as DataRowView));

        case "unsubscriberate":
            return(GetUnsubscriptionRate(parameter as DataRowView));

        case "unsubscribtions":
            return(GetUnsubscriptionCount(parameter as DataRowView));

        default:
            return(parameter);
        }
    }