public virtual void When(IOrganizationStructureTypeStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

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

            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;
        }
        protected virtual IOrganizationStructureTypeStateMergePatched Map(IMergePatchOrganizationStructureType c)
        {
            var stateEventId = new OrganizationStructureTypeStateEventId(c.Id, c.Version);
            IOrganizationStructureTypeStateMergePatched e = NewOrganizationStructureTypeStateMergePatched(stateEventId);

            e.Active = c.Active;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;

            var version = c.Version;


            return(e);
        }
Example #3
0
        protected virtual IOrganizationStructureTypeStateMergePatched Map(IMergePatchOrganizationStructureType c)
        {
            var stateEventId = new OrganizationStructureTypeEventId(c.Id, c.Version);
            IOrganizationStructureTypeStateMergePatched e = NewOrganizationStructureTypeStateMergePatched(stateEventId);

            e.Description = c.Description;
            e.Active      = c.Active;
            e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved;
            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);
        }
        public virtual void MergePatch(IMergePatchOrganizationStructureType c)
        {
            IOrganizationStructureTypeStateMergePatched e = Map(c);

            Apply(e);
        }
        public virtual OrganizationStructureTypeStateMergePatchedDto ToOrganizationStructureTypeStateMergePatchedDto(IOrganizationStructureTypeStateMergePatched e)
        {
            var dto = new OrganizationStructureTypeStateMergePatchedDto();

            dto.StateEventId            = new OrganizationStructureTypeStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt               = e.CreatedAt;
            dto.CreatedBy               = e.CreatedBy;
            dto.CommandId               = e.CommandId;
            dto.Active                  = e.Active;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

            return(dto);
        }
 void IOrganizationStructureTypeState.When(IOrganizationStructureTypeStateMergePatched e)
 {
     throw new NotSupportedException();
 }