Пример #1
0
 private void ThrowErrors()
 {
     if (_errorReporter.ErrorsSeen)
     {
         throw ExceptionBuilder.CodeAssistanceFailed(_errorReporter.GetErrors());
     }
 }
Пример #2
0
        public void OnMistakeNotifyAllAdmins(ErrorCollector errors)
        {
            if (!AppConfig.Setting.OnMistakeNotifyAllAdmins)
            {
                return;
            }
            Thread mailSender = new Thread(() => {
                var admins        = GetAdmins();
                var mail          = new MailMessage();
                mail.Subject      = GetSubject("User mistakes recorded");
                string tableStart = "<table>",
                tableEnd          = "</table>",
                rowSt             = "<tr>",
                rowEd             = "</tr>",
                colSt             = "<td>",
                colEd             = "</td>",
                thSt        = "<th>",
                thEd        = "</th>";
                string rows = "";
                foreach (var item in errors.GetErrors())
                {
                    rows += rowSt +
                            colSt +
                            item.OrderID +
                            colEd + colSt +
                            item.Message +
                            colEd;
                }

                string msg = tableStart +
                             "<thead>" +
                             thSt + "Order ID" + thEd +
                             thSt + "Message" + thEd +
                             "</thead><tbody>" +
                             rows +
                             "</tbody>" +
                             tableEnd;
                mail.Body = msg;
                foreach (var admin in admins)
                {
                    mail.Bcc.Add(admin);
                }
                SendEmail(mail);
            });

            mailSender.Start();
        }