示例#1
0
        public virtual IShipmentReceiptState ToShipmentReceiptState()
        {
            var state = new ShipmentReceiptState(true);

            state.ReceiptSeqId           = this.ReceiptSeqId;
            state.ProductId              = this.ProductId;
            state.AttributeSetInstanceId = this.AttributeSetInstanceId;
            state.LocatorId              = this.LocatorId;
            state.ShipmentItemSeqId      = this.ShipmentItemSeqId;
            state.ShipmentPackageSeqId   = this.ShipmentPackageSeqId;
            state.OrderId           = this.OrderId;
            state.OrderItemSeqId    = this.OrderItemSeqId;
            state.ReturnId          = this.ReturnId;
            state.ReturnItemSeqId   = this.ReturnItemSeqId;
            state.RejectionReasonId = this.RejectionReasonId;
            state.DamageReasonId    = this.DamageReasonId;
            state.ReceivedBy        = this.ReceivedBy;
            state.DatetimeReceived  = this.DatetimeReceived;
            state.ItemDescription   = this.ItemDescription;
            state.AcceptedQuantity  = this.AcceptedQuantity;
            state.RejectedQuantity  = this.RejectedQuantity;
            state.DamagedQuantity   = this.DamagedQuantity;
            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;
            }
            if (this.DamageStatusIds != null)
            {
                state.DamageStatusIds = new HashSet <string>(this.DamageStatusIds);
            }
            if (this.ShipmentReceiptImages != null)
            {
                foreach (var s in this.ShipmentReceiptImages)
                {
                    state.ShipmentReceiptImages.AddToSave(s.ToShipmentReceiptImageState());
                }
            }
            ;

            return(state);
        }
示例#2
0
        public virtual IShipmentReceiptState Get(string receiptSeqId, bool forCreation, bool nullAllowed)
        {
            ShipmentReceiptId globalId = new ShipmentReceiptId(_shipmentState.ShipmentId, receiptSeqId);

            if (_loadedShipmentReceiptStates.ContainsKey(globalId))
            {
                var state = _loadedShipmentReceiptStates[globalId];
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentReceiptState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ShipmentReceiptState(ForReapplying);
                state.ShipmentReceiptId = globalId;
                _loadedShipmentReceiptStates.Add(globalId, state);
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentReceiptState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ShipmentReceiptStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedShipmentReceiptStates.Add(globalId, state);
                }
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentReceiptState)state).ReadOnly = false;
                }
                return(state);
            }
        }
 public static CreateShipmentReceipt ToCreateShipmentReceipt(this ShipmentReceiptState state)
 {
     return(state.ToCreateShipmentReceipt <CreateShipmentReceipt, CreateShipmentReceiptImage>());
 }
 public static MergePatchShipmentReceipt ToMergePatchShipmentReceipt(this ShipmentReceiptState state)
 {
     return(state.ToMergePatchShipmentReceipt <MergePatchShipmentReceipt, CreateShipmentReceiptImage, MergePatchShipmentReceiptImage>());
 }
 public static RemoveShipmentReceipt ToRemoveShipmentReceipt(this ShipmentReceiptState state)
 {
     return(state.ToRemoveShipmentReceipt <RemoveShipmentReceipt>());
 }
 public static IShipmentReceiptCommand ToCreateOrMergePatchShipmentReceipt(this ShipmentReceiptState state)
 {
     return(state.ToCreateOrMergePatchShipmentReceipt <CreateShipmentReceipt, MergePatchShipmentReceipt, CreateShipmentReceiptImage, MergePatchShipmentReceiptImage>());
 }
 public static MergePatchShipmentReceipt ToMergePatchShipmentReceipt(this ShipmentReceiptState state)
 {
     return(state.ToMergePatchShipmentReceipt <MergePatchShipmentReceipt>());
 }