Ejemplo n.º 1
0
        public virtual void When(IShipmentImageStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Url = e.Url;

            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.º 2
0
        public virtual ShipmentImageStateCreatedDto ToShipmentImageStateCreatedDto(IShipmentImageStateCreated e)
        {
            var dto = new ShipmentImageStateCreatedDto();

            dto.ShipmentImageEventId = e.ShipmentImageEventId;
            dto.CreatedAt            = e.CreatedAt;
            dto.CreatedBy            = e.CreatedBy;
            dto.Version   = e.Version;
            dto.CommandId = e.CommandId;
            dto.Url       = e.Url;
            dto.Active    = e.Active;
            return(dto);
        }
Ejemplo n.º 3
0
        protected virtual IShipmentImageStateCreated MapCreate(ICreateShipmentImage c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId             = new ShipmentImageEventId(c.ShipmentId, c.SequenceId, version);
            IShipmentImageStateCreated e = NewShipmentImageStateCreated(stateEventId);
            var s = outerState.ShipmentImages.Get(c.SequenceId, true);

            e.Url    = c.Url;
            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
        protected virtual IShipmentStateCreated Map(ICreateShipment c)
        {
            var stateEventId        = new ShipmentEventId(c.ShipmentId, c.Version);
            IShipmentStateCreated e = NewShipmentStateCreated(stateEventId);

            e.ShipmentTypeId        = c.ShipmentTypeId;
            e.StatusId              = c.StatusId;
            e.PrimaryOrderId        = c.PrimaryOrderId;
            e.PrimaryReturnId       = c.PrimaryReturnId;
            e.PrimaryShipGroupSeqId = c.PrimaryShipGroupSeqId;
            e.PicklistBinId         = c.PicklistBinId;
            e.BolNumber             = c.BolNumber;
            e.SealNumber            = c.SealNumber;
            e.VehicleId             = c.VehicleId;
            e.ExternalOrderNumber   = c.ExternalOrderNumber;
            e.Carrier                    = c.Carrier;
            e.DateShipped                = c.DateShipped;
            e.EstimatedReadyDate         = c.EstimatedReadyDate;
            e.EstimatedShipDate          = c.EstimatedShipDate;
            e.EstimatedShipWorkEffId     = c.EstimatedShipWorkEffId;
            e.EstimatedArrivalDate       = c.EstimatedArrivalDate;
            e.EstimatedArrivalWorkEffId  = c.EstimatedArrivalWorkEffId;
            e.LatestCancelDate           = c.LatestCancelDate;
            e.EstimatedShipCost          = c.EstimatedShipCost;
            e.CurrencyUomId              = c.CurrencyUomId;
            e.HandlingInstructions       = c.HandlingInstructions;
            e.OriginFacilityId           = c.OriginFacilityId;
            e.DestinationFacilityId      = c.DestinationFacilityId;
            e.OriginContactMechId        = c.OriginContactMechId;
            e.OriginTelecomNumberId      = c.OriginTelecomNumberId;
            e.DestinationContactMechId   = c.DestinationContactMechId;
            e.DestinationTelecomNumberId = c.DestinationTelecomNumberId;
            e.PartyIdTo                  = c.PartyIdTo;
            e.PartyIdFrom                = c.PartyIdFrom;
            e.AdditionalShippingCharge   = c.AdditionalShippingCharge;
            e.AddtlShippingChargeDesc    = c.AddtlShippingChargeDesc;
            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 (ICreateShipmentImage innerCommand in c.ShipmentImages)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentImageStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentImageEvent(innerEvent);
            }

            foreach (ICreateShipmentItem innerCommand in c.ShipmentItems)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentItemStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentItemEvent(innerEvent);
            }

            foreach (ICreateShipmentReceipt innerCommand in c.ShipmentReceipts)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentReceiptStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentReceiptEvent(innerEvent);
            }

            foreach (ICreateItemIssuance innerCommand in c.ItemIssuances)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IItemIssuanceStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddItemIssuanceEvent(innerEvent);
            }


            return(e);
        }
Ejemplo n.º 5
0
 public virtual void AddShipmentImageEvent(IShipmentImageStateCreated e)
 {
     ThrowOnInconsistentEventIds(e);
     this._shipmentImageEvents[e.ShipmentImageEventId] = e;
 }
Ejemplo n.º 6
0
 void IShipmentStateCreated.AddShipmentImageEvent(IShipmentImageStateCreated e)
 {
     this._shipmentImageEvents.AddShipmentImageEvent(e);
 }
Ejemplo n.º 7
0
 void IShipmentImageState.When(IShipmentImageStateCreated e)
 {
     throw new NotSupportedException();
 }