private static void tmSchedule_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (workingSchedule) { return; } try { if (DateTime.Now.Hour == 0 && DateTime.Now.Minute == 0) { workingSchedule = true; Business.Notification.NotificationEMailBusiness eMailBusiness = new Business.Notification.NotificationEMailBusiness(); ResponseBo responseBo = eMailBusiness.PrepareDailySummary(); } } catch (Exception ex) { } finally { workingSchedule = false; } }
private static void tmSendMail_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Business.Notification.NotificationEMailBusiness eMailBusiness = new Business.Notification.NotificationEMailBusiness(); ResponseBo <List <NotificationEMailListBo> > responseListBo = eMailBusiness.GetNotSentList(); if (responseListBo.IsSuccess && responseListBo.Bo != null && responseListBo.Bo.Count() > 0) { foreach (NotificationEMailListBo item in responseListBo.Bo) { EMail eMail = new EMail(); eMail.Send(item); } } }