public virtual void When(IShipmentStateMergePatched e) { ThrowOnWrongEvent(e); if (e.ShipmentTypeId == null) { if (e.IsPropertyShipmentTypeIdRemoved) { this.ShipmentTypeId = default(string); } } else { this.ShipmentTypeId = e.ShipmentTypeId; } if (e.StatusId == null) { if (e.IsPropertyStatusIdRemoved) { this.StatusId = default(string); } } else { this.StatusId = e.StatusId; } if (e.PrimaryOrderId == null) { if (e.IsPropertyPrimaryOrderIdRemoved) { this.PrimaryOrderId = default(string); } } else { this.PrimaryOrderId = e.PrimaryOrderId; } if (e.PrimaryReturnId == null) { if (e.IsPropertyPrimaryReturnIdRemoved) { this.PrimaryReturnId = default(string); } } else { this.PrimaryReturnId = e.PrimaryReturnId; } if (e.PrimaryShipGroupSeqId == null) { if (e.IsPropertyPrimaryShipGroupSeqIdRemoved) { this.PrimaryShipGroupSeqId = default(string); } } else { this.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId; } if (e.PicklistBinId == null) { if (e.IsPropertyPicklistBinIdRemoved) { this.PicklistBinId = default(string); } } else { this.PicklistBinId = e.PicklistBinId; } if (e.BolNumber == null) { if (e.IsPropertyBolNumberRemoved) { this.BolNumber = default(string); } } else { this.BolNumber = e.BolNumber; } if (e.SealNumber == null) { if (e.IsPropertySealNumberRemoved) { this.SealNumber = default(string); } } else { this.SealNumber = e.SealNumber; } if (e.VehicleId == null) { if (e.IsPropertyVehicleIdRemoved) { this.VehicleId = default(string); } } else { this.VehicleId = e.VehicleId; } if (e.ExternalOrderNumber == null) { if (e.IsPropertyExternalOrderNumberRemoved) { this.ExternalOrderNumber = default(string); } } else { this.ExternalOrderNumber = e.ExternalOrderNumber; } if (e.Carrier == null) { if (e.IsPropertyCarrierRemoved) { this.Carrier = default(string); } } else { this.Carrier = e.Carrier; } if (e.DateShipped == null) { if (e.IsPropertyDateShippedRemoved) { this.DateShipped = default(DateTime?); } } else { this.DateShipped = e.DateShipped; } if (e.EstimatedReadyDate == null) { if (e.IsPropertyEstimatedReadyDateRemoved) { this.EstimatedReadyDate = default(DateTime?); } } else { this.EstimatedReadyDate = e.EstimatedReadyDate; } if (e.EstimatedShipDate == null) { if (e.IsPropertyEstimatedShipDateRemoved) { this.EstimatedShipDate = default(DateTime?); } } else { this.EstimatedShipDate = e.EstimatedShipDate; } if (e.EstimatedShipWorkEffId == null) { if (e.IsPropertyEstimatedShipWorkEffIdRemoved) { this.EstimatedShipWorkEffId = default(string); } } else { this.EstimatedShipWorkEffId = e.EstimatedShipWorkEffId; } if (e.EstimatedArrivalDate == null) { if (e.IsPropertyEstimatedArrivalDateRemoved) { this.EstimatedArrivalDate = default(DateTime?); } } else { this.EstimatedArrivalDate = e.EstimatedArrivalDate; } if (e.EstimatedArrivalWorkEffId == null) { if (e.IsPropertyEstimatedArrivalWorkEffIdRemoved) { this.EstimatedArrivalWorkEffId = default(string); } } else { this.EstimatedArrivalWorkEffId = e.EstimatedArrivalWorkEffId; } if (e.LatestCancelDate == null) { if (e.IsPropertyLatestCancelDateRemoved) { this.LatestCancelDate = default(DateTime?); } } else { this.LatestCancelDate = e.LatestCancelDate; } if (e.EstimatedShipCost == null) { if (e.IsPropertyEstimatedShipCostRemoved) { this.EstimatedShipCost = default(decimal?); } } else { this.EstimatedShipCost = e.EstimatedShipCost; } if (e.CurrencyUomId == null) { if (e.IsPropertyCurrencyUomIdRemoved) { this.CurrencyUomId = default(string); } } else { this.CurrencyUomId = e.CurrencyUomId; } if (e.HandlingInstructions == null) { if (e.IsPropertyHandlingInstructionsRemoved) { this.HandlingInstructions = default(string); } } else { this.HandlingInstructions = e.HandlingInstructions; } if (e.OriginFacilityId == null) { if (e.IsPropertyOriginFacilityIdRemoved) { this.OriginFacilityId = default(string); } } else { this.OriginFacilityId = e.OriginFacilityId; } if (e.DestinationFacilityId == null) { if (e.IsPropertyDestinationFacilityIdRemoved) { this.DestinationFacilityId = default(string); } } else { this.DestinationFacilityId = e.DestinationFacilityId; } if (e.OriginContactMechId == null) { if (e.IsPropertyOriginContactMechIdRemoved) { this.OriginContactMechId = default(string); } } else { this.OriginContactMechId = e.OriginContactMechId; } if (e.OriginTelecomNumberId == null) { if (e.IsPropertyOriginTelecomNumberIdRemoved) { this.OriginTelecomNumberId = default(string); } } else { this.OriginTelecomNumberId = e.OriginTelecomNumberId; } if (e.DestinationContactMechId == null) { if (e.IsPropertyDestinationContactMechIdRemoved) { this.DestinationContactMechId = default(string); } } else { this.DestinationContactMechId = e.DestinationContactMechId; } if (e.DestinationTelecomNumberId == null) { if (e.IsPropertyDestinationTelecomNumberIdRemoved) { this.DestinationTelecomNumberId = default(string); } } else { this.DestinationTelecomNumberId = e.DestinationTelecomNumberId; } if (e.PartyIdTo == null) { if (e.IsPropertyPartyIdToRemoved) { this.PartyIdTo = default(string); } } else { this.PartyIdTo = e.PartyIdTo; } if (e.PartyIdFrom == null) { if (e.IsPropertyPartyIdFromRemoved) { this.PartyIdFrom = default(string); } } else { this.PartyIdFrom = e.PartyIdFrom; } if (e.AdditionalShippingCharge == null) { if (e.IsPropertyAdditionalShippingChargeRemoved) { this.AdditionalShippingCharge = default(decimal?); } } else { this.AdditionalShippingCharge = e.AdditionalShippingCharge; } if (e.AddtlShippingChargeDesc == null) { if (e.IsPropertyAddtlShippingChargeDescRemoved) { this.AddtlShippingChargeDesc = default(string); } } else { this.AddtlShippingChargeDesc = e.AddtlShippingChargeDesc; } if (e.Active == null) { if (e.IsPropertyActiveRemoved) { this.Active = default(bool); } } else { this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); } this.UpdatedBy = e.CreatedBy; this.UpdatedAt = e.CreatedAt; foreach (IShipmentImageEvent innerEvent in e.ShipmentImageEvents) { IShipmentImageState innerState = this.ShipmentImages.Get(innerEvent.GlobalId.SequenceId); innerState.Mutate(innerEvent); var removed = innerEvent as IShipmentImageStateRemoved; if (removed != null) { this.ShipmentImages.Remove(innerState); } } foreach (IShipmentItemEvent innerEvent in e.ShipmentItemEvents) { IShipmentItemState innerState = this.ShipmentItems.Get(innerEvent.GlobalId.ShipmentItemSeqId); innerState.Mutate(innerEvent); } foreach (IShipmentReceiptEvent innerEvent in e.ShipmentReceiptEvents) { IShipmentReceiptState innerState = this.ShipmentReceipts.Get(innerEvent.GlobalId.ReceiptSeqId); innerState.Mutate(innerEvent); } foreach (IItemIssuanceEvent innerEvent in e.ItemIssuanceEvents) { IItemIssuanceState innerState = this.ItemIssuances.Get(innerEvent.GlobalId.ItemIssuanceSeqId); innerState.Mutate(innerEvent); var removed = innerEvent as IItemIssuanceStateRemoved; if (removed != null) { this.ItemIssuances.Remove(innerState); } } }
public virtual ShipmentStateMergePatchedDto ToShipmentStateMergePatchedDto(IShipmentStateMergePatched e) { var dto = new ShipmentStateMergePatchedDto(); dto.ShipmentEventId = e.ShipmentEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.ShipmentTypeId = e.ShipmentTypeId; dto.StatusId = e.StatusId; dto.PrimaryOrderId = e.PrimaryOrderId; dto.PrimaryReturnId = e.PrimaryReturnId; dto.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId; dto.PicklistBinId = e.PicklistBinId; dto.BolNumber = e.BolNumber; dto.SealNumber = e.SealNumber; dto.VehicleId = e.VehicleId; dto.ExternalOrderNumber = e.ExternalOrderNumber; dto.Carrier = e.Carrier; dto.DateShipped = e.DateShipped; dto.EstimatedReadyDate = e.EstimatedReadyDate; dto.EstimatedShipDate = e.EstimatedShipDate; dto.EstimatedShipWorkEffId = e.EstimatedShipWorkEffId; dto.EstimatedArrivalDate = e.EstimatedArrivalDate; dto.EstimatedArrivalWorkEffId = e.EstimatedArrivalWorkEffId; dto.LatestCancelDate = e.LatestCancelDate; dto.EstimatedShipCost = e.EstimatedShipCost; dto.CurrencyUomId = e.CurrencyUomId; dto.HandlingInstructions = e.HandlingInstructions; dto.OriginFacilityId = e.OriginFacilityId; dto.DestinationFacilityId = e.DestinationFacilityId; dto.OriginContactMechId = e.OriginContactMechId; dto.OriginTelecomNumberId = e.OriginTelecomNumberId; dto.DestinationContactMechId = e.DestinationContactMechId; dto.DestinationTelecomNumberId = e.DestinationTelecomNumberId; dto.PartyIdTo = e.PartyIdTo; dto.PartyIdFrom = e.PartyIdFrom; dto.AdditionalShippingCharge = e.AdditionalShippingCharge; dto.AddtlShippingChargeDesc = e.AddtlShippingChargeDesc; dto.Active = e.Active; dto.IsPropertyShipmentTypeIdRemoved = e.IsPropertyShipmentTypeIdRemoved; dto.IsPropertyStatusIdRemoved = e.IsPropertyStatusIdRemoved; dto.IsPropertyPrimaryOrderIdRemoved = e.IsPropertyPrimaryOrderIdRemoved; dto.IsPropertyPrimaryReturnIdRemoved = e.IsPropertyPrimaryReturnIdRemoved; dto.IsPropertyPrimaryShipGroupSeqIdRemoved = e.IsPropertyPrimaryShipGroupSeqIdRemoved; dto.IsPropertyPicklistBinIdRemoved = e.IsPropertyPicklistBinIdRemoved; dto.IsPropertyBolNumberRemoved = e.IsPropertyBolNumberRemoved; dto.IsPropertySealNumberRemoved = e.IsPropertySealNumberRemoved; dto.IsPropertyVehicleIdRemoved = e.IsPropertyVehicleIdRemoved; dto.IsPropertyExternalOrderNumberRemoved = e.IsPropertyExternalOrderNumberRemoved; dto.IsPropertyCarrierRemoved = e.IsPropertyCarrierRemoved; dto.IsPropertyDateShippedRemoved = e.IsPropertyDateShippedRemoved; dto.IsPropertyEstimatedReadyDateRemoved = e.IsPropertyEstimatedReadyDateRemoved; dto.IsPropertyEstimatedShipDateRemoved = e.IsPropertyEstimatedShipDateRemoved; dto.IsPropertyEstimatedShipWorkEffIdRemoved = e.IsPropertyEstimatedShipWorkEffIdRemoved; dto.IsPropertyEstimatedArrivalDateRemoved = e.IsPropertyEstimatedArrivalDateRemoved; dto.IsPropertyEstimatedArrivalWorkEffIdRemoved = e.IsPropertyEstimatedArrivalWorkEffIdRemoved; dto.IsPropertyLatestCancelDateRemoved = e.IsPropertyLatestCancelDateRemoved; dto.IsPropertyEstimatedShipCostRemoved = e.IsPropertyEstimatedShipCostRemoved; dto.IsPropertyCurrencyUomIdRemoved = e.IsPropertyCurrencyUomIdRemoved; dto.IsPropertyHandlingInstructionsRemoved = e.IsPropertyHandlingInstructionsRemoved; dto.IsPropertyOriginFacilityIdRemoved = e.IsPropertyOriginFacilityIdRemoved; dto.IsPropertyDestinationFacilityIdRemoved = e.IsPropertyDestinationFacilityIdRemoved; dto.IsPropertyOriginContactMechIdRemoved = e.IsPropertyOriginContactMechIdRemoved; dto.IsPropertyOriginTelecomNumberIdRemoved = e.IsPropertyOriginTelecomNumberIdRemoved; dto.IsPropertyDestinationContactMechIdRemoved = e.IsPropertyDestinationContactMechIdRemoved; dto.IsPropertyDestinationTelecomNumberIdRemoved = e.IsPropertyDestinationTelecomNumberIdRemoved; dto.IsPropertyPartyIdToRemoved = e.IsPropertyPartyIdToRemoved; dto.IsPropertyPartyIdFromRemoved = e.IsPropertyPartyIdFromRemoved; dto.IsPropertyAdditionalShippingChargeRemoved = e.IsPropertyAdditionalShippingChargeRemoved; dto.IsPropertyAddtlShippingChargeDescRemoved = e.IsPropertyAddtlShippingChargeDescRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; var shipmentImageEvents = new List <ShipmentImageStateCreatedOrMergePatchedOrRemovedDto>(); foreach (var ee in e.ShipmentImageEvents) { ShipmentImageStateCreatedOrMergePatchedOrRemovedDto eeDto = ShipmentImageStateEventDtoConverter.ToShipmentImageStateEventDto(ee); shipmentImageEvents.Add(eeDto); } dto.ShipmentImageEvents = shipmentImageEvents.ToArray(); var shipmentItemEvents = new List <ShipmentItemStateCreatedOrMergePatchedOrRemovedDto>(); foreach (var ee in e.ShipmentItemEvents) { ShipmentItemStateCreatedOrMergePatchedOrRemovedDto eeDto = ShipmentItemStateEventDtoConverter.ToShipmentItemStateEventDto(ee); shipmentItemEvents.Add(eeDto); } dto.ShipmentItemEvents = shipmentItemEvents.ToArray(); var shipmentReceiptEvents = new List <ShipmentReceiptStateCreatedOrMergePatchedOrRemovedDto>(); foreach (var ee in e.ShipmentReceiptEvents) { ShipmentReceiptStateCreatedOrMergePatchedOrRemovedDto eeDto = ShipmentReceiptStateEventDtoConverter.ToShipmentReceiptStateEventDto(ee); shipmentReceiptEvents.Add(eeDto); } dto.ShipmentReceiptEvents = shipmentReceiptEvents.ToArray(); var itemIssuanceEvents = new List <ItemIssuanceStateCreatedOrMergePatchedOrRemovedDto>(); foreach (var ee in e.ItemIssuanceEvents) { ItemIssuanceStateCreatedOrMergePatchedOrRemovedDto eeDto = ItemIssuanceStateEventDtoConverter.ToItemIssuanceStateEventDto(ee); itemIssuanceEvents.Add(eeDto); } dto.ItemIssuanceEvents = itemIssuanceEvents.ToArray(); return(dto); }
protected virtual IShipmentStateMergePatched Map(IMergePatchShipment c) { var stateEventId = new ShipmentEventId(c.ShipmentId, c.Version); IShipmentStateMergePatched e = NewShipmentStateMergePatched(stateEventId); e.ShipmentTypeId = c.ShipmentTypeId; e.StatusId = c.StatusId; e.PrimaryOrderId = c.PrimaryOrderId; e.PrimaryReturnId = c.PrimaryReturnId; e.PrimaryShipGroupSeqId = c.PrimaryShipGroupSeqId; e.PicklistBinId = c.PicklistBinId; e.BolNumber = c.BolNumber; e.SealNumber = c.SealNumber; e.VehicleId = c.VehicleId; e.ExternalOrderNumber = c.ExternalOrderNumber; e.Carrier = c.Carrier; e.DateShipped = c.DateShipped; e.EstimatedReadyDate = c.EstimatedReadyDate; e.EstimatedShipDate = c.EstimatedShipDate; e.EstimatedShipWorkEffId = c.EstimatedShipWorkEffId; e.EstimatedArrivalDate = c.EstimatedArrivalDate; e.EstimatedArrivalWorkEffId = c.EstimatedArrivalWorkEffId; e.LatestCancelDate = c.LatestCancelDate; e.EstimatedShipCost = c.EstimatedShipCost; e.CurrencyUomId = c.CurrencyUomId; e.HandlingInstructions = c.HandlingInstructions; e.OriginFacilityId = c.OriginFacilityId; e.DestinationFacilityId = c.DestinationFacilityId; e.OriginContactMechId = c.OriginContactMechId; e.OriginTelecomNumberId = c.OriginTelecomNumberId; e.DestinationContactMechId = c.DestinationContactMechId; e.DestinationTelecomNumberId = c.DestinationTelecomNumberId; e.PartyIdTo = c.PartyIdTo; e.PartyIdFrom = c.PartyIdFrom; e.AdditionalShippingCharge = c.AdditionalShippingCharge; e.AddtlShippingChargeDesc = c.AddtlShippingChargeDesc; e.Active = c.Active; e.IsPropertyShipmentTypeIdRemoved = c.IsPropertyShipmentTypeIdRemoved; e.IsPropertyStatusIdRemoved = c.IsPropertyStatusIdRemoved; e.IsPropertyPrimaryOrderIdRemoved = c.IsPropertyPrimaryOrderIdRemoved; e.IsPropertyPrimaryReturnIdRemoved = c.IsPropertyPrimaryReturnIdRemoved; e.IsPropertyPrimaryShipGroupSeqIdRemoved = c.IsPropertyPrimaryShipGroupSeqIdRemoved; e.IsPropertyPicklistBinIdRemoved = c.IsPropertyPicklistBinIdRemoved; e.IsPropertyBolNumberRemoved = c.IsPropertyBolNumberRemoved; e.IsPropertySealNumberRemoved = c.IsPropertySealNumberRemoved; e.IsPropertyVehicleIdRemoved = c.IsPropertyVehicleIdRemoved; e.IsPropertyExternalOrderNumberRemoved = c.IsPropertyExternalOrderNumberRemoved; e.IsPropertyCarrierRemoved = c.IsPropertyCarrierRemoved; e.IsPropertyDateShippedRemoved = c.IsPropertyDateShippedRemoved; e.IsPropertyEstimatedReadyDateRemoved = c.IsPropertyEstimatedReadyDateRemoved; e.IsPropertyEstimatedShipDateRemoved = c.IsPropertyEstimatedShipDateRemoved; e.IsPropertyEstimatedShipWorkEffIdRemoved = c.IsPropertyEstimatedShipWorkEffIdRemoved; e.IsPropertyEstimatedArrivalDateRemoved = c.IsPropertyEstimatedArrivalDateRemoved; e.IsPropertyEstimatedArrivalWorkEffIdRemoved = c.IsPropertyEstimatedArrivalWorkEffIdRemoved; e.IsPropertyLatestCancelDateRemoved = c.IsPropertyLatestCancelDateRemoved; e.IsPropertyEstimatedShipCostRemoved = c.IsPropertyEstimatedShipCostRemoved; e.IsPropertyCurrencyUomIdRemoved = c.IsPropertyCurrencyUomIdRemoved; e.IsPropertyHandlingInstructionsRemoved = c.IsPropertyHandlingInstructionsRemoved; e.IsPropertyOriginFacilityIdRemoved = c.IsPropertyOriginFacilityIdRemoved; e.IsPropertyDestinationFacilityIdRemoved = c.IsPropertyDestinationFacilityIdRemoved; e.IsPropertyOriginContactMechIdRemoved = c.IsPropertyOriginContactMechIdRemoved; e.IsPropertyOriginTelecomNumberIdRemoved = c.IsPropertyOriginTelecomNumberIdRemoved; e.IsPropertyDestinationContactMechIdRemoved = c.IsPropertyDestinationContactMechIdRemoved; e.IsPropertyDestinationTelecomNumberIdRemoved = c.IsPropertyDestinationTelecomNumberIdRemoved; e.IsPropertyPartyIdToRemoved = c.IsPropertyPartyIdToRemoved; e.IsPropertyPartyIdFromRemoved = c.IsPropertyPartyIdFromRemoved; e.IsPropertyAdditionalShippingChargeRemoved = c.IsPropertyAdditionalShippingChargeRemoved; e.IsPropertyAddtlShippingChargeDescRemoved = c.IsPropertyAddtlShippingChargeDescRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; foreach (IShipmentImageCommand innerCommand in c.ShipmentImageCommands) { ThrowOnInconsistentCommands(c, innerCommand); IShipmentImageEvent innerEvent = Map(innerCommand, c, version, _state); e.AddShipmentImageEvent(innerEvent); } foreach (IShipmentItemCommand innerCommand in c.ShipmentItemCommands) { ThrowOnInconsistentCommands(c, innerCommand); IShipmentItemEvent innerEvent = Map(innerCommand, c, version, _state); e.AddShipmentItemEvent(innerEvent); } foreach (IShipmentReceiptCommand innerCommand in c.ShipmentReceiptCommands) { ThrowOnInconsistentCommands(c, innerCommand); IShipmentReceiptEvent innerEvent = Map(innerCommand, c, version, _state); e.AddShipmentReceiptEvent(innerEvent); } foreach (IItemIssuanceCommand innerCommand in c.ItemIssuanceCommands) { ThrowOnInconsistentCommands(c, innerCommand); IItemIssuanceEvent innerEvent = Map(innerCommand, c, version, _state); e.AddItemIssuanceEvent(innerEvent); } return(e); }
public virtual void MergePatch(IMergePatchShipment c) { IShipmentStateMergePatched e = Map(c); Apply(e); }
void IShipmentState.When(IShipmentStateMergePatched e) { throw new NotSupportedException(); }