예제 #1
0
        protected virtual IShipmentPackageStateCreated Map(ICreateShipmentPackage c)
        {
            var stateEventId = new ShipmentPackageEventId(c.ShipmentPackageId, c.Version);
            IShipmentPackageStateCreated e = NewShipmentPackageStateCreated(stateEventId);

            e.ShipmentBoxTypeId = c.ShipmentBoxTypeId;
            e.DateCreated       = c.DateCreated;
            e.BoxLength         = c.BoxLength;
            e.BoxHeight         = c.BoxHeight;
            e.BoxWidth          = c.BoxWidth;
            e.DimensionUomId    = c.DimensionUomId;
            e.Weight            = c.Weight;
            e.WeightUomId       = c.WeightUomId;
            e.InsuredValue      = c.InsuredValue;
            e.Active            = c.Active;
            e.CommandId         = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            var version = c.Version;

            foreach (ICreateShipmentPackageContent innerCommand in c.ShipmentPackageContents)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentPackageContentStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentPackageContentEvent(innerEvent);
            }


            return(e);
        }
예제 #2
0
        protected ShipmentPackageStateDeleted NewShipmentPackageStateDeleted(long version, string commandId, string requesterId)
        {
            var stateEventId = new ShipmentPackageEventId(_state.ShipmentPackageId, version);
            var e            = NewShipmentPackageStateDeleted(stateEventId);

            e.CommandId = commandId;

            e.CreatedBy = (string)requesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            return(e);
        }
예제 #3
0
        protected virtual IShipmentPackageStateDeleted Map(IDeleteShipmentPackage c)
        {
            var stateEventId = new ShipmentPackageEventId(c.ShipmentPackageId, c.Version);
            IShipmentPackageStateDeleted e = NewShipmentPackageStateDeleted(stateEventId);

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();


            return(e);
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            ShipmentPackageEventId other = obj as ShipmentPackageEventId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.ShipmentPackageId, other.ShipmentPackageId) &&
                   Object.Equals(this.Version, other.Version)
                   );
        }
예제 #5
0
 protected ShipmentPackageEventBase(ShipmentPackageEventId stateEventId)
 {
     this.ShipmentPackageEventId = stateEventId;
 }
예제 #6
0
 public ShipmentPackageStateDeleted(ShipmentPackageEventId stateEventId) : base(stateEventId)
 {
 }
예제 #7
0
 public ShipmentPackageStateMergePatched(ShipmentPackageEventId stateEventId) : base(stateEventId)
 {
 }
예제 #8
0
 protected ShipmentPackageStateEventBase(ShipmentPackageEventId stateEventId) : base(stateEventId)
 {
 }
예제 #9
0
 private ShipmentPackageStateDeleted NewShipmentPackageStateDeleted(ShipmentPackageEventId stateEventId)
 {
     return(new ShipmentPackageStateDeleted(stateEventId));
 }
예제 #10
0
 private ShipmentPackageStateMergePatched NewShipmentPackageStateMergePatched(ShipmentPackageEventId stateEventId)
 {
     return(new ShipmentPackageStateMergePatched(stateEventId));
 }