Ejemplo n.º 1
0
        protected virtual ILocatorStateCreated Map(ICreateLocator c)
        {
            var stateEventId       = new LocatorEventId(c.LocatorId, c.Version);
            ILocatorStateCreated e = NewLocatorStateCreated(stateEventId);

            e.WarehouseId     = c.WarehouseId;
            e.ParentLocatorId = c.ParentLocatorId;
            e.LocatorType     = c.LocatorType;
            e.PriorityNumber  = c.PriorityNumber;
            e.IsDefault       = c.IsDefault;
            e.X             = c.X;
            e.Y             = c.Y;
            e.Z             = c.Z;
            e.Description   = c.Description;
            e.LocatorTypeId = c.LocatorTypeId;
            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);
        }
Ejemplo n.º 2
0
        public virtual void When(ILocatorStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.WarehouseId = e.WarehouseId;

            this.ParentLocatorId = e.ParentLocatorId;

            this.LocatorType = e.LocatorType;

            this.PriorityNumber = e.PriorityNumber;

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

            this.X = e.X;

            this.Y = e.Y;

            this.Z = e.Z;

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Ejemplo n.º 3
0
        public virtual void Initialize(ILocatorStateCreated stateCreated)
        {
            var aggregateId = stateCreated.LocatorEventId.LocatorId;
            var state       = new LocatorState();

            state.LocatorId = aggregateId;
            var aggregate = (LocatorAggregate)GetLocatorAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
        public virtual LocatorStateCreatedDto ToLocatorStateCreatedDto(ILocatorStateCreated e)
        {
            var dto = new LocatorStateCreatedDto();

            dto.StateEventId    = new LocatorStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt       = e.CreatedAt;
            dto.CreatedBy       = e.CreatedBy;
            dto.CommandId       = e.CommandId;
            dto.WarehouseId     = e.WarehouseId;
            dto.ParentLocatorId = e.ParentLocatorId;
            dto.LocatorType     = e.LocatorType;
            dto.PriorityNumber  = e.PriorityNumber;
            dto.IsDefault       = e.IsDefault;
            dto.X      = e.X;
            dto.Y      = e.Y;
            dto.Z      = e.Z;
            dto.Active = e.Active;
            return(dto);
        }
Ejemplo n.º 5
0
        protected virtual ILocatorStateCreated Map(ICreateLocator c)
        {
            var stateEventId       = new LocatorStateEventId(c.LocatorId, c.Version);
            ILocatorStateCreated e = NewLocatorStateCreated(stateEventId);

            e.WarehouseId     = c.WarehouseId;
            e.ParentLocatorId = c.ParentLocatorId;
            e.LocatorType     = c.LocatorType;
            e.PriorityNumber  = c.PriorityNumber;
            e.IsDefault       = c.IsDefault;
            e.X         = c.X;
            e.Y         = c.Y;
            e.Z         = c.Z;
            e.Active    = c.Active;
            e.CommandId = c.CommandId;


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


            return(e);
        }
Ejemplo n.º 6
0
 void ILocatorState.When(ILocatorStateCreated e)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 7
0
        public virtual void Create(ICreateLocator c)
        {
            ILocatorStateCreated e = Map(c);

            Apply(e);
        }