示例#1
0
        protected virtual IFacilityStateCreated Map(ICreateFacility c)
        {
            var stateEventId        = new FacilityEventId(c.FacilityId, c.Version);
            IFacilityStateCreated e = NewFacilityStateCreated(stateEventId);

            e.FacilityTypeId             = c.FacilityTypeId;
            e.ParentFacilityId           = c.ParentFacilityId;
            e.OwnerPartyId               = c.OwnerPartyId;
            e.DefaultInventoryItemTypeId = c.DefaultInventoryItemTypeId;
            e.FacilityName               = c.FacilityName;
            e.PrimaryFacilityGroupId     = c.PrimaryFacilityGroupId;
            e.OldSquareFootage           = c.OldSquareFootage;
            e.FacilitySize               = c.FacilitySize;
            e.FacilitySizeUomId          = c.FacilitySizeUomId;
            e.ProductStoreId             = c.ProductStoreId;
            e.DefaultDaysToShip          = c.DefaultDaysToShip;
            e.OpenedDate            = c.OpenedDate;
            e.ClosedDate            = c.ClosedDate;
            e.Description           = c.Description;
            e.DefaultDimensionUomId = c.DefaultDimensionUomId;
            e.DefaultWeightUomId    = c.DefaultWeightUomId;
            e.GeoPointId            = c.GeoPointId;
            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);
        }
示例#2
0
        public virtual FacilityStateCreatedDto ToFacilityStateCreatedDto(IFacilityStateCreated e)
        {
            var dto = new FacilityStateCreatedDto();

            dto.FacilityEventId            = e.FacilityEventId;
            dto.CreatedAt                  = e.CreatedAt;
            dto.CreatedBy                  = e.CreatedBy;
            dto.CommandId                  = e.CommandId;
            dto.FacilityTypeId             = e.FacilityTypeId;
            dto.ParentFacilityId           = e.ParentFacilityId;
            dto.OwnerPartyId               = e.OwnerPartyId;
            dto.DefaultInventoryItemTypeId = e.DefaultInventoryItemTypeId;
            dto.FacilityName               = e.FacilityName;
            dto.PrimaryFacilityGroupId     = e.PrimaryFacilityGroupId;
            dto.OldSquareFootage           = e.OldSquareFootage;
            dto.FacilitySize               = e.FacilitySize;
            dto.FacilitySizeUomId          = e.FacilitySizeUomId;
            dto.ProductStoreId             = e.ProductStoreId;
            dto.DefaultDaysToShip          = e.DefaultDaysToShip;
            dto.OpenedDate                 = e.OpenedDate;
            dto.ClosedDate                 = e.ClosedDate;
            dto.Description                = e.Description;
            dto.DefaultDimensionUomId      = e.DefaultDimensionUomId;
            dto.DefaultWeightUomId         = e.DefaultWeightUomId;
            dto.GeoPointId                 = e.GeoPointId;
            dto.Active = e.Active;
            return(dto);
        }
示例#3
0
        public virtual void Initialize(IFacilityStateCreated stateCreated)
        {
            var aggregateId = stateCreated.FacilityEventId.FacilityId;
            var state       = new FacilityState();

            state.FacilityId = aggregateId;
            var aggregate = (FacilityAggregate)GetFacilityAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
示例#4
0
        public virtual void When(IFacilityStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.FacilityTypeId = e.FacilityTypeId;

            this.ParentFacilityId = e.ParentFacilityId;

            this.OwnerPartyId = e.OwnerPartyId;

            this.DefaultInventoryItemTypeId = e.DefaultInventoryItemTypeId;

            this.FacilityName = e.FacilityName;

            this.PrimaryFacilityGroupId = e.PrimaryFacilityGroupId;

            this.OldSquareFootage = e.OldSquareFootage;

            this.FacilitySize = e.FacilitySize;

            this.FacilitySizeUomId = e.FacilitySizeUomId;

            this.ProductStoreId = e.ProductStoreId;

            this.DefaultDaysToShip = e.DefaultDaysToShip;

            this.OpenedDate = e.OpenedDate;

            this.ClosedDate = e.ClosedDate;

            this.Description = e.Description;

            this.DefaultDimensionUomId = e.DefaultDimensionUomId;

            this.DefaultWeightUomId = e.DefaultWeightUomId;

            this.GeoPointId = e.GeoPointId;

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

            this.Deleted = false;

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

            Apply(e);
        }
示例#6
0
 void IFacilityState.When(IFacilityStateCreated e)
 {
     throw new NotSupportedException();
 }