public virtual void Initialize(IShipmentMethodTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.ShipmentMethodTypeEventId.ShipmentMethodTypeId;
            var state       = new ShipmentMethodTypeState();

            state.ShipmentMethodTypeId = aggregateId;
            var aggregate = (ShipmentMethodTypeAggregate)GetShipmentMethodTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Esempio n. 2
0
        public virtual void When(IShipmentMethodTypeStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Description = e.Description;

            this.SequenceNum = e.SequenceNum;

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Esempio n. 3
0
        protected virtual IShipmentMethodTypeStateCreated Map(ICreateShipmentMethodType c)
        {
            var stateEventId = new ShipmentMethodTypeEventId(c.ShipmentMethodTypeId, c.Version);
            IShipmentMethodTypeStateCreated e = NewShipmentMethodTypeStateCreated(stateEventId);

            e.Description = c.Description;
            e.SequenceNum = c.SequenceNum;
            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);
        }
Esempio n. 4
0
        public virtual ShipmentMethodTypeStateCreatedDto ToShipmentMethodTypeStateCreatedDto(IShipmentMethodTypeStateCreated e)
        {
            var dto = new ShipmentMethodTypeStateCreatedDto();

            dto.ShipmentMethodTypeEventId = e.ShipmentMethodTypeEventId;
            dto.CreatedAt   = e.CreatedAt;
            dto.CreatedBy   = e.CreatedBy;
            dto.CommandId   = e.CommandId;
            dto.Description = e.Description;
            dto.SequenceNum = e.SequenceNum;
            dto.Active      = e.Active;
            return(dto);
        }
Esempio n. 5
0
        public virtual void Create(ICreateShipmentMethodType c)
        {
            IShipmentMethodTypeStateCreated e = Map(c);

            Apply(e);
        }
 void IShipmentMethodTypeState.When(IShipmentMethodTypeStateCreated e)
 {
     throw new NotSupportedException();
 }