}// END ThrowOnInconsistentCommands ///////////////////// protected void ThrowOnInconsistentCommands(IOrderShipGroupCommand command, IOrderItemShipGroupAssociationCommand innerCommand) { var properties = command as ICreateOrMergePatchOrRemoveOrderShipGroup; var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveOrderItemShipGroupAssociation; if (properties == null || innerProperties == null) { return; } if (innerProperties.OrderId == default(string)) { innerProperties.OrderId = properties.OrderId; } else { var outerOrderIdName = "OrderId"; var outerOrderIdValue = properties.OrderId; var innerOrderIdName = "OrderId"; var innerOrderIdValue = innerProperties.OrderId; ThrowOnInconsistentIds(innerProperties, innerOrderIdName, innerOrderIdValue, outerOrderIdName, outerOrderIdValue); } if (innerProperties.OrderShipGroupShipGroupSeqId == default(string)) { innerProperties.OrderShipGroupShipGroupSeqId = properties.ShipGroupSeqId; } else { var outerShipGroupSeqIdName = "ShipGroupSeqId"; var outerShipGroupSeqIdValue = properties.ShipGroupSeqId; var innerOrderShipGroupShipGroupSeqIdName = "OrderShipGroupShipGroupSeqId"; var innerOrderShipGroupShipGroupSeqIdValue = innerProperties.OrderShipGroupShipGroupSeqId; ThrowOnInconsistentIds(innerProperties, innerOrderShipGroupShipGroupSeqIdName, innerOrderShipGroupShipGroupSeqIdValue, outerShipGroupSeqIdName, outerShipGroupSeqIdValue); } }// END ThrowOnInconsistentCommands /////////////////////
}// END Map(IMergePatch... //////////////////////////// protected virtual IOrderShipGroupEvent Map(IOrderShipGroupCommand c, IOrderCommand outerCommand, long version, IOrderState outerState) { var create = (c.CommandType == CommandType.Create) ? (c as ICreateOrderShipGroup) : null; if (create != null) { return(MapCreate(create, outerCommand, version, outerState)); } var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchOrderShipGroup) : null; if (merge != null) { return(MapMergePatch(merge, outerCommand, version, outerState)); } var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveOrderShipGroup) : null; if (remove != null) { return(MapRemove(remove, outerCommand, version)); } throw new NotSupportedException(); }
}// END Map(IMergePatch... //////////////////////////// protected virtual IOrderItemShipGroupAssociationStateRemoved MapRemove(IRemoveOrderItemShipGroupAssociation c, IOrderShipGroupCommand outerCommand, long version) { c.RequesterId = outerCommand.RequesterId; var stateEventId = new OrderItemShipGroupAssociationEventId(c.OrderId, c.OrderShipGroupShipGroupSeqId, c.OrderItemSeqId, version); IOrderItemShipGroupAssociationStateRemoved e = NewOrderItemShipGroupAssociationStateRemoved(stateEventId); e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); return(e); }// END Map(IRemove... ////////////////////////////
}// END Map(ICreate... //////////////////////////// protected virtual IOrderItemShipGroupAssociationStateMergePatched MapMergePatch(IMergePatchOrderItemShipGroupAssociation c, IOrderShipGroupCommand outerCommand, long version, IOrderShipGroupState outerState) { c.RequesterId = outerCommand.RequesterId; var stateEventId = new OrderItemShipGroupAssociationEventId(c.OrderId, c.OrderShipGroupShipGroupSeqId, c.OrderItemSeqId, version); IOrderItemShipGroupAssociationStateMergePatched e = NewOrderItemShipGroupAssociationStateMergePatched(stateEventId); var s = outerState.OrderItemShipGroupAssociations.Get(c.OrderItemSeqId); e.Quantity = c.Quantity; e.CancelQuantity = c.CancelQuantity; e.Active = c.Active; e.IsPropertyQuantityRemoved = c.IsPropertyQuantityRemoved; e.IsPropertyCancelQuantityRemoved = c.IsPropertyCancelQuantityRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); return(e); }// END Map(IMergePatch... ////////////////////////////
void IOrderShipGroupCommands.Remove(IOrderShipGroupCommand c) { _innerCommands.Remove((CreateOrMergePatchOrRemoveOrderShipGroupDto)c); }
public void Remove(IOrderShipGroupCommand c) { _innerCommands.Remove(c); }
public void Add(IOrderShipGroupCommand c) { _innerCommands.Add(c); }