示例#1
0
        protected virtual IAttributeUseMvoStateCreated Map(ICreateAttributeUseMvo c)
        {
            var stateEventId = new AttributeUseMvoStateEventId(c.AttributeSetAttributeUseId, c.AttributeSetVersion);
            IAttributeUseMvoStateCreated e = NewAttributeUseMvoStateCreated(stateEventId);

            e.SequenceNumber                      = c.SequenceNumber;
            e.Version                             = c.Version;
            e.Active                              = c.Active;
            e.AttributeSetName                    = c.AttributeSetName;
            e.AttributeSetOrganizationId          = c.AttributeSetOrganizationId;
            e.AttributeSetDescription             = c.AttributeSetDescription;
            e.AttributeSetSerialNumberAttributeId = c.AttributeSetSerialNumberAttributeId;
            e.AttributeSetLotAttributeId          = c.AttributeSetLotAttributeId;
            e.AttributeSetReferenceId             = c.AttributeSetReferenceId;
            e.AttributeSetCreatedBy               = c.AttributeSetCreatedBy;
            e.AttributeSetCreatedAt               = c.AttributeSetCreatedAt;
            e.AttributeSetUpdatedBy               = c.AttributeSetUpdatedBy;
            e.AttributeSetUpdatedAt               = c.AttributeSetUpdatedAt;
            e.AttributeSetActive                  = c.AttributeSetActive;
            e.AttributeSetDeleted                 = c.AttributeSetDeleted;
            e.CommandId                           = c.CommandId;


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


            return(e);
        }
示例#2
0
        protected virtual IAttributeUseMvoStateCreated Map(ICreateAttributeUseMvo c)
        {
            var stateEventId = new AttributeUseMvoEventId(c.AttributeSetAttributeUseId, c.AttributeSetVersion);
            IAttributeUseMvoStateCreated e = NewAttributeUseMvoStateCreated(stateEventId);

            e.SequenceNumber = c.SequenceNumber;
            e.Version        = c.Version;
            e.Active         = c.Active;
            e.AttributeSetAttributeSetName       = c.AttributeSetAttributeSetName;
            e.AttributeSetOrganizationId         = c.AttributeSetOrganizationId;
            e.AttributeSetDescription            = c.AttributeSetDescription;
            e.AttributeSetReferenceId            = c.AttributeSetReferenceId;
            e.AttributeSetIsInstanceAttributeSet = c.AttributeSetIsInstanceAttributeSet;
            e.AttributeSetIsMandatory            = c.AttributeSetIsMandatory;
            e.AttributeSetCreatedBy = c.AttributeSetCreatedBy;
            e.AttributeSetCreatedAt = c.AttributeSetCreatedAt;
            e.AttributeSetUpdatedBy = c.AttributeSetUpdatedBy;
            e.AttributeSetUpdatedAt = c.AttributeSetUpdatedAt;
            e.AttributeSetActive    = c.AttributeSetActive;
            e.AttributeSetDeleted   = c.AttributeSetDeleted;
            e.CommandId             = c.CommandId;


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


            return(e);
        }
        public virtual void Initialize(IAttributeUseMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.AttributeUseMvoEventId.AttributeSetAttributeUseId;
            var state       = new AttributeUseMvoState();

            state.AttributeSetAttributeUseId = aggregateId;
            var aggregate = (AttributeUseMvoAggregate)GetAttributeUseMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
示例#4
0
        public virtual void When(IAttributeUseMvoStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.SequenceNumber = (e.SequenceNumber != null && e.SequenceNumber.HasValue) ? e.SequenceNumber.Value : default(int);

            this.Version = (e.Version != null && e.Version.HasValue) ? e.Version.Value : default(long);

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

            this.AttributeSetName = e.AttributeSetName;

            this.AttributeSetOrganizationId = e.AttributeSetOrganizationId;

            this.AttributeSetDescription = e.AttributeSetDescription;

            this.AttributeSetSerialNumberAttributeId = e.AttributeSetSerialNumberAttributeId;

            this.AttributeSetLotAttributeId = e.AttributeSetLotAttributeId;

            this.AttributeSetReferenceId = e.AttributeSetReferenceId;

            this.AttributeSetCreatedBy = e.AttributeSetCreatedBy;

            this.AttributeSetCreatedAt = (e.AttributeSetCreatedAt != null && e.AttributeSetCreatedAt.HasValue) ? e.AttributeSetCreatedAt.Value : default(DateTime);

            this.AttributeSetUpdatedBy = e.AttributeSetUpdatedBy;

            this.AttributeSetUpdatedAt = (e.AttributeSetUpdatedAt != null && e.AttributeSetUpdatedAt.HasValue) ? e.AttributeSetUpdatedAt.Value : default(DateTime);

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

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
示例#5
0
        public virtual void Create(ICreateAttributeUseMvo c)
        {
            IAttributeUseMvoStateCreated e = Map(c);

            Apply(e);
        }
示例#6
0
 void IAttributeUseMvoState.When(IAttributeUseMvoStateCreated e)
 {
     throw new NotSupportedException();
 }
        public virtual AttributeUseMvoStateCreatedDto ToAttributeUseMvoStateCreatedDto(IAttributeUseMvoStateCreated e)
        {
            var dto = new AttributeUseMvoStateCreatedDto();

            dto.AttributeUseMvoEventId = e.AttributeUseMvoEventId;
            dto.CreatedAt      = e.CreatedAt;
            dto.CreatedBy      = e.CreatedBy;
            dto.CommandId      = e.CommandId;
            dto.SequenceNumber = e.SequenceNumber;
            dto.Version        = e.Version;
            dto.Active         = e.Active;
            dto.AttributeSetAttributeSetName       = e.AttributeSetAttributeSetName;
            dto.AttributeSetOrganizationId         = e.AttributeSetOrganizationId;
            dto.AttributeSetDescription            = e.AttributeSetDescription;
            dto.AttributeSetReferenceId            = e.AttributeSetReferenceId;
            dto.AttributeSetIsInstanceAttributeSet = e.AttributeSetIsInstanceAttributeSet;
            dto.AttributeSetIsMandatory            = e.AttributeSetIsMandatory;
            dto.AttributeSetCreatedBy = e.AttributeSetCreatedBy;
            dto.AttributeSetCreatedAt = e.AttributeSetCreatedAt;
            dto.AttributeSetUpdatedBy = e.AttributeSetUpdatedBy;
            dto.AttributeSetUpdatedAt = e.AttributeSetUpdatedAt;
            dto.AttributeSetActive    = e.AttributeSetActive;
            dto.AttributeSetDeleted   = e.AttributeSetDeleted;
            return(dto);
        }
示例#8
0
        public virtual AttributeUseMvoStateCreatedDto ToAttributeUseMvoStateCreatedDto(IAttributeUseMvoStateCreated e)
        {
            var dto = new AttributeUseMvoStateCreatedDto();

            dto.StateEventId                        = new AttributeUseMvoStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt                           = e.CreatedAt;
            dto.CreatedBy                           = e.CreatedBy;
            dto.CommandId                           = e.CommandId;
            dto.SequenceNumber                      = e.SequenceNumber;
            dto.Version                             = e.Version;
            dto.Active                              = e.Active;
            dto.AttributeSetName                    = e.AttributeSetName;
            dto.AttributeSetOrganizationId          = e.AttributeSetOrganizationId;
            dto.AttributeSetDescription             = e.AttributeSetDescription;
            dto.AttributeSetSerialNumberAttributeId = e.AttributeSetSerialNumberAttributeId;
            dto.AttributeSetLotAttributeId          = e.AttributeSetLotAttributeId;
            dto.AttributeSetReferenceId             = e.AttributeSetReferenceId;
            dto.AttributeSetCreatedBy               = e.AttributeSetCreatedBy;
            dto.AttributeSetCreatedAt               = e.AttributeSetCreatedAt;
            dto.AttributeSetUpdatedBy               = e.AttributeSetUpdatedBy;
            dto.AttributeSetUpdatedAt               = e.AttributeSetUpdatedAt;
            dto.AttributeSetActive                  = e.AttributeSetActive;
            dto.AttributeSetDeleted                 = e.AttributeSetDeleted;
            return(dto);
        }