コード例 #1
0
ファイル: AttributeSetState.cs プロジェクト: uwitec/wms-8
        public virtual void When(IAttributeSetStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.AttributeSetName = e.AttributeSetName;

            this.OrganizationId = e.OrganizationId;

            this.Description = e.Description;

            this.ReferenceId = e.ReferenceId;

            if (e.IsInstanceAttributeSet != null)
            {
                this.IsInstanceAttributeSet = (e.IsInstanceAttributeSet != null && e.IsInstanceAttributeSet.HasValue) ? e.IsInstanceAttributeSet.Value : default(bool);
            }

            if (e.IsMandatory != null)
            {
                this.IsMandatory = (e.IsMandatory != null && e.IsMandatory.HasValue) ? e.IsMandatory.Value : default(bool);
            }

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;

            foreach (IAttributeUseStateCreated innerEvent in e.AttributeUseEvents)
            {
                IAttributeUseState innerState = this.AttributeUses.Get(innerEvent.GlobalId.AttributeId, true);
                innerState.Mutate(innerEvent);
            }
        }
コード例 #2
0
ファイル: AttributeSetState.cs プロジェクト: 573000126/wms-4
        public virtual void When(IAttributeSetStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Name = e.Name;

            this.OrganizationId = e.OrganizationId;

            this.Description = e.Description;

            this.SerialNumberAttributeId = e.SerialNumberAttributeId;

            this.LotAttributeId = e.LotAttributeId;

            this.ReferenceId = e.ReferenceId;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;

            foreach (IAttributeUseStateCreated innerEvent in e.AttributeUseEvents)
            {
                IAttributeUseState innerState = this.AttributeUses.Get(innerEvent.GlobalId.AttributeId);
                innerState.Mutate(innerEvent);
            }
        }
コード例 #3
0
ファイル: AttributeSetState.cs プロジェクト: uwitec/wms-8
        public virtual void When(IAttributeSetStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.AttributeSetName == null)
            {
                if (e.IsPropertyAttributeSetNameRemoved)
                {
                    this.AttributeSetName = default(string);
                }
            }
            else
            {
                this.AttributeSetName = e.AttributeSetName;
            }

            if (e.OrganizationId == null)
            {
                if (e.IsPropertyOrganizationIdRemoved)
                {
                    this.OrganizationId = default(string);
                }
            }
            else
            {
                this.OrganizationId = e.OrganizationId;
            }

            if (e.Description == null)
            {
                if (e.IsPropertyDescriptionRemoved)
                {
                    this.Description = default(string);
                }
            }
            else
            {
                this.Description = e.Description;
            }

            if (e.ReferenceId == null)
            {
                if (e.IsPropertyReferenceIdRemoved)
                {
                    this.ReferenceId = default(string);
                }
            }
            else
            {
                this.ReferenceId = e.ReferenceId;
            }

            if (e.IsInstanceAttributeSet == null)
            {
                if (e.IsPropertyIsInstanceAttributeSetRemoved)
                {
                    this.IsInstanceAttributeSet = default(bool);
                }
            }
            else
            {
                this.IsInstanceAttributeSet = (e.IsInstanceAttributeSet != null && e.IsInstanceAttributeSet.HasValue) ? e.IsInstanceAttributeSet.Value : default(bool);
            }

            if (e.IsMandatory == null)
            {
                if (e.IsPropertyIsMandatoryRemoved)
                {
                    this.IsMandatory = default(bool);
                }
            }
            else
            {
                this.IsMandatory = (e.IsMandatory != null && e.IsMandatory.HasValue) ? e.IsMandatory.Value : default(bool);
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;


            foreach (IAttributeUseEvent innerEvent in e.AttributeUseEvents)
            {
                IAttributeUseState innerState = this.AttributeUses.Get(innerEvent.GlobalId.AttributeId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IAttributeUseStateRemoved;
                if (removed != null)
                {
                    this.AttributeUses.Remove(innerState);
                }
            }
        }