예제 #1
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);
        }
예제 #2
0
        public virtual IFacilityState ToFacilityState()
        {
            var state = new FacilityState(true);

            state.FacilityId                 = this.FacilityId;
            state.FacilityTypeId             = this.FacilityTypeId;
            state.ParentFacilityId           = this.ParentFacilityId;
            state.OwnerPartyId               = this.OwnerPartyId;
            state.DefaultInventoryItemTypeId = this.DefaultInventoryItemTypeId;
            state.FacilityName               = this.FacilityName;
            state.PrimaryFacilityGroupId     = this.PrimaryFacilityGroupId;
            state.OldSquareFootage           = this.OldSquareFootage;
            state.FacilitySize               = this.FacilitySize;
            state.FacilitySizeUomId          = this.FacilitySizeUomId;
            state.ProductStoreId             = this.ProductStoreId;
            state.DefaultDaysToShip          = this.DefaultDaysToShip;
            state.OpenedDate                 = this.OpenedDate;
            state.ClosedDate                 = this.ClosedDate;
            state.Description                = this.Description;
            state.DefaultDimensionUomId      = this.DefaultDimensionUomId;
            state.DefaultWeightUomId         = this.DefaultWeightUomId;
            state.GeoPointId                 = this.GeoPointId;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
예제 #3
0
 public static CreateFacility ToCreateFacility(this FacilityState state)
 {
     return(state.ToCreateFacility <CreateFacility>());
 }
예제 #4
0
 public static MergePatchFacility ToMergePatchFacility(this FacilityState state)
 {
     return(state.ToMergePatchFacility <MergePatchFacility>());
 }
예제 #5
0
 public static DeleteFacility ToDeleteFacility(this FacilityState state)
 {
     return(state.ToDeleteFacility <DeleteFacility>());
 }
예제 #6
0
 public static IFacilityCommand ToCreateOrMergePatchFacility(this FacilityState state)
 {
     return(state.ToCreateOrMergePatchFacility <CreateFacility, MergePatchFacility>());
 }