Example #1
0
        public static void AlertEmail(DisplayOutput dispOut, string smtp, string notificationEmail)
        {
            StringBuilder sb = new StringBuilder();
            string header = Constants.SYSTEM_CHECKES + DateTime.Now.ToString();
            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();

            foreach (string result in dispOut.Events)
            {
                sb.AppendLine(result);
                sb.AppendLine("");
            }

            Email.SendEmail(message, header, sb.ToString(), notificationEmail, smtp);
        }
Example #2
0
        private void EmailResults(DisplayOutput dispOut)
        {
            string smtp = Utility.GetAppSetting(Constants.SMTP_ADDRESS);
            string notificationEmail = Utility.GetAppSetting(Constants.NOTIFICATION_EMAIL);
            bool sendEmail = true;

            if (string.IsNullOrEmpty(smtp))
            {
                dispOut.Events.Add(Errors.SMTP_NOT_SET);
                sendEmail = false;
            }

            if (string.IsNullOrEmpty(notificationEmail))
            {
                dispOut.Events.Add(Errors.NOTIFICATION_EMAIL_NOT_SET);
                sendEmail = false;
            }

            if (sendEmail)
                Email.AlertEmail(dispOut, smtp, notificationEmail);
        }
Example #3
0
        public DisplayOutput Run()
        {
            List<Default> systems = null;
            DisplayOutput dispOut = new DisplayOutput();

            systems = SystemFactory.GetAllSystems();

            foreach (Default system in systems)
            {
                foreach (Job jb in system.Jobs)
                {
                    jb.JobAction();

                    foreach(string display in jb.GetDisplayOutput().Events)
                        dispOut.Events.Add(display);
                }
            }

            EmailResults(dispOut);

            return dispOut;
        }