public void Run() { mLog.Info("Get OutstandingActions has started."); try { mEmailsCc = GetUsersFromDistributionList(); int count; var outstandingActions = BuildOutstandingActions(out count); if (!String.IsNullOrEmpty(outstandingActions)) { Email email = new Email(); //FROM string emailAdminAccount = CommonUtils.GetAppSettingValue(CommonUtils.AppSettingKey.EmailAdminAccount); //Subject string subject = string.Format("CMS Overdue Actions ({0})", count.ToString(CultureInfo.CurrentCulture)); ListDictionary replacements = new ListDictionary(); replacements.Add("<%OutstandingActionsTable%>", outstandingActions); var sortedEmailsTo = mEmailsTo.ToList(); var sortedEmailsCc = mEmailsCc.ToList(); sortedEmailsTo.Sort(); sortedEmailsCc.Sort(); email.SendEmail(emailAdminAccount, sortedEmailsTo.ToArray(), sortedEmailsCc.ToArray(), subject, replacements, "OverdueActionsMailMessageDefinition.html"); } else { mLog.Info("There are no outstanding actions. Email will be not send."); } } catch (Exception ex) { mLog.Error("",ex,"Error occured in OutstandingActions"); } finally { mLog.Info("Get OutstandingActions has finished."); } }
public void Run() { mLog.Info("Get Overdue Calibrations has started."); try { List<string> emailsTo = BuildCalibrationRecipientList(); int count; var overdueCalibrationsHtml = BuildOverdueCalibrations(out count); if (!String.IsNullOrEmpty(overdueCalibrationsHtml)) { Email email = new Email(); //FROM string emailAdminAccount = CommonUtils.GetAppSettingValue(CommonUtils.AppSettingKey.EmailAdminAccount); //CC List<string> ccList = new List<string>(); string subject = string.Format("Overdue Calibrations ({0})", count.ToString(CultureInfo.CurrentCulture)); ListDictionary replacements = new ListDictionary {{"<%OverdueCalibrationsTable%>", overdueCalibrationsHtml} }; email.SendEmail(emailAdminAccount, emailsTo.ToArray(), ccList.ToArray(), subject, replacements, "OverdueCalibrationsDefinition.html"); } else { mLog.Info("There are no overdue calibarations. Email will be not send."); } } catch (Exception ex) { mLog.Error("", ex, "Error occured in OverdueCalibrations"); } finally { mLog.Info("Get OverdueCalibrations has finished."); } }