예제 #1
0
        }// END Map(IRemove... ////////////////////////////

        protected virtual IShipmentItemEvent Map(IShipmentItemCommand c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateShipmentItem) : null;

            if (create != null)
            {
                return(MapCreate(create, outerCommand, version, outerState));
            }

            var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchShipmentItem) : null;

            if (merge != null)
            {
                return(MapMergePatch(merge, outerCommand, version, outerState));
            }

            throw new NotSupportedException();
        }
예제 #2
0
        }// END ThrowOnInconsistentCommands /////////////////////

        protected void ThrowOnInconsistentCommands(IShipmentCommand command, IShipmentItemCommand innerCommand)
        {
            var properties      = command as ICreateOrMergePatchOrDeleteShipment;
            var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveShipmentItem;

            if (properties == null || innerProperties == null)
            {
                return;
            }
            if (innerProperties.ShipmentId == default(string))
            {
                innerProperties.ShipmentId = properties.ShipmentId;
            }
            else
            {
                var outerShipmentIdName  = "ShipmentId";
                var outerShipmentIdValue = properties.ShipmentId;
                var innerShipmentIdName  = "ShipmentId";
                var innerShipmentIdValue = innerProperties.ShipmentId;
                ThrowOnInconsistentIds(innerProperties, innerShipmentIdName, innerShipmentIdValue, outerShipmentIdName, outerShipmentIdValue);
            }
        }// END ThrowOnInconsistentCommands /////////////////////
예제 #3
0
 public void Remove(IShipmentItemCommand c)
 {
     _innerCommands.Remove(c);
 }
예제 #4
0
 public void Add(IShipmentItemCommand c)
 {
     _innerCommands.Add(c);
 }
예제 #5
0
 void IShipmentItemCommands.Remove(IShipmentItemCommand c)
 {
     _innerCommands.Remove((CreateOrMergePatchOrRemoveShipmentItemDto)c);
 }