Beispiel #1
0
        public string GetClearTextLogString(bool formatAsHtml)
        {
            System.Text.StringBuilder reportBody = new System.Text.StringBuilder();

            string msg = "Send Newsletter report \nSubject: {5} \nStart: {0} \nFinished: {1} \nDuration: {2}ms \nEmails sent: {3} \n Errors: {4}\n";

            reportBody.AppendFormat(msg,
                                    SendStart.ToString(),
                                    SendStop.ToString(),
                                    TotalDuration.ToString(),
                                    SuccessMessages.Count.ToString(),
                                    ErrorMessages.Count.ToString(),
                                    Subject
                                    );

            GetMessagesMarkup(formatAsHtml, reportBody, ErrorMessages, "Errors", "danger");

            GetMessagesMarkup(formatAsHtml, reportBody, WarningMessages, "Warnings", "warning");

            msg = reportBody.ToString();
            if (formatAsHtml)
            {
                msg = msg.Replace("\n", "<br />\n");
            }

            return(msg);
        }
Beispiel #2
0
    /// <summary>
    /// Gets the time from the first action.
    /// </summary>
    /// <param name="time">Time of the action</param>
    protected string GetFromStart(object time)
    {
        DateTime t = ValidationHelper.GetDateTime(time, DateTime.MinValue);

        if (firstTime == DateTime.MinValue)
        {
            firstTime = t;
        }

        lastTime      = t;
        TotalDuration = t.Subtract(firstTime).TotalSeconds;

        return(TotalDuration.ToString("F3"));
    }