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

            ShipmentReceiptId other = obj as ShipmentReceiptId;

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

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