Esempio n. 1
0
        protected void ThrowOnInconsistentCommands(IShipmentPackageCommand command, IShipmentPackageContentCommand innerCommand)
        {
            var properties      = command as ICreateOrMergePatchOrDeleteShipmentPackage;
            var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveShipmentPackageContent;

            if (properties == null || innerProperties == null)
            {
                return;
            }
            if (innerProperties.ShipmentPackageId == default(ShipmentPackageId))
            {
                innerProperties.ShipmentPackageId = properties.ShipmentPackageId;
            }
            else
            {
                var outerShipmentPackageIdName  = "ShipmentPackageId";
                var outerShipmentPackageIdValue = properties.ShipmentPackageId;
                var innerShipmentPackageIdName  = "ShipmentPackageId";
                var innerShipmentPackageIdValue = innerProperties.ShipmentPackageId;
                ThrowOnInconsistentIds(innerProperties, innerShipmentPackageIdName, innerShipmentPackageIdValue, outerShipmentPackageIdName, outerShipmentPackageIdValue);
            }
        }// END ThrowOnInconsistentCommands /////////////////////
Esempio n. 2
0
        }// END ThrowOnInconsistentCommands /////////////////////

        protected virtual IShipmentPackageContentEvent Map(IShipmentPackageContentCommand c, IShipmentPackageCommand outerCommand, long version, IShipmentPackageState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateShipmentPackageContent) : null;

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

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

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

            var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveShipmentPackageContent) : null;

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
Esempio n. 3
0
 void IShipmentPackageContentCommands.Remove(IShipmentPackageContentCommand c)
 {
     _innerCommands.Remove((CreateOrMergePatchOrRemoveShipmentPackageContentDto)c);
 }
Esempio n. 4
0
 public void Remove(IShipmentPackageContentCommand c)
 {
     _innerCommands.Remove(c);
 }
Esempio n. 5
0
 public void Add(IShipmentPackageContentCommand c)
 {
     _innerCommands.Add(c);
 }