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

            ShipmentItemIssuanceId other = obj as ShipmentItemIssuanceId;

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

            return(true &&
                   Object.Equals(this.ShipmentId, other.ShipmentId) &&
                   Object.Equals(this.ItemIssuanceSeqId, other.ItemIssuanceSeqId)
                   );
        }
예제 #2
0
        public virtual IItemIssuanceState Get(string itemIssuanceSeqId, bool forCreation, bool nullAllowed)
        {
            ShipmentItemIssuanceId globalId = new ShipmentItemIssuanceId(_shipmentState.ShipmentId, itemIssuanceSeqId);

            if (_loadedItemIssuanceStates.ContainsKey(globalId))
            {
                var state = _loadedItemIssuanceStates[globalId];
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IItemIssuanceState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ItemIssuanceState(ForReapplying);
                state.ShipmentItemIssuanceId = globalId;
                _loadedItemIssuanceStates.Add(globalId, state);
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IItemIssuanceState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ItemIssuanceStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedItemIssuanceStates.Add(globalId, state);
                }
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IItemIssuanceState)state).ReadOnly = false;
                }
                return(state);
            }
        }