public async Task <IActionResult> Start([FromQuery] Guid sid)
        {
            var model = _db.Schedules.FirstOrDefault(x => x.Id == sid && x.Status == (int)ScheduleStatus.Stop);

            if (model != null)
            {
                await LoadPluginFile(model);

                ScheduleView view = new ScheduleView()
                {
                    Schedule = model
                };
                view.Keepers = (from t in _db.ScheduleKeepers
                                join u in _db.SystemUsers on t.UserId equals u.Id
                                where t.ScheduleId == model.Id && !string.IsNullOrEmpty(u.Email)
                                select new KeyValuePair <string, string>(u.RealName, u.Email)
                                ).ToList();
                view.Children = (from c in _db.ScheduleReferences
                                 join t in _db.Schedules on c.ChildId equals t.Id
                                 where c.ScheduleId == model.Id && c.ChildId != model.Id
                                 select new { t.Id, t.Title }
                                 ).ToDictionary(x => x.Id, x => x.Title);
                bool success = await QuartzManager.StartWithRetry(view, StartedEvent);

                if (success)
                {
                    return(Ok());
                }
            }
            return(BadRequest());
        }
示例#2
0
        public async Task <IActionResult> Start([FromQuery] Guid sid)
        {
            bool success = await QuartzManager.StartWithRetry(sid);

            if (success)
            {
                return(Ok());
            }
            return(BadRequest());
        }