县级12345后端

CheckPointWork.cs 955B

123456789101112131415161718192021222324252627282930
  1. using CallCenterApi.DB;
  2. using Quartz;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace CallCenter.QuartzService
  9. {
  10. public class CheckPointWork : QuartzJob
  11. {
  12. public CheckPointWork()
  13. {
  14. CronExpression = "0 0 0 5 * ?";//每月5号执行
  15. DoWork += MyWork_DoWork;
  16. }
  17. private void MyWork_DoWork(object sender, EventArgs e)
  18. {
  19. DateTime now = DateTime.Now.AddMonths(-1);
  20. DateTime stime = new DateTime(now.Year, now.Month, 1);
  21. DateTime etime = stime.AddMonths(1).AddDays(-1);
  22. Dictionary<string, string> paras = new Dictionary<string, string>();
  23. paras.Add("@sdate", stime.ToString("yyyy-MM-dd"));
  24. paras.Add("@edate", etime.ToString("yyyy-MM-dd"));
  25. DbHelperSQL.ExecuteSql("exec P_CheckPoint @sdate,@edate", paras);
  26. }
  27. }
  28. }