示例#1
0
        public virtual void When(IDamageHandlingMethodStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

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

            if (e.SequenceId == null)
            {
                if (e.IsPropertySequenceIdRemoved)
                {
                    this.SequenceId = default(string);
                }
            }
            else
            {
                this.SequenceId = e.SequenceId;
            }

            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;
        }
示例#2
0
        protected virtual IDamageHandlingMethodStateMergePatched Map(IMergePatchDamageHandlingMethod c)
        {
            var stateEventId = new DamageHandlingMethodEventId(c.DamageHandlingMethodId, c.Version);
            IDamageHandlingMethodStateMergePatched e = NewDamageHandlingMethodStateMergePatched(stateEventId);

            e.Description = c.Description;
            e.SequenceId  = c.SequenceId;
            e.Active      = c.Active;
            e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved;
            e.IsPropertySequenceIdRemoved  = c.IsPropertySequenceIdRemoved;
            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);
        }
示例#3
0
        public virtual DamageHandlingMethodStateMergePatchedDto ToDamageHandlingMethodStateMergePatchedDto(IDamageHandlingMethodStateMergePatched e)
        {
            var dto = new DamageHandlingMethodStateMergePatchedDto();

            dto.DamageHandlingMethodEventId = e.DamageHandlingMethodEventId;
            dto.CreatedAt   = e.CreatedAt;
            dto.CreatedBy   = e.CreatedBy;
            dto.CommandId   = e.CommandId;
            dto.Description = e.Description;
            dto.SequenceId  = e.SequenceId;
            dto.Active      = e.Active;
            dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved;
            dto.IsPropertySequenceIdRemoved  = e.IsPropertySequenceIdRemoved;
            dto.IsPropertyActiveRemoved      = e.IsPropertyActiveRemoved;

            return(dto);
        }
示例#4
0
        public virtual void MergePatch(IMergePatchDamageHandlingMethod c)
        {
            IDamageHandlingMethodStateMergePatched e = Map(c);

            Apply(e);
        }
 void IDamageHandlingMethodState.When(IDamageHandlingMethodStateMergePatched e)
 {
     throw new NotSupportedException();
 }