using Quartz; using System; using System.Configuration; using System.Threading.Tasks; using ZJ_BYD.DB; using ZJ_BYD.Untils; namespace ZJ_BYD { public class MyJob : IJob { private static string period = ConfigurationManager.AppSettings["period"]; public Task Execute(IJobExecutionContext context) { int.TryParse(period, out int iPeriod); LogHelper.WriteLog(string.Format("于{0}触发了定时任务!", DateTime.Now)); var beginTime = $"{DateTime.Now.AddYears(iPeriod * -1):yyyy-MM-dd} 00:00:00"; ResultHelper.DelResult(DateTime.Parse(beginTime)); MskCodeHelper.delPrintInfo(); return null; } } }