using CallCenterApi.DB;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CallCenter.QuartzService
{
    public class CheckPointWork : QuartzJob
    {
        public CheckPointWork()
        {
            CronExpression = "0 0 0 5 * ?";//每月5号执行
            DoWork += MyWork_DoWork;
        }
        private void MyWork_DoWork(object sender, EventArgs e)
        {
            DateTime now = DateTime.Now.AddMonths(-1);
            DateTime stime = new DateTime(now.Year, now.Month, 1);
            DateTime etime = stime.AddMonths(1).AddDays(-1);
            Dictionary<string, string> paras = new Dictionary<string, string>();
            paras.Add("@sdate", stime.ToString("yyyy-MM-dd"));
            paras.Add("@edate", etime.ToString("yyyy-MM-dd"));
            DbHelperSQL.ExecuteSql("exec P_CheckPoint @sdate,@edate", paras);
        }
    }
}
