Example #1
0
        public static Task Create(string taskName, ServiceProfile svcProfile, string configPrefix = null)
        {
            var container = new UnityFactory(taskName);

            var task = container.Create <ITask>() as Task;

            task.UnityFactory = container;

            task.ServiceProfile = svcProfile;
            task.Name           = taskName;
            task.FullName       = string.Format("{0}.{1}", task.Name, task.ActivityName);

            task.Profile = new TaskProfile(task, configPrefix);

            return(task);
        }
Example #2
0
        public TaskProfile(Task task, string configPrefix = null)
        {
            Task            = task;
            task.Profile    = this;
            _serviceProfile = task.ServiceProfile;

            StopTaskTimeout = TimeSpan.FromSeconds(45);
            Schedule        = new Scheduler();

            ConfigPrefix = configPrefix ?? task.Name;

            var settings = new TaskSettings(task);
            var value    = settings.GetValue(Config.Repeat);

            Schedule.Repeat = bool.Parse(value);

            value = settings.GetValue(Config.RepeatInterval);
            var interval = int.Parse(value);

            Schedule.RepeatInterval = TimeSpan.FromMinutes(interval);
        }
Example #3
0
 public string LogErrorDetail(string detail, string message, params object[] parms)
 {
     return(ServiceProfile.LogMessageDetail(ExternalSystem.Id, EventLogEntryType.Error, detail, string.Format("Error: {0} task {1}", FullName, message), parms));
 }
Example #4
0
 public string LogException(Exception e, string message, params object[] parms)
 {
     return(ServiceProfile.LogException(ExternalSystem.Id, e, string.Format("Exception: {0} task {1}", FullName, message), parms));
 }
Example #5
0
 public string LogWarning(string message, params object[] parms)
 {
     return(ServiceProfile.LogMessage(ExternalSystem.Id, EventLogEntryType.Warning, string.Empty, string.Format("Warning: {0} task {1}", FullName, message), parms));
 }