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

            OrderRoleId other = obj as OrderRoleId;

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

            return(true &&
                   Object.Equals(this.OrderId, other.OrderId) &&
                   Object.Equals(this.PartyRoleId, other.PartyRoleId)
                   );
        }
Esempio n. 2
0
        public virtual IOrderRoleState Get(PartyRoleId partyRoleId, bool forCreation, bool nullAllowed)
        {
            OrderRoleId globalId = new OrderRoleId(_orderState.OrderId, partyRoleId);

            if (_loadedOrderRoleStates.ContainsKey(globalId))
            {
                var state = _loadedOrderRoleStates[globalId];
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new OrderRoleState(ForReapplying);
                state.OrderRoleId = globalId;
                _loadedOrderRoleStates.Add(globalId, state);
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = OrderRoleStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedOrderRoleStates.Add(globalId, state);
                }
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderRoleState)state).ReadOnly = false;
                }
                return(state);
            }
        }