Пример #1
0
        public virtual IGoodIdentificationState ToGoodIdentificationState()
        {
            var state = new GoodIdentificationState(true);

            state.GoodIdentificationTypeId = this.GoodIdentificationTypeId;
            state.IdValue = this.IdValue;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.ProductId = this.ProductId;
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
Пример #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);
            }
        }
 public static CreateGoodIdentification ToCreateGoodIdentification(this GoodIdentificationState state)
 {
     return(state.ToCreateGoodIdentification <CreateGoodIdentification>());
 }
 public static MergePatchGoodIdentification ToMergePatchGoodIdentification(this GoodIdentificationState state)
 {
     return(state.ToMergePatchGoodIdentification <MergePatchGoodIdentification>());
 }
 public static RemoveGoodIdentification ToRemoveGoodIdentification(this GoodIdentificationState state)
 {
     return(state.ToRemoveGoodIdentification <RemoveGoodIdentification>());
 }
 public static IGoodIdentificationCommand ToCreateOrMergePatchGoodIdentification(this GoodIdentificationState state)
 {
     return(state.ToCreateOrMergePatchGoodIdentification <CreateGoodIdentification, MergePatchGoodIdentification>());
 }