Exemple #1
0
        public ExecuteCommandReOrderAggregateContainer(IActivateItems activator, CohortAggregateContainerCombineable sourceCohortAggregateContainerCombineable, AggregateConfiguration targetAggregate, InsertOption insertOption) : this(activator, targetAggregate, insertOption)
        {
            _sourceCohortAggregateContainerCombineable = sourceCohortAggregateContainerCombineable;
            _targetParent = targetAggregate.GetCohortAggregateContainerIfAny();

            //if they do not share the same parent container
            if (!_sourceCohortAggregateContainerCombineable.ParentContainerIfAny.Equals(_targetParent))
            {
                SetImpossible("First move objects into the same parent container");
            }
        }
        public ExecuteCommandMoveCohortAggregateContainerIntoSubContainer(IBasicActivateItems activator, CohortAggregateContainerCombineable sourceCohortAggregateContainer, CohortAggregateContainer targetCohortAggregateContainer) : base(activator)
        {
            _sourceCohortAggregateContainer = sourceCohortAggregateContainer;
            _targetCohortAggregateContainer = targetCohortAggregateContainer;

            if (_sourceCohortAggregateContainer.AllSubContainersRecursively.Contains(_targetCohortAggregateContainer))
            {
                SetImpossible("Cannot move a container into one of it's own subcontainers");
            }

            if (_sourceCohortAggregateContainer.AggregateContainer.Equals(_targetCohortAggregateContainer))
            {
                SetImpossible("Cannot move a container into itself");
            }
        }
        public ExecuteCommandReOrderAggregateContainer(IActivateItems activator, CohortAggregateContainerCombineable sourceCohortAggregateContainerCombineable, CohortAggregateContainer targetCohortAggregateContainer, InsertOption insertOption) : this(activator, targetCohortAggregateContainer, insertOption)
        {
            _sourceCohortAggregateContainerCombineable = sourceCohortAggregateContainerCombineable;

            _targetParent = targetCohortAggregateContainer.GetParentContainerIfAny();

            //reorder is only possible within a container
            if (!_sourceCohortAggregateContainerCombineable.ParentContainerIfAny.Equals(_targetParent))
            {
                SetImpossible("First move containers to share the same parent container");
            }

            if (_insertOption == InsertOption.Default)
            {
                SetImpossible("Insert must be above/below");
            }
        }