コード例 #1
0
ファイル: Report.cs プロジェクト: ilya-chumakov/PingWin
        private async Task SendMail(ReportRowList list)
        {
            string subject = "PingWin: Regular failure report!";

            string body = GetBody(list);

            await Mailer.SendMailAsync(subject, body);
        }
コード例 #2
0
ファイル: Report.cs プロジェクト: ilya-chumakov/PingWin
        private string GetBody(ReportRowList list)
        {
            var builder = new StringBuilder();

            builder.AppendLine($"PingWin has recorded {list.LogTotalCount} failures at confugured interval.");

            builder.AppendLine($"Interval begin: {list.Begin}");
            builder.AppendLine($"Interval end: {list.End}");
            builder.AppendLine();
            builder.AppendLine("Technical information below in the following format:");
            builder.AppendLine("<JOB_NAME>: <FAILURE_COUNT>    <FIRST_FAILURE_TIME>    <LAST_FAILURE_TIME>");
            builder.AppendLine();

            foreach (var row in list.Rows.OrderBy(row => row.JobName))
            {
                builder.AppendLine(
                    $"{row.JobName}: {row.Count}    {row.First.DateTime.ToShortTimeString()}    {row.Last.DateTime.ToShortTimeString()}");
            }

            return(builder.ToString());
        }