public virtual void When(IOrganizationStructureTypeStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Example #2
0
        public virtual void Initialize(IOrganizationStructureTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.OrganizationStructureTypeEventId.Id;
            var state       = new OrganizationStructureTypeState();

            state.Id = aggregateId;
            var aggregate = (OrganizationStructureTypeAggregate)GetOrganizationStructureTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
        protected virtual IOrganizationStructureTypeStateCreated Map(ICreateOrganizationStructureType c)
        {
            var stateEventId = new OrganizationStructureTypeStateEventId(c.Id, c.Version);
            IOrganizationStructureTypeStateCreated e = NewOrganizationStructureTypeStateCreated(stateEventId);

            e.Active    = c.Active;
            e.CommandId = c.CommandId;


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


            return(e);
        }
Example #4
0
        protected virtual IOrganizationStructureTypeStateCreated Map(ICreateOrganizationStructureType c)
        {
            var stateEventId = new OrganizationStructureTypeEventId(c.Id, c.Version);
            IOrganizationStructureTypeStateCreated e = NewOrganizationStructureTypeStateCreated(stateEventId);

            e.Description = c.Description;
            e.Active      = c.Active;
            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 Create(ICreateOrganizationStructureType c)
        {
            IOrganizationStructureTypeStateCreated e = Map(c);

            Apply(e);
        }
        public virtual OrganizationStructureTypeStateCreatedDto ToOrganizationStructureTypeStateCreatedDto(IOrganizationStructureTypeStateCreated e)
        {
            var dto = new OrganizationStructureTypeStateCreatedDto();

            dto.StateEventId = new OrganizationStructureTypeStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt    = e.CreatedAt;
            dto.CreatedBy    = e.CreatedBy;
            dto.CommandId    = e.CommandId;
            dto.Active       = e.Active;
            return(dto);
        }
 void IOrganizationStructureTypeState.When(IOrganizationStructureTypeStateCreated e)
 {
     throw new NotSupportedException();
 }
        public virtual OrganizationStructureTypeStateCreatedDto ToOrganizationStructureTypeStateCreatedDto(IOrganizationStructureTypeStateCreated e)
        {
            var dto = new OrganizationStructureTypeStateCreatedDto();

            dto.OrganizationStructureTypeEventId = e.OrganizationStructureTypeEventId;
            dto.CreatedAt   = e.CreatedAt;
            dto.CreatedBy   = e.CreatedBy;
            dto.CommandId   = e.CommandId;
            dto.Description = e.Description;
            dto.Active      = e.Active;
            return(dto);
        }