Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public virtual void When(IShipmentPackageContentStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Quantity = e.Quantity;

            this.SubProductId = e.SubProductId;

            this.SubProductQuantity = e.SubProductQuantity;

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Ejemplo n.º 3
0
        protected virtual IShipmentPackageContentStateCreated MapCreate(ICreateShipmentPackageContent c, IShipmentPackageCommand outerCommand, long version, IShipmentPackageState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentPackageContentEventId(c.ShipmentPackageId, c.ShipmentItemSeqId, version);
            IShipmentPackageContentStateCreated e = NewShipmentPackageContentStateCreated(stateEventId);
            var s = outerState.ShipmentPackageContents.Get(c.ShipmentItemSeqId, true);

            e.Quantity           = c.Quantity;
            e.SubProductId       = c.SubProductId;
            e.SubProductQuantity = c.SubProductQuantity;
            e.Active             = c.Active;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(ICreate... ////////////////////////////
Ejemplo n.º 4
0
 public virtual void AddShipmentPackageContentEvent(IShipmentPackageContentStateCreated e)
 {
     ThrowOnInconsistentEventIds(e);
     this._shipmentPackageContentEvents[e.ShipmentPackageContentEventId] = e;
 }
 void IShipmentPackageContentState.When(IShipmentPackageContentStateCreated e)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 6
0
        public virtual ShipmentPackageContentStateCreatedDto ToShipmentPackageContentStateCreatedDto(IShipmentPackageContentStateCreated e)
        {
            var dto = new ShipmentPackageContentStateCreatedDto();

            dto.ShipmentPackageContentEventId = e.ShipmentPackageContentEventId;
            dto.CreatedAt          = e.CreatedAt;
            dto.CreatedBy          = e.CreatedBy;
            dto.Version            = e.Version;
            dto.CommandId          = e.CommandId;
            dto.Quantity           = e.Quantity;
            dto.SubProductId       = e.SubProductId;
            dto.SubProductQuantity = e.SubProductQuantity;
            dto.Active             = e.Active;
            return(dto);
        }
Ejemplo n.º 7
0
 void IShipmentPackageStateCreated.AddShipmentPackageContentEvent(IShipmentPackageContentStateCreated e)
 {
     this._shipmentPackageContentEvents.AddShipmentPackageContentEvent(e);
 }