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

            ShipmentItemId other = obj as ShipmentItemId;

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

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