public ActionResult Calculate()
        {
            ResultMessage msg = new ResultMessage();

            try
            {
                TaskDispatcher td          = new TaskDispatcher(Settings.Default.queue);
                DateTime       calculateAt = DateTime.Parse(Request.Form.Get("DateTime"));
                List <string>  shiftCodes  = null;

                if (!string.IsNullOrEmpty(Request.Form.Get("ShiftCode")))
                {
                    shiftCodes = new List <string>()
                    {
                        Request.Form.Get("ShiftCode")
                    };
                }
                ;
                //计算所选一天的
                td.SendCalculateAttMessage(calculateAt.Date, shiftCodes);


                //td.SendCalculateAttMessage(calculateAt.Date.AddDays(-2), shiftCodes);

                msg.Success = true;
                msg.Content = "计算任务新建成功,请到系统任务页面查看结果!";
            }
            catch (Exception e)
            {
                msg.Content = e.Message;
            }

            return(Json(msg));
        }
Example #2
0
        private void calTaskBtn_Click(object sender, RoutedEventArgs e)
        {
            DateTime startDateTime = DateTime.Parse(startDate.Text + " " + timeTB.Text);

            DateTime endDateTime = DateTime.Parse(endDate.Text + " " + timeTB.Text);

            TaskDispatcher dtt = new TaskDispatcher(Settings.Default.queue);

            for (DateTime dt = startDateTime; dt <= endDateTime; dt = dt.AddDays(1))
            {
                dtt.SendCalculateAttMessage(dt.Date.AddDays(-2));
            }

            MessageBox.Show("OK");
        }
Example #3
0
        public void Execute(IJobExecutionContext context)
        {
            try
            {
                LogUtil.Logger.Info(context.JobDetail.JobDataMap["dbString"].ToString());
                LogUtil.Logger.Info(context.JobDetail.JobDataMap["queuePath"].ToString());
                LogUtil.Logger.Info(context.JobDetail.JobDataMap["code"].ToString());

                TaskDispatcher td = new TaskDispatcher(context.JobDetail.JobDataMap["dbString"].ToString(),
                                                       context.JobDetail.JobDataMap["queuePath"].ToString());
                td.SendCalculateAttMessage(DateTime.Now.Date.AddDays(-1), new List <string>()
                {
                    context.JobDetail.JobDataMap["code"].ToString()
                });
            }
            catch (Exception ex)
            {
                LogUtil.Logger.Error("转正提醒任务错误!", ex);
            }
        }