예제 #1
0
        public IScheduleItem GetScheduleItem(String scheduleId)
        {
            Schedule schedule = _scheduleDataAccess.Get(scheduleId);

            if (schedule != null)
            {
                if (schedule.ScheduleItemType == ItemType.Sequence)
                {
                    Sequence sequence = _sequenceDataAccess.Get(schedule.ScheduleItemId);

                    return(new SequenceScheduleItem(schedule, sequence));
                }
                else if (schedule.ScheduleItemType == ItemType.Script)
                {
                    Script script = _scriptDataAccess.Get(schedule.ScheduleItemId);

                    return(new ScriptScheduleItem(schedule, script));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                _log.Info("GetAllSchedulesItems(" + scheduleId + "): Unable to find schedule");

                return(null);
            }
        }
        public Task InsertSequenceTask(long sequenceId)
        {
            Sequence sequence = _sequenceDataAccess.Get(sequenceId);

            if (sequence != null)
            {
                Task task = new Task();
                task.ExternalId = System.Guid.NewGuid().ToString();
                task.Project    = sequence.Project;
                task.ParentId   = sequence.ID;
                task.ParentType = ItemType.Sequence;
                task.Name       = sequence.Name;
                task.Status     = Status.Unprocessed;
                task.Created    = DateTime.UtcNow;

                task = _taskDataAccess.Insert(task);

                foreach (SequenceScript sequenceScript in sequence.SequenceScripts)
                {
                    TaskScript taskScript = new TaskScript();
                    taskScript.Task    = task;
                    taskScript.Content = sequenceScript.Content;

                    _taskScriptDataAccess.Insert(taskScript);
                }

                return(task);
            }
            else
            {
                _log.Info("InsertSequenceTask(" + sequenceId + "): Unable to find script");

                return(null);
            }
        }
예제 #3
0
 public Sequence GetSequence(String sequenceId)
 {
     return(_sequenceDataAccess.Get(sequenceId));
 }