Ejemplo n.º 1
0
        protected virtual IMovementConfirmationStateDeleted Map(IDeleteMovementConfirmation c)
        {
            var stateEventId = new MovementConfirmationEventId(c.DocumentNumber, c.Version);
            IMovementConfirmationStateDeleted e = NewMovementConfirmationStateDeleted(stateEventId);

            e.CommandId = c.CommandId;


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


            return(e);
        }
Ejemplo n.º 2
0
        public virtual void When(IMovementConfirmationStateDeleted e)
        {
            ThrowOnWrongEvent(e);

            this.Deleted   = true;
            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;

            foreach (var innerState in this.MovementConfirmationLines)
            {
                this.MovementConfirmationLines.Remove(innerState);

                var innerE = e.NewMovementConfirmationLineStateRemoved(innerState.LineNumber);
                ((MovementConfirmationLineEventBase)innerE).CreatedAt = e.CreatedAt;
                ((MovementConfirmationLineEventBase)innerE).CreatedBy = e.CreatedBy;
                innerState.When(innerE);
                //e.AddMovementConfirmationLineEvent(innerE);
            }
        }
        public virtual MovementConfirmationStateDeletedDto ToMovementConfirmationStateDeletedDto(IMovementConfirmationStateDeleted e)
        {
            var dto = new MovementConfirmationStateDeletedDto();

            dto.MovementConfirmationEventId = e.MovementConfirmationEventId;
            dto.CreatedAt = e.CreatedAt;
            dto.CreatedBy = e.CreatedBy;
            dto.CommandId = e.CommandId;
            var movementConfirmationLineEvents = new List <MovementConfirmationLineStateRemovedDto>();

            foreach (var ee in e.MovementConfirmationLineEvents)
            {
                MovementConfirmationLineStateRemovedDto eeDto = MovementConfirmationLineStateEventDtoConverter.ToMovementConfirmationLineStateRemovedDto(ee);
                movementConfirmationLineEvents.Add(eeDto);
            }
            dto.MovementConfirmationLineEvents = movementConfirmationLineEvents.ToArray();


            return(dto);
        }
 public void AddMovementConfirmationEvent(IMovementConfirmationStateDeleted e)
 {
     _innerStateEvents.Add((MovementConfirmationStateDeletedDto)e);
 }
 void IMovementConfirmationState.When(IMovementConfirmationStateDeleted e)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 6
0
        public virtual void Delete(IDeleteMovementConfirmation c)
        {
            IMovementConfirmationStateDeleted e = Map(c);

            Apply(e);
        }