public virtual void When(IMovementConfirmationLineMvoStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.MovementLineNumber = e.MovementLineNumber;

            this.TargetQuantity = (e.TargetQuantity != null && e.TargetQuantity.HasValue) ? e.TargetQuantity.Value : default(decimal);

            this.ConfirmedQuantity = (e.ConfirmedQuantity != null && e.ConfirmedQuantity.HasValue) ? e.ConfirmedQuantity.Value : default(decimal);

            this.DifferenceQuantity = (e.DifferenceQuantity != null && e.DifferenceQuantity.HasValue) ? e.DifferenceQuantity.Value : default(decimal);

            this.ScrappedQuantity = (e.ScrappedQuantity != null && e.ScrappedQuantity.HasValue) ? e.ScrappedQuantity.Value : default(decimal);

            this.Description = e.Description;

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

            this.Version = (e.Version != null && e.Version.HasValue) ? e.Version.Value : default(long);

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

            this.MovementConfirmationDocumentStatusId = e.MovementConfirmationDocumentStatusId;

            this.MovementConfirmationMovementDocumentNumber = e.MovementConfirmationMovementDocumentNumber;

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

            this.MovementConfirmationApprovalAmount = (e.MovementConfirmationApprovalAmount != null && e.MovementConfirmationApprovalAmount.HasValue) ? e.MovementConfirmationApprovalAmount.Value : default(decimal);

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

            this.MovementConfirmationProcessing = e.MovementConfirmationProcessing;

            this.MovementConfirmationDocumentTypeId = e.MovementConfirmationDocumentTypeId;

            this.MovementConfirmationDescription = e.MovementConfirmationDescription;

            this.MovementConfirmationCreatedBy = e.MovementConfirmationCreatedBy;

            this.MovementConfirmationCreatedAt = (e.MovementConfirmationCreatedAt != null && e.MovementConfirmationCreatedAt.HasValue) ? e.MovementConfirmationCreatedAt.Value : default(DateTime);

            this.MovementConfirmationUpdatedBy = e.MovementConfirmationUpdatedBy;

            this.MovementConfirmationUpdatedAt = (e.MovementConfirmationUpdatedAt != null && e.MovementConfirmationUpdatedAt.HasValue) ? e.MovementConfirmationUpdatedAt.Value : default(DateTime);

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

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
        public virtual void Initialize(IMovementConfirmationLineMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.MovementConfirmationLineMvoEventId.MovementConfirmationLineId;
            var state       = new MovementConfirmationLineMvoState();

            state.MovementConfirmationLineId = aggregateId;
            var aggregate = (MovementConfirmationLineMvoAggregate)GetMovementConfirmationLineMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Beispiel #3
0
        protected virtual IMovementConfirmationLineMvoStateCreated Map(ICreateMovementConfirmationLineMvo c)
        {
            var stateEventId = new MovementConfirmationLineMvoEventId(c.MovementConfirmationLineId, c.MovementConfirmationVersion);
            IMovementConfirmationLineMvoStateCreated e = NewMovementConfirmationLineMvoStateCreated(stateEventId);

            e.MovementLineNumber = c.MovementLineNumber;
            e.TargetQuantity     = c.TargetQuantity;
            e.ConfirmedQuantity  = c.ConfirmedQuantity;
            e.DifferenceQuantity = c.DifferenceQuantity;
            e.ScrappedQuantity   = c.ScrappedQuantity;
            e.Description        = c.Description;
            e.Processed          = c.Processed;
            e.Version            = c.Version;
            e.Active             = c.Active;
            e.MovementConfirmationDocumentStatusId       = c.MovementConfirmationDocumentStatusId;
            e.MovementConfirmationMovementDocumentNumber = c.MovementConfirmationMovementDocumentNumber;
            e.MovementConfirmationIsApproved             = c.MovementConfirmationIsApproved;
            e.MovementConfirmationApprovalAmount         = c.MovementConfirmationApprovalAmount;
            e.MovementConfirmationProcessed      = c.MovementConfirmationProcessed;
            e.MovementConfirmationProcessing     = c.MovementConfirmationProcessing;
            e.MovementConfirmationDocumentTypeId = c.MovementConfirmationDocumentTypeId;
            e.MovementConfirmationDescription    = c.MovementConfirmationDescription;
            e.MovementConfirmationCreatedBy      = c.MovementConfirmationCreatedBy;
            e.MovementConfirmationCreatedAt      = c.MovementConfirmationCreatedAt;
            e.MovementConfirmationUpdatedBy      = c.MovementConfirmationUpdatedBy;
            e.MovementConfirmationUpdatedAt      = c.MovementConfirmationUpdatedAt;
            e.MovementConfirmationActive         = c.MovementConfirmationActive;
            e.MovementConfirmationDeleted        = c.MovementConfirmationDeleted;
            e.CommandId = c.CommandId;


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


            return(e);
        }
Beispiel #4
0
        public virtual void Create(ICreateMovementConfirmationLineMvo c)
        {
            IMovementConfirmationLineMvoStateCreated e = Map(c);

            Apply(e);
        }
 void IMovementConfirmationLineMvoState.When(IMovementConfirmationLineMvoStateCreated e)
 {
     throw new NotSupportedException();
 }
        public virtual MovementConfirmationLineMvoStateCreatedDto ToMovementConfirmationLineMvoStateCreatedDto(IMovementConfirmationLineMvoStateCreated e)
        {
            var dto = new MovementConfirmationLineMvoStateCreatedDto();

            dto.MovementConfirmationLineMvoEventId = e.MovementConfirmationLineMvoEventId;
            dto.CreatedAt          = e.CreatedAt;
            dto.CreatedBy          = e.CreatedBy;
            dto.CommandId          = e.CommandId;
            dto.MovementLineNumber = e.MovementLineNumber;
            dto.TargetQuantity     = e.TargetQuantity;
            dto.ConfirmedQuantity  = e.ConfirmedQuantity;
            dto.DifferenceQuantity = e.DifferenceQuantity;
            dto.ScrappedQuantity   = e.ScrappedQuantity;
            dto.Description        = e.Description;
            dto.Processed          = e.Processed;
            dto.Version            = e.Version;
            dto.Active             = e.Active;
            dto.MovementConfirmationDocumentStatusId       = e.MovementConfirmationDocumentStatusId;
            dto.MovementConfirmationMovementDocumentNumber = e.MovementConfirmationMovementDocumentNumber;
            dto.MovementConfirmationIsApproved             = e.MovementConfirmationIsApproved;
            dto.MovementConfirmationApprovalAmount         = e.MovementConfirmationApprovalAmount;
            dto.MovementConfirmationProcessed      = e.MovementConfirmationProcessed;
            dto.MovementConfirmationProcessing     = e.MovementConfirmationProcessing;
            dto.MovementConfirmationDocumentTypeId = e.MovementConfirmationDocumentTypeId;
            dto.MovementConfirmationDescription    = e.MovementConfirmationDescription;
            dto.MovementConfirmationCreatedBy      = e.MovementConfirmationCreatedBy;
            dto.MovementConfirmationCreatedAt      = e.MovementConfirmationCreatedAt;
            dto.MovementConfirmationUpdatedBy      = e.MovementConfirmationUpdatedBy;
            dto.MovementConfirmationUpdatedAt      = e.MovementConfirmationUpdatedAt;
            dto.MovementConfirmationActive         = e.MovementConfirmationActive;
            dto.MovementConfirmationDeleted        = e.MovementConfirmationDeleted;
            return(dto);
        }