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 void When(IShipmentStateCreated e) { ThrowOnWrongEvent(e); this.ShipmentTypeId = e.ShipmentTypeId; this.StatusId = e.StatusId; this.PrimaryOrderId = e.PrimaryOrderId; this.PrimaryReturnId = e.PrimaryReturnId; this.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId; this.PicklistBinId = e.PicklistBinId; this.BolNumber = e.BolNumber; this.SealNumber = e.SealNumber; this.VehicleId = e.VehicleId; this.ExternalOrderNumber = e.ExternalOrderNumber; this.Carrier = e.Carrier; this.DateShipped = e.DateShipped; this.EstimatedReadyDate = e.EstimatedReadyDate; this.EstimatedShipDate = e.EstimatedShipDate; this.EstimatedShipWorkEffId = e.EstimatedShipWorkEffId; this.EstimatedArrivalDate = e.EstimatedArrivalDate; this.EstimatedArrivalWorkEffId = e.EstimatedArrivalWorkEffId; this.LatestCancelDate = e.LatestCancelDate; this.EstimatedShipCost = e.EstimatedShipCost; this.CurrencyUomId = e.CurrencyUomId; this.HandlingInstructions = e.HandlingInstructions; this.OriginFacilityId = e.OriginFacilityId; this.DestinationFacilityId = e.DestinationFacilityId; this.OriginContactMechId = e.OriginContactMechId; this.OriginTelecomNumberId = e.OriginTelecomNumberId; this.DestinationContactMechId = e.DestinationContactMechId; this.DestinationTelecomNumberId = e.DestinationTelecomNumberId; this.PartyIdTo = e.PartyIdTo; this.PartyIdFrom = e.PartyIdFrom; this.AdditionalShippingCharge = e.AdditionalShippingCharge; this.AddtlShippingChargeDesc = e.AddtlShippingChargeDesc; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IShipmentImageStateCreated innerEvent in e.ShipmentImageEvents) { IShipmentImageState innerState = this.ShipmentImages.Get(innerEvent.GlobalId.SequenceId, true); innerState.Mutate(innerEvent); } foreach (IShipmentItemStateCreated innerEvent in e.ShipmentItemEvents) { IShipmentItemState innerState = this.ShipmentItems.Get(innerEvent.GlobalId.ShipmentItemSeqId, true); innerState.Mutate(innerEvent); } foreach (IShipmentReceiptStateCreated innerEvent in e.ShipmentReceiptEvents) { IShipmentReceiptState innerState = this.ShipmentReceipts.Get(innerEvent.GlobalId.ReceiptSeqId, true); innerState.Mutate(innerEvent); } foreach (IItemIssuanceStateCreated innerEvent in e.ItemIssuanceEvents) { IItemIssuanceState innerState = this.ItemIssuances.Get(innerEvent.GlobalId.ItemIssuanceSeqId, true); innerState.Mutate(innerEvent); } }