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

            OrderItemId other = obj as OrderItemId;

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

            return(true &&
                   Object.Equals(this.OrderId, other.OrderId) &&
                   Object.Equals(this.OrderItemSeqId, other.OrderItemSeqId)
                   );
        }
Exemple #2
0
        public virtual IOrderItemState Get(string orderItemSeqId, bool forCreation, bool nullAllowed)
        {
            OrderItemId globalId = new OrderItemId(_orderState.OrderId, orderItemSeqId);

            if (_loadedOrderItemStates.ContainsKey(globalId))
            {
                var state = _loadedOrderItemStates[globalId];
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderItemState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new OrderItemState(ForReapplying);
                state.OrderItemId = globalId;
                _loadedOrderItemStates.Add(globalId, state);
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderItemState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = OrderItemStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedOrderItemStates.Add(globalId, state);
                }
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderItemState)state).ReadOnly = false;
                }
                return(state);
            }
        }