コード例 #1
0
ファイル: AlertService.cs プロジェクト: hijoy/CPL_ERS
        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;
                    }
                }
            }
        }
コード例 #2
0
        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;
                    }
                }
            }
        }