void StopJob(int schedulingId) { Log4Net.InfoLog("stop job by schedulingId=" + schedulingId); JobKey jobKey = new JobKey("job-" + schedulingId); scheduler.PauseJob(jobKey); }
public Task Execute(IJobExecutionContext context) { var data = JsonSerializerHelper.Deserialize <Data.Models.TaskScheduling>(context.JobDetail.JobDataMap.GetString("data")); Log4Net.InfoLog("run job:" + data.Id); DateTime runTime = context.FireTimeUtc.LocalDateTime; DateTime?nextRunTime = null; if (context.NextFireTimeUtc != null) { nextRunTime = context.NextFireTimeUtc.Value.LocalDateTime; } string result = ""; try { result = httpRequest.Get(data.Api, null); } catch (Exception ex) { Log4Net.ErrorLog(ex); result = ex.Message; } try { schedulingHistory.InsertHistoryAndUpdateScheduling(data.Id, data.Name, runTime, nextRunTime, result); } catch (Exception ex) { Log4Net.ErrorLog(ex); } return(Task.Delay(0)); }
static void Main(string[] args) { Log4Net.InfoLog("start..."); new Processor().StartWork(); Console.WriteLine("ok"); Console.ReadKey(); }
void StopJobByTrigger(int triggerId) { Log4Net.InfoLog("stop job by triggerId=" + triggerId); var list = new TaskSchedulingTriggerMapping().GetByTriggerId(triggerId); foreach (var item in list) { JobKey jobKey = new JobKey("job-" + item.SchedulingId); scheduler.PauseJob(jobKey); } }
public ActionResult Login(string returnUrl) { if (!returnUrl.IsNullOrEmpty()) { foreach (string key in Request.QueryString.Keys) { if (key == "returnUrl") { continue; } if (returnUrl.Contains("?")) { returnUrl += "&" + key + "=" + Request.QueryString[key]; } else { returnUrl += "?" + key + "=" + Request.QueryString[key].ToString(); } } returnUrl = HttpUtility.UrlDecode(returnUrl); } var authorization = Request.Cookies[ssoCookieKey]; if (authorization != null) //sso login { try { var userId = JwtManager.ParseAuthorization(authorization.Value, ssoSecretKey).Identity.Name; string ticket = jwtManager.GenerateTicket(userId); returnUrl = JwtAuthorizeAttribute.AppendTicket(returnUrl, ticket); if (ssoCookieTime != "session") { authorization.Expires = DateTime.Now.AddMinutes(Convert.ToInt32(ssoCookieTime)); } Response.Cookies.Add(authorization); //sso退出用 JwtAuthorizeAttribute.AddUrlToCookie(HttpContext, returnUrl); if (!string.IsNullOrEmpty(returnUrl)) { return(Redirect(returnUrl)); } } catch (Exception ex) { Log4Net.InfoLog(ex); } } return(View()); }
void StartJob(int schedulingId) { Log4Net.InfoLog("start job by schedulingId=" + schedulingId); var scheduling = taskScheduling.GetById(schedulingId); if (scheduling == null) { return; } var dict = GetTriggersAndJobs(scheduling); if (dict.Count > 0) { scheduler.ScheduleJobs(dict, true); } }
protected override void OnShutdown() { processor.EndWork().Wait(); Log4Net.InfoLog("Shutdown..."); base.OnShutdown(); }
protected override void OnStop() { processor.EndWork().Wait(); Log4Net.InfoLog("end..."); base.OnStop(); }
protected override void OnStart(string[] args) { Log4Net.InfoLog("start..."); processor.StartWork(); base.OnStart(args); }
public ActionResult WX(WxModel wxModel) { Log4Net.InfoLog(JsonSerializerHelper.Serialize(wxModel)); return(Content(wxModel.echostr)); }
public ActionResult Index() { Log4Net.InfoLog("x"); return(View()); }