예제 #1
0
        internal static TaskStoreObject FromDarTask(DarTask task, StoreObjectProvider objectProvider)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }
            if (objectProvider == null)
            {
                throw new ArgumentNullException("objectProvider");
            }
            TaskStoreObject taskStoreObject = task.WorkloadContext as TaskStoreObject;

            if (taskStoreObject == null)
            {
                taskStoreObject = objectProvider.FindByAlternativeId <TaskStoreObject>(task.Id);
                if (taskStoreObject == null)
                {
                    taskStoreObject = new TaskStoreObject();
                }
            }
            if (taskStoreObject != null)
            {
                taskStoreObject.UpdateFromDarTask(task);
            }
            return(taskStoreObject);
        }
예제 #2
0
        internal static TaskStoreObject FromExistingObject(TaskStoreObject storeObject, StoreObjectProvider objectProvider)
        {
            TaskStoreObject taskStoreObject = objectProvider.FindByAlternativeId <TaskStoreObject>(storeObject.Id);

            taskStoreObject.Id       = storeObject.Id;
            taskStoreObject.Category = storeObject.Category;
            taskStoreObject.Priority = storeObject.Priority;
            taskStoreObject.TaskSynchronizationKey    = Helper.ToDefaultString(storeObject.TaskSynchronizationKey, null);
            taskStoreObject.TaskSynchronizationOption = storeObject.TaskSynchronizationOption;
            taskStoreObject.TaskType               = Helper.ToDefaultString(storeObject.TaskType, null);
            taskStoreObject.TenantId               = storeObject.TenantId;
            taskStoreObject.TaskState              = storeObject.TaskState;
            taskStoreObject.TaskQueuedTime         = storeObject.TaskQueuedTime;
            taskStoreObject.MinTaskScheduleTime    = storeObject.MinTaskScheduleTime;
            taskStoreObject.TaskScheduledTime      = storeObject.TaskScheduledTime;
            taskStoreObject.TaskExecutionStartTime = storeObject.TaskExecutionStartTime;
            taskStoreObject.TaskCompletionTime     = storeObject.TaskCompletionTime;
            taskStoreObject.TaskRetryTotalCount    = storeObject.TaskRetryTotalCount;
            taskStoreObject.TaskRetryInterval      = storeObject.TaskRetryInterval;
            taskStoreObject.TaskRetryCurrentCount  = storeObject.TaskRetryCurrentCount;
            taskStoreObject.SerializedTaskData     = Helper.ToDefaultString(storeObject.SerializedTaskData, null);
            return(taskStoreObject);
        }