Esempio n. 1
0
 private WorkStep(string path, string parentPath, int? ordinal, WorkStepType? workStepType, string workItemClass, string title, int? wipLimit)
 {
     Path = path;
     ParentPath = parentPath;
     _type = workStepType;
     _ordinal = ordinal;
     WorkItemClass = workItemClass;
     Title = title;
     WipLimit = wipLimit;
 }
        private void ThrowIfUpdatingTypeAndNotEmpty(WorkStep currentWorkStep, WorkStep workStepUpdate,
                                                    WorkStepType workStepType)
        {
            if ((currentWorkStep.Type == workStepType && workStepUpdate.Type != workStepType) ||
                (currentWorkStep.Type != workStepType && workStepUpdate.Type == workStepType))
            {
                if (WorkflowRepository.GetChildWorkSteps(workStepUpdate.Path).Count() > 0)
                {
                    throw new InvalidOperationException(
                        string.Format("Cannot update workstep type from {0} to {1} workstep when it has children",
                                      currentWorkStep.Type, workStepUpdate.Type));
                }

                if (WorkflowRepository.GetWorkItems(workStepUpdate.Path).Count() > 0)
                {
                    throw new InvalidOperationException(
                        string.Format("Cannot update workstep type from {0} to {1} when it has work items",
                                      currentWorkStep.Type, workStepUpdate.Type));
                }
            }
        }
Esempio n. 3
0
        private static bool TryLocateFirstAncestorStepOfType(this IReadableWorkStepRepository repository, WorkStep workStep, WorkStepType stepType, out WorkStep ancestorStep)
        {
            var currentPath = workStep.Path;

            do
            {
                var currentWorkStep = repository.GetWorkStep(currentPath);
                if (currentWorkStep.Type == stepType)
                {
                    ancestorStep = currentWorkStep;
                    return(true);
                }

                currentPath = currentWorkStep.ParentPath;
            }while (currentPath != WorkStep.Root.Path);

            ancestorStep = null;
            return(false);
        }
Esempio n. 4
0
 public WorkStep UpdateType(WorkStepType workStepType)
 {
     return new WorkStep(Path, ParentPath, _ordinal, workStepType, WorkItemClass, Title, WipLimit);
 }
 public static WorkStep CreateWorkStep(this IWriteableWorkStepRepository repository, string path, WorkStepType type)
 {
     var step = WorkStep.New(path).UpdateType(type);
     repository.CreateWorkStep(step);
     return step;
 }
Esempio n. 6
0
        public static WorkStep CreateWorkStep(this IWriteableWorkStepRepository repository, string path, WorkStepType type)
        {
            var step = WorkStep.New(path).UpdateType(type);

            repository.CreateWorkStep(step);
            return(step);
        }
        private static bool TryLocateFirstAncestorStepOfType(this IReadableWorkStepRepository repository, WorkStep workStep, WorkStepType stepType, out WorkStep ancestorStep)
        {
            var currentPath = workStep.Path;
            do
            {
                var currentWorkStep = repository.GetWorkStep(currentPath);
                if (currentWorkStep.Type == stepType)
                {
                    ancestorStep = currentWorkStep;
                    return true;
                }

                currentPath = currentWorkStep.ParentPath;
            }
            while (currentPath != WorkStep.Root.Path);

            ancestorStep = null;
            return false;
        }
Esempio n. 8
0
 private static void CreateWorkStep(string step, string parentPath, int ordinal, WorkStepType type, string workItemClass, string title)
 {
     var payload = string.Format("step={0},type={1},class={2},ordinal={3},title={4}", step, type, workItemClass, ordinal,title);
     new WebCommunication().SendCsvRequest("http://localhost:5555" + parentPath, "post", payload);
 }
Esempio n. 9
0
        private static void CreateWorkStep(string step, string parentPath, int ordinal, WorkStepType type, string workItemClass, string title)
        {
            var payload = string.Format("step={0},type={1},class={2},ordinal={3},title={4}", step, type, workItemClass, ordinal, title);

            new WebCommunication().SendCsvRequest("http://localhost:5555" + parentPath, "post", payload);
        }
Esempio n. 10
0
 public WorkStep UpdateType(WorkStepType workStepType)
 {
     return(new WorkStep(Path, ParentPath, _ordinal, workStepType, WorkItemClass, Title, WipLimit));
 }