Global中的Timer计时器

protected  void Application_Start( object sender, EventArgs e) //端口启动的事件
        {
            Hzjg.Common.Utility.Log.FilePath = Server.MapPath( " ~/ ") +  " \\log ";

             //  在应用程序启动时运行的代码  
            System.Timers.Timer myTimer =  new System.Timers.Timer( 1000); // 一天执行一次            
            myTimer.Interval =  1000; // 执行间隔 1秒

            myTimer.Elapsed += this.Time;
            myTimer.Enabled = true;
            myTimer.Start();
        }
        //执行方法
        public void Time(object sender, EventArgs e)
        {
            if (DateTime.Now.Day == 18)//每月第一天执行
            {
                if (DateTime.Now.ToString("HH:mm:ss") == "15:25:00")
                {
                    var recCode = new List<string>();
                    recCode.Add("qiaolb");
                    var oMes = new Hzjg.Common.Model.Mes();
                    var sjdx = new JG.IBase.Sys.Model.XX_SJDX
                    {
                        ID = Guid.NewGuid().ToString("N"),
                        DXLY = Hzjg.Common.Config.ConfigManage.fGetAppConfig("WebName"),
                        FSBJ = "0",
                        FSRRYH = "jgadmin",
                        FSRSJH = "",
                        FSRXM = "超级管理员",
                        LRSJ = DateTime.Now,
                        DXNR = "乔林波老师,今天已经是月初,请尽快组织本月消防设施的巡查工作。",
                        FSSJ = DateTime.Now
                    };
                    oMes = JG.Base.Portal.Interface.Base.NewsCenter.FAddSmsForSingleToMore(sjdx.ToJson(), recCode.ToJson());
                    Hzjg.Common.Utility.Log.fWriterLog("校巡通通知短信:" + DateTime.Now.ToString("HH:mm:ss") + " 发送状态:" + oMes.Message);
                }
            }
        }

 

转载于:https://www.cnblogs.com/zecVip/p/4585984.html

你可能感兴趣的:(matlab)