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

            PicklistRoleId other = obj as PicklistRoleId;

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

            return(true &&
                   Object.Equals(this.PicklistId, other.PicklistId) &&
                   Object.Equals(this.PartyRoleId, other.PartyRoleId)
                   );
        }
Ejemplo n.º 2
0
        public virtual IPicklistRoleState Get(PartyRoleId partyRoleId, bool forCreation, bool nullAllowed)
        {
            PicklistRoleId globalId = new PicklistRoleId(_picklistState.PicklistId, partyRoleId);

            if (_loadedPicklistRoleStates.ContainsKey(globalId))
            {
                var state = _loadedPicklistRoleStates[globalId];
                if (this._picklistState != null && this._picklistState.ReadOnly == false)
                {
                    ((IPicklistRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new PicklistRoleState(ForReapplying);
                state.PicklistRoleId = globalId;
                _loadedPicklistRoleStates.Add(globalId, state);
                if (this._picklistState != null && this._picklistState.ReadOnly == false)
                {
                    ((IPicklistRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = PicklistRoleStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedPicklistRoleStates.Add(globalId, state);
                }
                if (this._picklistState != null && this._picklistState.ReadOnly == false)
                {
                    ((IPicklistRoleState)state).ReadOnly = false;
                }
                return(state);
            }
        }