示例#1
0
        public virtual void Initialize(IShipmentPackageStateCreated stateCreated)
        {
            var aggregateId = stateCreated.ShipmentPackageEventId.ShipmentPackageId;
            var state       = new ShipmentPackageState();

            state.ShipmentPackageId = aggregateId;
            var aggregate = (ShipmentPackageAggregate)GetShipmentPackageAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
示例#2
0
        public virtual IShipmentPackageState ToShipmentPackageState()
        {
            var state = new ShipmentPackageState(true);

            state.ShipmentPackageId = this.ShipmentPackageId;
            state.ShipmentBoxTypeId = this.ShipmentBoxTypeId;
            state.DateCreated       = this.DateCreated;
            state.BoxLength         = this.BoxLength;
            state.BoxHeight         = this.BoxHeight;
            state.BoxWidth          = this.BoxWidth;
            state.DimensionUomId    = this.DimensionUomId;
            state.Weight            = this.Weight;
            state.WeightUomId       = this.WeightUomId;
            state.InsuredValue      = this.InsuredValue;
            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;
            }
            if (this.ShipmentPackageContents != null)
            {
                foreach (var s in this.ShipmentPackageContents)
                {
                    state.ShipmentPackageContents.AddToSave(s.ToShipmentPackageContentState());
                }
            }
            ;

            return(state);
        }
示例#3
0
 public static CreateShipmentPackage ToCreateShipmentPackage(this ShipmentPackageState state)
 {
     return(state.ToCreateShipmentPackage <CreateShipmentPackage, CreateShipmentPackageContent>());
 }
示例#4
0
 public static MergePatchShipmentPackage ToMergePatchShipmentPackage(this ShipmentPackageState state)
 {
     return(state.ToMergePatchShipmentPackage <MergePatchShipmentPackage, CreateShipmentPackageContent, MergePatchShipmentPackageContent>());
 }
示例#5
0
 public static DeleteShipmentPackage ToDeleteShipmentPackage(this ShipmentPackageState state)
 {
     return(state.ToDeleteShipmentPackage <DeleteShipmentPackage>());
 }
示例#6
0
 public static IShipmentPackageCommand ToCreateOrMergePatchShipmentPackage(this ShipmentPackageState state)
 {
     return(state.ToCreateOrMergePatchShipmentPackage <CreateShipmentPackage, MergePatchShipmentPackage, CreateShipmentPackageContent, MergePatchShipmentPackageContent>());
 }