public virtual void When(IShipmentReceiptStateCreated e) { ThrowOnWrongEvent(e); this.ProductId = e.ProductId; this.AttributeSetInstanceId = e.AttributeSetInstanceId; this.LocatorId = e.LocatorId; this.ShipmentItemSeqId = e.ShipmentItemSeqId; this.ShipmentPackageSeqId = e.ShipmentPackageSeqId; this.OrderId = e.OrderId; this.OrderItemSeqId = e.OrderItemSeqId; this.ReturnId = e.ReturnId; this.ReturnItemSeqId = e.ReturnItemSeqId; this.RejectionReasonId = e.RejectionReasonId; this.DamageStatusIds = e.DamageStatusIds; this.DamageReasonId = e.DamageReasonId; this.ReceivedBy = e.ReceivedBy; this.DatetimeReceived = e.DatetimeReceived; this.ItemDescription = e.ItemDescription; this.AcceptedQuantity = e.AcceptedQuantity; this.RejectedQuantity = e.RejectedQuantity; this.DamagedQuantity = e.DamagedQuantity; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IShipmentReceiptImageStateCreated innerEvent in e.ShipmentReceiptImageEvents) { IShipmentReceiptImageState innerState = this.ShipmentReceiptImages.Get(innerEvent.GlobalId.SequenceId, true); innerState.Mutate(innerEvent); } }
public IShipmentReceiptImageState Get(ShipmentReceiptImageId id, bool nullAllowed) { IShipmentReceiptImageState state = CurrentSession.Get <ShipmentReceiptImageState>(id); if (!nullAllowed && state == null) { state = new ShipmentReceiptImageState(); (state as ShipmentReceiptImageState).ShipmentReceiptImageId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IShipmentReceiptImageState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public void Delete(IShipmentReceiptImageState state) { IShipmentReceiptImageState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IShipmentReceiptImageState>(state); } var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(s); }
public virtual void Remove(IShipmentReceiptImageState state) { this._removedShipmentReceiptImageStates.Add(state.GlobalId, state); }
public virtual void AddToSave(IShipmentReceiptImageState state) { this._loadedShipmentReceiptImageStates[state.GlobalId] = state; }
public ShipmentReceiptImageStateDtoWrapper(IShipmentReceiptImageState state) { this._state = state; }
public ShipmentReceiptImageStateDtoWrapper() { this._state = new ShipmentReceiptImageState(); }
public void AddToSave(IShipmentReceiptImageState state) { throw new NotSupportedException(); }
public virtual void When(IShipmentReceiptStateMergePatched e) { ThrowOnWrongEvent(e); if (e.ProductId == null) { if (e.IsPropertyProductIdRemoved) { this.ProductId = default(string); } } else { this.ProductId = e.ProductId; } if (e.AttributeSetInstanceId == null) { if (e.IsPropertyAttributeSetInstanceIdRemoved) { this.AttributeSetInstanceId = default(string); } } else { this.AttributeSetInstanceId = e.AttributeSetInstanceId; } if (e.LocatorId == null) { if (e.IsPropertyLocatorIdRemoved) { this.LocatorId = default(string); } } else { this.LocatorId = e.LocatorId; } if (e.ShipmentItemSeqId == null) { if (e.IsPropertyShipmentItemSeqIdRemoved) { this.ShipmentItemSeqId = default(string); } } else { this.ShipmentItemSeqId = e.ShipmentItemSeqId; } if (e.ShipmentPackageSeqId == null) { if (e.IsPropertyShipmentPackageSeqIdRemoved) { this.ShipmentPackageSeqId = default(string); } } else { this.ShipmentPackageSeqId = e.ShipmentPackageSeqId; } if (e.OrderId == null) { if (e.IsPropertyOrderIdRemoved) { this.OrderId = default(string); } } else { this.OrderId = e.OrderId; } if (e.OrderItemSeqId == null) { if (e.IsPropertyOrderItemSeqIdRemoved) { this.OrderItemSeqId = default(string); } } else { this.OrderItemSeqId = e.OrderItemSeqId; } if (e.ReturnId == null) { if (e.IsPropertyReturnIdRemoved) { this.ReturnId = default(string); } } else { this.ReturnId = e.ReturnId; } if (e.ReturnItemSeqId == null) { if (e.IsPropertyReturnItemSeqIdRemoved) { this.ReturnItemSeqId = default(string); } } else { this.ReturnItemSeqId = e.ReturnItemSeqId; } if (e.RejectionReasonId == null) { if (e.IsPropertyRejectionReasonIdRemoved) { this.RejectionReasonId = default(string); } } else { this.RejectionReasonId = e.RejectionReasonId; } if (e.DamageStatusIds == null) { if (e.IsPropertyDamageStatusIdsRemoved) { this.DamageStatusIds = null; } } else { this.DamageStatusIds = e.DamageStatusIds; } if (e.DamageReasonId == null) { if (e.IsPropertyDamageReasonIdRemoved) { this.DamageReasonId = default(string); } } else { this.DamageReasonId = e.DamageReasonId; } if (e.ReceivedBy == null) { if (e.IsPropertyReceivedByRemoved) { this.ReceivedBy = default(string); } } else { this.ReceivedBy = e.ReceivedBy; } if (e.DatetimeReceived == null) { if (e.IsPropertyDatetimeReceivedRemoved) { this.DatetimeReceived = default(DateTime?); } } else { this.DatetimeReceived = e.DatetimeReceived; } if (e.ItemDescription == null) { if (e.IsPropertyItemDescriptionRemoved) { this.ItemDescription = default(string); } } else { this.ItemDescription = e.ItemDescription; } if (e.AcceptedQuantity == null) { if (e.IsPropertyAcceptedQuantityRemoved) { this.AcceptedQuantity = default(decimal?); } } else { this.AcceptedQuantity = e.AcceptedQuantity; } if (e.RejectedQuantity == null) { if (e.IsPropertyRejectedQuantityRemoved) { this.RejectedQuantity = default(decimal?); } } else { this.RejectedQuantity = e.RejectedQuantity; } if (e.DamagedQuantity == null) { if (e.IsPropertyDamagedQuantityRemoved) { this.DamagedQuantity = default(decimal?); } } else { this.DamagedQuantity = e.DamagedQuantity; } 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 (IShipmentReceiptImageEvent innerEvent in e.ShipmentReceiptImageEvents) { IShipmentReceiptImageState innerState = this.ShipmentReceiptImages.Get(innerEvent.GlobalId.SequenceId); innerState.Mutate(innerEvent); var removed = innerEvent as IShipmentReceiptImageStateRemoved; if (removed != null) { this.ShipmentReceiptImages.Remove(innerState); } } }
public static TCreateShipmentReceiptImage ToCreateShipmentReceiptImage <TCreateShipmentReceiptImage>(this IShipmentReceiptImageState state) where TCreateShipmentReceiptImage : ICreateShipmentReceiptImage, new() { var cmd = new TCreateShipmentReceiptImage(); cmd.SequenceId = state.SequenceId; cmd.Url = state.Url; cmd.Active = ((IShipmentReceiptImageStateProperties)state).Active; cmd.ShipmentId = state.ShipmentId; cmd.ShipmentReceiptReceiptSeqId = state.ShipmentReceiptReceiptSeqId; return(cmd); }
public static TMergePatchShipmentReceiptImage ToMergePatchShipmentReceiptImage <TMergePatchShipmentReceiptImage>(this IShipmentReceiptImageState state) where TMergePatchShipmentReceiptImage : IMergePatchShipmentReceiptImage, new() { var cmd = new TMergePatchShipmentReceiptImage(); cmd.SequenceId = state.SequenceId; cmd.Url = state.Url; cmd.Active = ((IShipmentReceiptImageStateProperties)state).Active; cmd.ShipmentId = state.ShipmentId; cmd.ShipmentReceiptReceiptSeqId = state.ShipmentReceiptReceiptSeqId; if (state.Url == null) { cmd.IsPropertyUrlRemoved = true; } return(cmd); }
public static TRemoveShipmentReceiptImage ToRemoveShipmentReceiptImage <TRemoveShipmentReceiptImage>(this IShipmentReceiptImageState state) where TRemoveShipmentReceiptImage : IRemoveShipmentReceiptImage, new() { var cmd = new TRemoveShipmentReceiptImage(); cmd.SequenceId = state.SequenceId; return(cmd); }
public static IShipmentReceiptImageCommand ToCreateOrMergePatchShipmentReceiptImage <TCreateShipmentReceiptImage, TMergePatchShipmentReceiptImage>(this IShipmentReceiptImageState state) where TCreateShipmentReceiptImage : ICreateShipmentReceiptImage, new() where TMergePatchShipmentReceiptImage : IMergePatchShipmentReceiptImage, new() { bool bUnsaved = ((IShipmentReceiptImageState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateShipmentReceiptImage <TCreateShipmentReceiptImage>()); } else { return(state.ToMergePatchShipmentReceiptImage <TMergePatchShipmentReceiptImage>()); } }