예제 #1
0
        public virtual IShipmentItemState ToShipmentItemState()
        {
            var state = new ShipmentItemState(true);

            state.ShipmentItemSeqId      = this.ShipmentItemSeqId;
            state.ProductId              = this.ProductId;
            state.AttributeSetInstanceId = this.AttributeSetInstanceId;
            state.Quantity = this.Quantity;
            state.ShipmentContentDescription = this.ShipmentContentDescription;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.ShipmentId = this.ShipmentId;
            state.CreatedBy  = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
예제 #2
0
        public virtual IShipmentItemState Get(string shipmentItemSeqId, bool forCreation, bool nullAllowed)
        {
            ShipmentItemId globalId = new ShipmentItemId(_shipmentState.ShipmentId, shipmentItemSeqId);

            if (_loadedShipmentItemStates.ContainsKey(globalId))
            {
                var state = _loadedShipmentItemStates[globalId];
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentItemState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ShipmentItemState(ForReapplying);
                state.ShipmentItemId = globalId;
                _loadedShipmentItemStates.Add(globalId, state);
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentItemState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ShipmentItemStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedShipmentItemStates.Add(globalId, state);
                }
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentItemState)state).ReadOnly = false;
                }
                return(state);
            }
        }
예제 #3
0
 public static CreateShipmentItem ToCreateShipmentItem(this ShipmentItemState state)
 {
     return(state.ToCreateShipmentItem <CreateShipmentItem>());
 }
예제 #4
0
 public static MergePatchShipmentItem ToMergePatchShipmentItem(this ShipmentItemState state)
 {
     return(state.ToMergePatchShipmentItem <MergePatchShipmentItem>());
 }
예제 #5
0
 public static RemoveShipmentItem ToRemoveShipmentItem(this ShipmentItemState state)
 {
     return(state.ToRemoveShipmentItem <RemoveShipmentItem>());
 }
예제 #6
0
 public static IShipmentItemCommand ToCreateOrMergePatchShipmentItem(this ShipmentItemState state)
 {
     return(state.ToCreateOrMergePatchShipmentItem <CreateShipmentItem, MergePatchShipmentItem>());
 }