Example #1
0
        protected virtual IMovementConfirmationStateCreated Map(ICreateMovementConfirmation c)
        {
            var stateEventId = new MovementConfirmationEventId(c.DocumentNumber, c.Version);
            IMovementConfirmationStateCreated e = NewMovementConfirmationStateCreated(stateEventId);

            NewMovementConfirmationDocumentActionCommandAndExecute(c, _state, e);
            e.MovementDocumentNumber = c.MovementDocumentNumber;
            e.IsApproved             = c.IsApproved;
            e.ApprovalAmount         = c.ApprovalAmount;
            e.Processed      = c.Processed;
            e.Processing     = c.Processing;
            e.DocumentTypeId = c.DocumentTypeId;
            e.Description    = c.Description;
            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 (ICreateMovementConfirmationLine innerCommand in c.MovementConfirmationLines)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IMovementConfirmationLineStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddMovementConfirmationLineEvent(innerEvent);
            }


            return(e);
        }
Example #2
0
        protected MovementConfirmationStateDeleted NewMovementConfirmationStateDeleted(long version, string commandId, string requesterId)
        {
            var stateEventId = new MovementConfirmationEventId(_state.DocumentNumber, version);
            var e            = NewMovementConfirmationStateDeleted(stateEventId);

            e.CommandId = commandId;

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

            return(e);
        }
Example #3
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);
        }
Example #4
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            MovementConfirmationEventId other = obj as MovementConfirmationEventId;

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

            return(true &&
                   Object.Equals(this.DocumentNumber, other.DocumentNumber) &&
                   Object.Equals(this.Version, other.Version)
                   );
        }
Example #5
0
        protected virtual IMovementConfirmationStateMergePatched Map(IMergePatchMovementConfirmation c)
        {
            var stateEventId = new MovementConfirmationEventId(c.DocumentNumber, c.Version);
            IMovementConfirmationStateMergePatched e = NewMovementConfirmationStateMergePatched(stateEventId);

            e.MovementDocumentNumber = c.MovementDocumentNumber;
            e.IsApproved             = c.IsApproved;
            e.ApprovalAmount         = c.ApprovalAmount;
            e.Processed      = c.Processed;
            e.Processing     = c.Processing;
            e.DocumentTypeId = c.DocumentTypeId;
            e.Description    = c.Description;
            e.Active         = c.Active;
            e.IsPropertyMovementDocumentNumberRemoved = c.IsPropertyMovementDocumentNumberRemoved;
            e.IsPropertyIsApprovedRemoved             = c.IsPropertyIsApprovedRemoved;
            e.IsPropertyApprovalAmountRemoved         = c.IsPropertyApprovalAmountRemoved;
            e.IsPropertyProcessedRemoved      = c.IsPropertyProcessedRemoved;
            e.IsPropertyProcessingRemoved     = c.IsPropertyProcessingRemoved;
            e.IsPropertyDocumentTypeIdRemoved = c.IsPropertyDocumentTypeIdRemoved;
            e.IsPropertyDescriptionRemoved    = c.IsPropertyDescriptionRemoved;
            e.IsPropertyActiveRemoved         = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


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

            var version = c.Version;

            foreach (IMovementConfirmationLineCommand innerCommand in c.MovementConfirmationLineCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IMovementConfirmationLineEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddMovementConfirmationLineEvent(innerEvent);
            }


            return(e);
        }
Example #6
0
 protected MovementConfirmationEventBase(MovementConfirmationEventId stateEventId)
 {
     this.MovementConfirmationEventId = stateEventId;
 }
Example #7
0
 public MovementConfirmationStateDeleted(MovementConfirmationEventId stateEventId) : base(stateEventId)
 {
 }
Example #8
0
 public MovementConfirmationStateMergePatched(MovementConfirmationEventId stateEventId) : base(stateEventId)
 {
 }
Example #9
0
 protected MovementConfirmationStateEventBase(MovementConfirmationEventId stateEventId) : base(stateEventId)
 {
 }
Example #10
0
 private MovementConfirmationStateDeleted NewMovementConfirmationStateDeleted(MovementConfirmationEventId stateEventId)
 {
     return(new MovementConfirmationStateDeleted(stateEventId));
 }
Example #11
0
 private MovementConfirmationStateMergePatched NewMovementConfirmationStateMergePatched(MovementConfirmationEventId stateEventId)
 {
     return(new MovementConfirmationStateMergePatched(stateEventId));
 }