Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public PublicResult CreateScheduleTask(CreateScheduleTaskDto dto)
        {
            using (var client = DbFactory.CreateClient())
            {
                var scheduleTask = new ScheduleTask
                {
                    Name            = dto.Name,
                    Status          = TaskRunningStatus.Pending,
                    StatusDesc      = "",
                    JobKey          = Guid.NewGuid().ToString("N"),
                    JobGroup        = Guid.NewGuid().ToString("N"),
                    TriggerKey      = Guid.NewGuid().ToString("N"),
                    TriggerGroup    = Guid.NewGuid().ToString("N"),
                    IsEnable        = false,
                    Type            = dto.Type,
                    Cron            = dto.Cron,
                    Interval        = null,
                    LastStartTime   = null,
                    LastEndTime     = null,
                    LastSuccessTime = null
                };
                scheduleTask.Id = client.Insertable(scheduleTask).ExecuteReturnBigIdentity();

                _eventPublisher.EntityCreated(scheduleTask);

                return(Ok());
            }
        }
Exemplo n.º 2
0
        public IActionResult Create(CreateScheduleTaskDto dto)
        {
            var result = _scheduleTaskService.CreateScheduleTask(dto);

            return(Json(result));
        }