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

            ProductGoodIdentificationId other = obj as ProductGoodIdentificationId;

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

            return(true &&
                   Object.Equals(this.ProductId, other.ProductId) &&
                   Object.Equals(this.GoodIdentificationTypeId, other.GoodIdentificationTypeId)
                   );
        }
示例#2
0
        public virtual IGoodIdentificationState Get(string goodIdentificationTypeId, bool forCreation, bool nullAllowed)
        {
            ProductGoodIdentificationId globalId = new ProductGoodIdentificationId(_productState.ProductId, goodIdentificationTypeId);

            if (_loadedGoodIdentificationStates.ContainsKey(globalId))
            {
                var state = _loadedGoodIdentificationStates[globalId];
                if (this._productState != null && this._productState.ReadOnly == false)
                {
                    ((IGoodIdentificationState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new GoodIdentificationState(ForReapplying);
                state.ProductGoodIdentificationId = globalId;
                _loadedGoodIdentificationStates.Add(globalId, state);
                if (this._productState != null && this._productState.ReadOnly == false)
                {
                    ((IGoodIdentificationState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = GoodIdentificationStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedGoodIdentificationStates.Add(globalId, state);
                }
                if (this._productState != null && this._productState.ReadOnly == false)
                {
                    ((IGoodIdentificationState)state).ReadOnly = false;
                }
                return(state);
            }
        }