예제 #1
0
        void StopJob(int schedulingId)
        {
            Log4Net.InfoLog("stop job by schedulingId=" + schedulingId);
            JobKey jobKey = new JobKey("job-" + schedulingId);

            scheduler.PauseJob(jobKey);
        }
예제 #2
0
        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));
        }
예제 #3
0
        static void Main(string[] args)
        {
            Log4Net.InfoLog("start...");
            new Processor().StartWork();

            Console.WriteLine("ok");
            Console.ReadKey();
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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());
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
 protected override void OnShutdown()
 {
     processor.EndWork().Wait();
     Log4Net.InfoLog("Shutdown...");
     base.OnShutdown();
 }
예제 #8
0
 protected override void OnStop()
 {
     processor.EndWork().Wait();
     Log4Net.InfoLog("end...");
     base.OnStop();
 }
예제 #9
0
 protected override void OnStart(string[] args)
 {
     Log4Net.InfoLog("start...");
     processor.StartWork();
     base.OnStart(args);
 }
예제 #10
0
        public ActionResult WX(WxModel wxModel)
        {
            Log4Net.InfoLog(JsonSerializerHelper.Serialize(wxModel));

            return(Content(wxModel.echostr));
        }
예제 #11
0
 public ActionResult Index()
 {
     Log4Net.InfoLog("x");
     return(View());
 }