protected virtual IAttributeSetInstanceExtensionFieldStateMergePatched Map(IMergePatchAttributeSetInstanceExtensionField c)
        {
            var stateEventId = new AttributeSetInstanceExtensionFieldEventId(c.Name, c.Version);
            IAttributeSetInstanceExtensionFieldStateMergePatched e = NewAttributeSetInstanceExtensionFieldStateMergePatched(stateEventId);

            e.Type                         = c.Type;
            e.Length                       = c.Length;
            e.Alias                        = c.Alias;
            e.Description                  = c.Description;
            e.GroupId                      = c.GroupId;
            e.Active                       = c.Active;
            e.IsPropertyTypeRemoved        = c.IsPropertyTypeRemoved;
            e.IsPropertyLengthRemoved      = c.IsPropertyLengthRemoved;
            e.IsPropertyAliasRemoved       = c.IsPropertyAliasRemoved;
            e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved;
            e.IsPropertyGroupIdRemoved     = c.IsPropertyGroupIdRemoved;
            e.IsPropertyActiveRemoved      = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            var version = c.Version;


            return(e);
        }
        }// END Map(ICreate... ////////////////////////////

        protected virtual IAttributeSetInstanceExtensionFieldStateMergePatched MapMergePatch(IMergePatchAttributeSetInstanceExtensionField c, IAttributeSetInstanceExtensionFieldGroupCommand outerCommand, long version, IAttributeSetInstanceExtensionFieldGroupState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new AttributeSetInstanceExtensionFieldStateEventId(c.GroupId, c.Index, version);
            IAttributeSetInstanceExtensionFieldStateMergePatched e = NewAttributeSetInstanceExtensionFieldStateMergePatched(stateEventId);
            var s = outerState.Fields.Get(c.Index);

            e.Name                         = c.Name;
            e.Type                         = c.Type;
            e.Length                       = c.Length;
            e.Alias                        = c.Alias;
            e.Description                  = c.Description;
            e.Active                       = c.Active;
            e.IsPropertyNameRemoved        = c.IsPropertyNameRemoved;
            e.IsPropertyTypeRemoved        = c.IsPropertyTypeRemoved;
            e.IsPropertyLengthRemoved      = c.IsPropertyLengthRemoved;
            e.IsPropertyAliasRemoved       = c.IsPropertyAliasRemoved;
            e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved;
            e.IsPropertyActiveRemoved      = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
示例#3
0
        public virtual AttributeSetInstanceExtensionFieldStateMergePatchedDto ToAttributeSetInstanceExtensionFieldStateMergePatchedDto(IAttributeSetInstanceExtensionFieldStateMergePatched e)
        {
            var dto = new AttributeSetInstanceExtensionFieldStateMergePatchedDto();

            dto.AttributeSetInstanceExtensionFieldEventId = e.AttributeSetInstanceExtensionFieldEventId;
            dto.CreatedAt                    = e.CreatedAt;
            dto.CreatedBy                    = e.CreatedBy;
            dto.CommandId                    = e.CommandId;
            dto.Type                         = e.Type;
            dto.Length                       = e.Length;
            dto.Alias                        = e.Alias;
            dto.Description                  = e.Description;
            dto.GroupId                      = e.GroupId;
            dto.Active                       = e.Active;
            dto.IsPropertyTypeRemoved        = e.IsPropertyTypeRemoved;
            dto.IsPropertyLengthRemoved      = e.IsPropertyLengthRemoved;
            dto.IsPropertyAliasRemoved       = e.IsPropertyAliasRemoved;
            dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyGroupIdRemoved     = e.IsPropertyGroupIdRemoved;
            dto.IsPropertyActiveRemoved      = e.IsPropertyActiveRemoved;

            return(dto);
        }
示例#4
0
        public virtual void When(IAttributeSetInstanceExtensionFieldStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.Type == null)
            {
                if (e.IsPropertyTypeRemoved)
                {
                    this.Type = default(string);
                }
            }
            else
            {
                this.Type = e.Type;
            }

            if (e.Length == null)
            {
                if (e.IsPropertyLengthRemoved)
                {
                    this.Length = default(int?);
                }
            }
            else
            {
                this.Length = e.Length;
            }

            if (e.Alias == null)
            {
                if (e.IsPropertyAliasRemoved)
                {
                    this.Alias = default(string);
                }
            }
            else
            {
                this.Alias = e.Alias;
            }

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

            if (e.GroupId == null)
            {
                if (e.IsPropertyGroupIdRemoved)
                {
                    this.GroupId = default(string);
                }
            }
            else
            {
                this.GroupId = e.GroupId;
            }

            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;
        }
示例#5
0
 void IAttributeSetInstanceExtensionFieldState.When(IAttributeSetInstanceExtensionFieldStateMergePatched e)
 {
     throw new NotSupportedException();
 }
        public virtual void MergePatch(IMergePatchAttributeSetInstanceExtensionField c)
        {
            IAttributeSetInstanceExtensionFieldStateMergePatched e = Map(c);

            Apply(e);
        }