Example #1
0
        /// <summary>
        /// Update scheduler
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <param name="lastRunTime"></param>
        /// <param name="nextRunTime"></param>
        /// <param name="expiredTime"></param>
        /// <returns></returns>
        public static Scheduler Update(int id, SchedulerStatus status, DateTime?lastRunTime, DateTime?nextRunTime, DateTime?expiredTime)
        {
            var scheduler = GetById(id);

            if (scheduler == null)
            {
                return(null);
            }
            scheduler.Status = status;
            if (lastRunTime != null)
            {
                scheduler.LastRunTime = lastRunTime;
            }
            if (nextRunTime != null)
            {
                scheduler.NextRunTime = nextRunTime;
            }
            if (expiredTime != null)
            {
                scheduler.ExpiredTime = expiredTime;
            }
            Update(scheduler);

            return(scheduler);
        }
Example #2
0
        /// <summary>
        /// Update scheduler
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="type"></param>
        /// <param name="args"></param>
        /// <param name="repeatType"></param>
        /// <param name="intervalTime"></param>
        /// <param name="expiredAfter"></param>
        /// <param name="status"></param>
        /// <param name="enabled"></param>
        /// <param name="scope"></param>
        /// <param name="lastRunTime"></param>
        /// <param name="nextRunTime"></param>
        /// <param name="expiredTime"></param>
        /// <returns></returns>
        public static Scheduler Update(int id, string name, string description, int type, string args, SchedulerRepeatType repeatType,
                                       int intervalTime, int expiredAfter, SchedulerStatus status, bool enabled, SchedulerScope scope, DateTime?lastRunTime, DateTime?nextRunTime, DateTime?expiredTime)
        {
            // get data from db
            var scheduler = GetById(id);

            // has valid data
            if (scheduler == null)
            {
                return(null);
            }
            // set new value
            scheduler.Name            = name;
            scheduler.Description     = description;
            scheduler.SchedulerTypeId = type;
            scheduler.Arguments       = args;
            scheduler.RepeatType      = repeatType;
            scheduler.IntervalTime    = intervalTime;
            scheduler.ExpiredAfter    = expiredAfter;
            scheduler.Status          = status;
            scheduler.Enabled         = enabled;
            scheduler.Scope           = scope;
            scheduler.LastRunTime     = lastRunTime;
            scheduler.NextRunTime     = nextRunTime;
            scheduler.ExpiredTime     = expiredTime;
            // update
            Update(scheduler);
            // return
            return(scheduler);
        }
 /// <summary>
 /// Shuts down the scheduler.
 /// </summary>
 public void ShutDown()
 {
     lock (_syncObject)
     {
         InternalPauseAll();
         _status = SchedulerStatus.Shutdown;
     }
 }
Example #4
0
        /// <summary>
        /// retorna el id en ACP de un proyecto.
        /// </summary>
        /// <param name="projectName">Nombre del proyecto</param>
        /// <returns>id segun ACP</returns>
        private int getProjectId(String projectName)
        {
            SchedulerStatus rtmlPost;

            rtmlPost = new SchedulerStatus(projectName);
            rtmlPost.readStatus();
            return(rtmlPost.ProjectID);
        }
Example #5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SchedulerStatus schedulerStatus = (SchedulerStatus)value;

            if (schedulerStatus == SchedulerStatus.Enabled)
            {
                return(true);
            }
            return(false);
        }
        public SchedulerStatus GetSchedulerStatus(int schId)
        {
            SchedulerStatus result    = SchedulerStatus.None;
            var             scheduler = schedulers.FirstOrDefault(t => t.SchedulerId == schId);

            if (scheduler != null)
            {
                result = scheduler.Status;
            }
            return(result);
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected MarkupString FormatterStatus(SchedulerStatus status)
        {
            var content = status switch
            {
                SchedulerStatus.Ready => ("info", "fa", "未开始"),
                SchedulerStatus.Running => ("success", "play-circle", "运行中"),
                SchedulerStatus.Disabled => ("danger", "times-circle", "已停止"),
                _ => ("info", "fa", "未設置")
            };

            return(new MarkupString($"<button class=\"btn btn-sm btn-{content.Item1}\"><i class=\"fa fa-{content.Item2}\"></i><span>{content.Item3}<span></button>"));
        }
Example #8
0
 protected void UpdateStatus(SchedulerStatus status)
 {
     Log.Debug($"Scheduler UpdateStatus {status}");
     lock (_threadLock) {
         var oldStatus = Status;
         if (oldStatus != status)
         {
             Status = status;
             ExecuteSafely(() => StatusChanged?.Invoke(oldStatus, Status));
         }
     }
 }
Example #9
0
        public ScheduledResource(string name, SchedulerStatus status, DateTime nextRunDate, IScheduleTrigger trigger, string workflowName)
        {

            var history = name.Split('~');

            WorkflowName = workflowName;
            Trigger = trigger;

            NextRunDate = nextRunDate;
            Status = status;
            Name = history.First();
            if(history.Length == 2)
                NumberOfHistoryToKeep = int.Parse(history[1]);
            IsDirty = false;
            _errors = new ErrorResultTO();
        }
Example #10
0
        public ScheduledResource(string name, SchedulerStatus status, DateTime nextRunDate, IScheduleTrigger trigger, string workflowName)
        {
            var history = name.Split('~');

            WorkflowName = workflowName;
            Trigger      = trigger;

            NextRunDate = nextRunDate;
            Status      = status;
            Name        = history.First();
            if (history.Length == 2)
            {
                NumberOfHistoryToKeep = int.Parse(history[1]);
            }
            IsDirty = false;
            _errors = new ErrorResultTO();
        }
Example #11
0
        /// <summary>
        /// Update scheduler
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static Scheduler Update(int id, SchedulerStatus status)
        {
            // get data from db
            var scheduler = GetById(id);

            // has valid data
            if (scheduler == null)
            {
                return(null);
            }
            // set new value
            scheduler.Status = status;
            // update
            Update(scheduler);
            // return
            return(scheduler);
        }
Example #12
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string          isEnabledRadioButton = parameter as string;
            SchedulerStatus schedulerStatus      = (SchedulerStatus)value;

            if (isEnabledRadioButton == "true")
            {
                if (schedulerStatus == SchedulerStatus.Enabled)
                {
                    return(true);
                }
                return(false);
            }
            if (schedulerStatus == SchedulerStatus.Disabled)
            {
                return(true);
            }
            return(false);
        }
Example #13
0
        /// <summary>
        /// Create Scheduler
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="type"></param>
        /// <param name="repeatType"></param>
        /// <param name="intervalTime"></param>
        /// <param name="expiredAfter"></param>
        /// <param name="status"></param>
        /// <param name="enabled"></param>
        /// <param name="scope"></param>
        /// <param name="lastRunTime"></param>
        /// <param name="nextRunTime"></param>
        /// <param name="expiredTime"></param>
        /// <param name="arguments"></param>
        /// <returns></returns>
        public static Scheduler Create(string name, string description, int type, SchedulerRepeatType repeatType,
                                       int intervalTime, int expiredAfter, SchedulerStatus status, bool enabled, SchedulerScope scope,
                                       DateTime?lastRunTime, DateTime?nextRunTime, DateTime?expiredTime, string arguments)
        {
            var obj = new Scheduler
            {
                Name            = name,
                Description     = description,
                SchedulerTypeId = type,
                RepeatType      = repeatType,
                IntervalTime    = intervalTime,
                Status          = status,
                Enabled         = enabled,
                Scope           = scope,
                ExpiredAfter    = expiredAfter,
                LastRunTime     = lastRunTime,
                NextRunTime     = nextRunTime,
                ExpiredTime     = expiredTime,
                Arguments       = arguments
            };

            return(Create(obj));
        }
 /// <summary>
 /// Default initialization.
 /// </summary>
 public SchedulerService()
 {
     _tasks  = new OrderedDictionary();
     _status = SchedulerStatus.Started;
 }
 public void Pause()
 {
     if (Status == SchedulerStatus.Running)
     {
         Status = SchedulerStatus.Paused;
     }
 }
 public void Resume()
 {
     if (Status == SchedulerStatus.Paused)
     {
         Status = SchedulerStatus.Running;
     }
 }
 public void Run()
 {
     if (Status == SchedulerStatus.Pending)
     {
         Status = SchedulerStatus.Running;
         _worker.RunWorkerAsync();
     }
 }
 public IScheduledResource CreateResource(string name, SchedulerStatus status, Trigger trigger,
                                          string workflowName)
 {
     return new ScheduledResource(name, status, DateTime.MinValue, CreateTrigger(trigger), workflowName);
 }
Example #19
0
 public IScheduledResource CreateResource(string name, SchedulerStatus status, Trigger trigger,
                                          string workflowName)
 {
     return(new ScheduledResource(name, status, DateTime.MinValue, CreateTrigger(trigger), workflowName));
 }