public virtual void When(IShipmentReceiptImageStateCreated 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;
        }
Exemple #2
0
        protected virtual IShipmentReceiptImageStateCreated MapCreate(ICreateShipmentReceiptImage c, IShipmentReceiptCommand outerCommand, long version, IShipmentReceiptState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentReceiptImageEventId(c.ShipmentId, c.ShipmentReceiptReceiptSeqId, c.SequenceId, version);
            IShipmentReceiptImageStateCreated e = NewShipmentReceiptImageStateCreated(stateEventId);
            var s = outerState.ShipmentReceiptImages.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... ////////////////////////////
Exemple #3
0
        protected virtual IShipmentReceiptStateCreated MapCreate(ICreateShipmentReceipt c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentReceiptEventId(c.ShipmentId, c.ReceiptSeqId, version);
            IShipmentReceiptStateCreated e = NewShipmentReceiptStateCreated(stateEventId);
            var s = outerState.ShipmentReceipts.Get(c.ReceiptSeqId, true);

            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.LocatorId            = c.LocatorId;
            e.ShipmentItemSeqId    = c.ShipmentItemSeqId;
            e.ShipmentPackageSeqId = c.ShipmentPackageSeqId;
            e.OrderId           = c.OrderId;
            e.OrderItemSeqId    = c.OrderItemSeqId;
            e.ReturnId          = c.ReturnId;
            e.ReturnItemSeqId   = c.ReturnItemSeqId;
            e.RejectionReasonId = c.RejectionReasonId;
            e.DamageStatusIds   = c.DamageStatusIds;
            e.DamageReasonId    = c.DamageReasonId;
            e.ReceivedBy        = c.ReceivedBy;
            e.DatetimeReceived  = c.DatetimeReceived;
            e.ItemDescription   = c.ItemDescription;
            e.AcceptedQuantity  = c.AcceptedQuantity;
            e.RejectedQuantity  = c.RejectedQuantity;
            e.DamagedQuantity   = c.DamagedQuantity;
            e.Active            = c.Active;

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

            foreach (ICreateShipmentReceiptImage innerCommand in c.ShipmentReceiptImages)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentReceiptImageStateCreated innerEvent = MapCreate(innerCommand, c, version, s);
                e.AddShipmentReceiptImageEvent(innerEvent);
            }

            return(e);
        }// END Map(ICreate... ////////////////////////////
 void IShipmentReceiptStateCreated.AddShipmentReceiptImageEvent(IShipmentReceiptImageStateCreated e)
 {
     this._shipmentReceiptImageEvents.AddShipmentReceiptImageEvent(e);
 }
Exemple #5
0
 public virtual void AddShipmentReceiptImageEvent(IShipmentReceiptImageStateCreated e)
 {
     ThrowOnInconsistentEventIds(e);
     this._shipmentReceiptImageEvents[e.ShipmentReceiptImageEventId] = e;
 }
Exemple #6
0
 void IShipmentReceiptImageState.When(IShipmentReceiptImageStateCreated e)
 {
     throw new NotSupportedException();
 }
        public virtual ShipmentReceiptImageStateCreatedDto ToShipmentReceiptImageStateCreatedDto(IShipmentReceiptImageStateCreated e)
        {
            var dto = new ShipmentReceiptImageStateCreatedDto();

            dto.ShipmentReceiptImageEventId = e.ShipmentReceiptImageEventId;
            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);
        }