Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            ShipmentImageId other = obj as ShipmentImageId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.ShipmentId, other.ShipmentId) &&
                   Object.Equals(this.SequenceId, other.SequenceId)
                   );
        }
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);
            }
        }