private void AlertEvent(object source, System.Timers.ElapsedEventArgs e) { int runat = Int32.Parse(ConfigurationManager.AppSettings["EmailAlert.RunAt"]); if (Int32.Parse(DateTime.Now.ToString("HH")) == runat) { if (!EmailAlert.IsRunning) { try { Utility.WriteLog("***Start alert service ***"); EmailAlert.IsRunning = true; EmailAlert alert = new EmailAlert(); //run alert main function here //alert.SendAlertToApprovers(); Utility.WriteLog("***End alert service***"); } catch (Exception ex) { Utility.WriteLog(ex.ToString()); } finally { EmailAlert.IsRunning = false; } } } }
private void AlertEvent(object source, System.Timers.ElapsedEventArgs e) { int runat = Int32.Parse(ConfigurationManager.AppSettings["EmailAlert.RunAt"]); if (Int32.Parse(DateTime.Now.ToString("HH")) == runat) { if (!EmailAlert.IsRunning) { try { Utility.WriteLog("***Start alert service ***"); EmailAlert.IsRunning = true; EmailAlert alert = new EmailAlert(); //run alert main function here alert.SendAlertToApprovers(); Utility.WriteLog("***End alert service***"); } catch (Exception ex) { Utility.WriteLog(ex.ToString()); } finally { EmailAlert.IsRunning = false; } } } }