Esempio n. 1
0
        public virtual IShipmentImageState ToShipmentImageState()
        {
            var state = new ShipmentImageState(true);

            state.SequenceId = this.SequenceId;
            state.Url        = this.Url;
            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);
        }
Esempio n. 2
0
        public virtual IShipmentImageState Get(string sequenceId, bool forCreation, bool nullAllowed)
        {
            ShipmentImageId globalId = new ShipmentImageId(_shipmentState.ShipmentId, sequenceId);

            if (_loadedShipmentImageStates.ContainsKey(globalId))
            {
                var state = _loadedShipmentImageStates[globalId];
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentImageState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ShipmentImageState(ForReapplying);
                state.ShipmentImageId = globalId;
                _loadedShipmentImageStates.Add(globalId, state);
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentImageState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ShipmentImageStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedShipmentImageStates.Add(globalId, state);
                }
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentImageState)state).ReadOnly = false;
                }
                return(state);
            }
        }
 public static CreateShipmentImage ToCreateShipmentImage(this ShipmentImageState state)
 {
     return(state.ToCreateShipmentImage <CreateShipmentImage>());
 }
 public static MergePatchShipmentImage ToMergePatchShipmentImage(this ShipmentImageState state)
 {
     return(state.ToMergePatchShipmentImage <MergePatchShipmentImage>());
 }
 public static RemoveShipmentImage ToRemoveShipmentImage(this ShipmentImageState state)
 {
     return(state.ToRemoveShipmentImage <RemoveShipmentImage>());
 }
 public static IShipmentImageCommand ToCreateOrMergePatchShipmentImage(this ShipmentImageState state)
 {
     return(state.ToCreateOrMergePatchShipmentImage <CreateShipmentImage, MergePatchShipmentImage>());
 }