public override bool DoWork(ReportLogger reportLogger) { int stepId = reportLogger.AddStep(); try { List <TrelloList> lists = GetLists(key, token, reportLogger); //Returns list of ids etc in correct order as per on screen Dictionary <string, string> contacts = Get.Contacts(); foreach (KeyValuePair <string, string> contact in contacts) { // TODO message could possibly be move out of the foreach loop. // TODO contact.Value is not used in the EmailContent function. string message = Emailer.EmailContent(lists, contact.Value); Emailer.SendEmail(contact.Key, "LCTG Business Priorities", message, false, "*****@*****.**"); } reportLogger.EndStep(stepId); } catch (Exception ex) { reportLogger.EndStep(stepId, ex); return(false); } return(true); }
public override bool Run() { if (DueToRun()) { ReportLogger.AddMessage("Trello", "Passed Due To Run."); ReportLogger reportLogger = new ReportLogger(Name); int stepId = reportLogger.AddStep(); try { ReportLogger.AddMessage("Trello", "Running"); List <TrelloList> lists = GetLists(key, token); //Returns list of ids etc in correct order as per on screen ReportLogger.AddMessage("Trello", "GetList"); Dictionary <string, string> contacts = Get.Contacts(); foreach (KeyValuePair <string, string> contact in contacts) { string message = Emailer.EmailContent(lists, contact.Value); Emailer.SendEmail(contact.Key, "LCTG - Daily Business Priorities", message, false, "*****@*****.**"); ReportLogger.AddMessage("Trello", "Email sent."); } reportLogger.EndStep(stepId); ReportLogger.AddMessage("Trello", "Completed"); } catch (Exception ex) { reportLogger.EndStep(stepId, ex); return(false); } reportLogger.EndLog(); return(true); } return(false); }