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

            ShipmentPackageContentId other = obj as ShipmentPackageContentId;

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

            return(true &&
                   Object.Equals(this.ShipmentPackageId, other.ShipmentPackageId) &&
                   Object.Equals(this.ShipmentItemSeqId, other.ShipmentItemSeqId)
                   );
        }
Exemplo n.º 2
0
        public virtual IShipmentPackageContentState Get(string shipmentItemSeqId, bool forCreation, bool nullAllowed)
        {
            ShipmentPackageContentId globalId = new ShipmentPackageContentId(_shipmentPackageState.ShipmentPackageId, shipmentItemSeqId);

            if (_loadedShipmentPackageContentStates.ContainsKey(globalId))
            {
                var state = _loadedShipmentPackageContentStates[globalId];
                if (this._shipmentPackageState != null && this._shipmentPackageState.ReadOnly == false)
                {
                    ((IShipmentPackageContentState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ShipmentPackageContentState(ForReapplying);
                state.ShipmentPackageContentId = globalId;
                _loadedShipmentPackageContentStates.Add(globalId, state);
                if (this._shipmentPackageState != null && this._shipmentPackageState.ReadOnly == false)
                {
                    ((IShipmentPackageContentState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ShipmentPackageContentStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedShipmentPackageContentStates.Add(globalId, state);
                }
                if (this._shipmentPackageState != null && this._shipmentPackageState.ReadOnly == false)
                {
                    ((IShipmentPackageContentState)state).ReadOnly = false;
                }
                return(state);
            }
        }