public virtual void When(IOrderShipGroupStateCreated e) { ThrowOnWrongEvent(e); this.ShipmentMethodTypeId = e.ShipmentMethodTypeId; this.SupplierPartyId = e.SupplierPartyId; this.VendorPartyId = e.VendorPartyId; this.CarrierPartyId = e.CarrierPartyId; this.CarrierRoleTypeId = e.CarrierRoleTypeId; this.FacilityId = e.FacilityId; this.ContactMechId = e.ContactMechId; this.TelecomContactMechId = e.TelecomContactMechId; this.TrackingNumber = e.TrackingNumber; this.ShippingInstructions = e.ShippingInstructions; this.MaySplit = e.MaySplit; this.GiftMessage = e.GiftMessage; this.IsGift = e.IsGift; this.ShipAfterDate = e.ShipAfterDate; this.ShipByDate = e.ShipByDate; this.EstimatedShipDate = e.EstimatedShipDate; this.EstimatedDeliveryDate = e.EstimatedDeliveryDate; this.PickwaveId = e.PickwaveId; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IOrderItemShipGroupAssociationStateCreated innerEvent in e.OrderItemShipGroupAssociationEvents) { IOrderItemShipGroupAssociationState innerState = this.OrderItemShipGroupAssociations.Get(innerEvent.GlobalId.OrderItemSeqId, true); innerState.Mutate(innerEvent); } }
public IOrderItemShipGroupAssociationState Get(OrderItemShipGroupAssociationId id, bool nullAllowed) { IOrderItemShipGroupAssociationState state = CurrentSession.Get <OrderItemShipGroupAssociationState>(id); if (!nullAllowed && state == null) { state = new OrderItemShipGroupAssociationState(); (state as OrderItemShipGroupAssociationState).OrderItemShipGroupAssociationId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IOrderItemShipGroupAssociationState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public void Delete(IOrderItemShipGroupAssociationState state) { IOrderItemShipGroupAssociationState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IOrderItemShipGroupAssociationState>(state); } var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(s); }
public static TCreateOrderItemShipGroupAssociation ToCreateOrderItemShipGroupAssociation <TCreateOrderItemShipGroupAssociation>(this IOrderItemShipGroupAssociationState state) where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new() { var cmd = new TCreateOrderItemShipGroupAssociation(); cmd.OrderItemSeqId = state.OrderItemSeqId; cmd.Quantity = state.Quantity; cmd.CancelQuantity = state.CancelQuantity; cmd.Active = ((IOrderItemShipGroupAssociationStateProperties)state).Active; cmd.OrderId = state.OrderId; cmd.OrderShipGroupShipGroupSeqId = state.OrderShipGroupShipGroupSeqId; return(cmd); }
public static TMergePatchOrderItemShipGroupAssociation ToMergePatchOrderItemShipGroupAssociation <TMergePatchOrderItemShipGroupAssociation>(this IOrderItemShipGroupAssociationState state) where TMergePatchOrderItemShipGroupAssociation : IMergePatchOrderItemShipGroupAssociation, new() { var cmd = new TMergePatchOrderItemShipGroupAssociation(); cmd.OrderItemSeqId = state.OrderItemSeqId; cmd.Quantity = state.Quantity; cmd.CancelQuantity = state.CancelQuantity; cmd.Active = ((IOrderItemShipGroupAssociationStateProperties)state).Active; cmd.OrderId = state.OrderId; cmd.OrderShipGroupShipGroupSeqId = state.OrderShipGroupShipGroupSeqId; if (state.Quantity == null) { cmd.IsPropertyQuantityRemoved = true; } if (state.CancelQuantity == null) { cmd.IsPropertyCancelQuantityRemoved = true; } return(cmd); }
public static TRemoveOrderItemShipGroupAssociation ToRemoveOrderItemShipGroupAssociation <TRemoveOrderItemShipGroupAssociation>(this IOrderItemShipGroupAssociationState state) where TRemoveOrderItemShipGroupAssociation : IRemoveOrderItemShipGroupAssociation, new() { var cmd = new TRemoveOrderItemShipGroupAssociation(); cmd.OrderItemSeqId = state.OrderItemSeqId; return(cmd); }
public static IOrderItemShipGroupAssociationCommand ToCreateOrMergePatchOrderItemShipGroupAssociation <TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>(this IOrderItemShipGroupAssociationState state) where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new() where TMergePatchOrderItemShipGroupAssociation : IMergePatchOrderItemShipGroupAssociation, new() { bool bUnsaved = ((IOrderItemShipGroupAssociationState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateOrderItemShipGroupAssociation <TCreateOrderItemShipGroupAssociation>()); } else { return(state.ToMergePatchOrderItemShipGroupAssociation <TMergePatchOrderItemShipGroupAssociation>()); } }
public void AddToSave(IOrderItemShipGroupAssociationState state) { throw new NotSupportedException(); }
public virtual void When(IOrderShipGroupStateMergePatched e) { ThrowOnWrongEvent(e); if (e.ShipmentMethodTypeId == null) { if (e.IsPropertyShipmentMethodTypeIdRemoved) { this.ShipmentMethodTypeId = default(string); } } else { this.ShipmentMethodTypeId = e.ShipmentMethodTypeId; } if (e.SupplierPartyId == null) { if (e.IsPropertySupplierPartyIdRemoved) { this.SupplierPartyId = default(string); } } else { this.SupplierPartyId = e.SupplierPartyId; } if (e.VendorPartyId == null) { if (e.IsPropertyVendorPartyIdRemoved) { this.VendorPartyId = default(string); } } else { this.VendorPartyId = e.VendorPartyId; } if (e.CarrierPartyId == null) { if (e.IsPropertyCarrierPartyIdRemoved) { this.CarrierPartyId = default(string); } } else { this.CarrierPartyId = e.CarrierPartyId; } if (e.CarrierRoleTypeId == null) { if (e.IsPropertyCarrierRoleTypeIdRemoved) { this.CarrierRoleTypeId = default(string); } } else { this.CarrierRoleTypeId = e.CarrierRoleTypeId; } if (e.FacilityId == null) { if (e.IsPropertyFacilityIdRemoved) { this.FacilityId = default(string); } } else { this.FacilityId = e.FacilityId; } if (e.DestinationFacilityId == null) { if (e.IsPropertyDestinationFacilityIdRemoved) { this.DestinationFacilityId = default(string); } } else { this.DestinationFacilityId = e.DestinationFacilityId; } if (e.ContactMechId == null) { if (e.IsPropertyContactMechIdRemoved) { this.ContactMechId = default(string); } } else { this.ContactMechId = e.ContactMechId; } if (e.TelecomContactMechId == null) { if (e.IsPropertyTelecomContactMechIdRemoved) { this.TelecomContactMechId = default(string); } } else { this.TelecomContactMechId = e.TelecomContactMechId; } if (e.TrackingNumber == null) { if (e.IsPropertyTrackingNumberRemoved) { this.TrackingNumber = default(string); } } else { this.TrackingNumber = e.TrackingNumber; } if (e.ContactPartyId == null) { if (e.IsPropertyContactPartyIdRemoved) { this.ContactPartyId = default(string); } } else { this.ContactPartyId = e.ContactPartyId; } if (e.VehiclePlateNumber == null) { if (e.IsPropertyVehiclePlateNumberRemoved) { this.VehiclePlateNumber = default(string); } } else { this.VehiclePlateNumber = e.VehiclePlateNumber; } if (e.ShippingInstructions == null) { if (e.IsPropertyShippingInstructionsRemoved) { this.ShippingInstructions = default(string); } } else { this.ShippingInstructions = e.ShippingInstructions; } if (e.MaySplit == null) { if (e.IsPropertyMaySplitRemoved) { this.MaySplit = default(string); } } else { this.MaySplit = e.MaySplit; } if (e.GiftMessage == null) { if (e.IsPropertyGiftMessageRemoved) { this.GiftMessage = default(string); } } else { this.GiftMessage = e.GiftMessage; } if (e.IsGift == null) { if (e.IsPropertyIsGiftRemoved) { this.IsGift = default(string); } } else { this.IsGift = e.IsGift; } if (e.ShipAfterDate == null) { if (e.IsPropertyShipAfterDateRemoved) { this.ShipAfterDate = default(DateTime?); } } else { this.ShipAfterDate = e.ShipAfterDate; } if (e.ShipByDate == null) { if (e.IsPropertyShipByDateRemoved) { this.ShipByDate = default(DateTime?); } } else { this.ShipByDate = e.ShipByDate; } if (e.EstimatedShipDate == null) { if (e.IsPropertyEstimatedShipDateRemoved) { this.EstimatedShipDate = default(DateTime?); } } else { this.EstimatedShipDate = e.EstimatedShipDate; } if (e.EstimatedDeliveryDate == null) { if (e.IsPropertyEstimatedDeliveryDateRemoved) { this.EstimatedDeliveryDate = default(DateTime?); } } else { this.EstimatedDeliveryDate = e.EstimatedDeliveryDate; } if (e.PickwaveId == null) { if (e.IsPropertyPickwaveIdRemoved) { this.PickwaveId = default(long?); } } else { this.PickwaveId = e.PickwaveId; } if (e.NumberOfPackages == null) { if (e.IsPropertyNumberOfPackagesRemoved) { this.NumberOfPackages = default(int); } } else { this.NumberOfPackages = (e.NumberOfPackages != null && e.NumberOfPackages.HasValue) ? e.NumberOfPackages.Value : default(int); } if (e.NumberOfContainers == null) { if (e.IsPropertyNumberOfContainersRemoved) { this.NumberOfContainers = default(int); } } else { this.NumberOfContainers = (e.NumberOfContainers != null && e.NumberOfContainers.HasValue) ? e.NumberOfContainers.Value : default(int); } if (e.NumberOfPakagesPerContainer == null) { if (e.IsPropertyNumberOfPakagesPerContainerRemoved) { this.NumberOfPakagesPerContainer = default(int); } } else { this.NumberOfPakagesPerContainer = (e.NumberOfPakagesPerContainer != null && e.NumberOfPakagesPerContainer.HasValue) ? e.NumberOfPakagesPerContainer.Value : default(int); } if (e.OrderShipGroupStatusId == null) { if (e.IsPropertyOrderShipGroupStatusIdRemoved) { this.OrderShipGroupStatusId = default(string); } } else { this.OrderShipGroupStatusId = e.OrderShipGroupStatusId; } 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 (IOrderItemShipGroupAssociationEvent innerEvent in e.OrderItemShipGroupAssociationEvents) { IOrderItemShipGroupAssociationState innerState = this.OrderItemShipGroupAssociations.Get(innerEvent.GlobalId.OrderItemSeqId); innerState.Mutate(innerEvent); var removed = innerEvent as IOrderItemShipGroupAssociationStateRemoved; if (removed != null) { this.OrderItemShipGroupAssociations.Remove(innerState); } } }
public virtual void Remove(IOrderItemShipGroupAssociationState state) { this._removedOrderItemShipGroupAssociationStates.Add(state.GlobalId, state); }
public virtual void AddToSave(IOrderItemShipGroupAssociationState state) { this._loadedOrderItemShipGroupAssociationStates[state.GlobalId] = state; }
public OrderItemShipGroupAssociationStateDtoWrapper(IOrderItemShipGroupAssociationState state) { this._state = state; }
public OrderItemShipGroupAssociationStateDtoWrapper() { this._state = new OrderItemShipGroupAssociationState(); }