Example #1
0
        protected MovementStateDeleted NewMovementStateDeleted(long version, string commandId, string requesterId)
        {
            var stateEventId = new MovementEventId(_state.DocumentNumber, version);
            var e            = NewMovementStateDeleted(stateEventId);

            e.CommandId = commandId;

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

            return(e);
        }
Example #2
0
        protected virtual IMovementStateDeleted Map(IDeleteMovement c)
        {
            var stateEventId        = new MovementEventId(c.DocumentNumber, c.Version);
            IMovementStateDeleted e = NewMovementStateDeleted(stateEventId);

            e.CommandId = c.CommandId;


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


            return(e);
        }
Example #3
0
        protected virtual IMovementStateCreated Map(ICreateMovement c)
        {
            var stateEventId        = new MovementEventId(c.DocumentNumber, c.Version);
            IMovementStateCreated e = NewMovementStateCreated(stateEventId);

            NewMovementDocumentActionCommandAndExecute(c, _state, e);
            e.MovementDate           = c.MovementDate;
            e.Posted                 = c.Posted;
            e.Processed              = c.Processed;
            e.Processing             = c.Processing;
            e.DateReceived           = c.DateReceived;
            e.DocumentTypeId         = c.DocumentTypeId;
            e.IsInTransit            = c.IsInTransit;
            e.IsApproved             = c.IsApproved;
            e.ApprovalAmount         = c.ApprovalAmount;
            e.ShipperId              = c.ShipperId;
            e.SalesRepresentativeId  = c.SalesRepresentativeId;
            e.BusinessPartnerId      = c.BusinessPartnerId;
            e.ChargeAmount           = c.ChargeAmount;
            e.CreateFrom             = c.CreateFrom;
            e.FreightAmount          = c.FreightAmount;
            e.ReversalDocumentNumber = c.ReversalDocumentNumber;
            e.WarehouseIdFrom        = c.WarehouseIdFrom;
            e.WarehouseIdTo          = c.WarehouseIdTo;
            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 (ICreateMovementLine innerCommand in c.MovementLines)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IMovementLineStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddMovementLineEvent(innerEvent);
            }


            return(e);
        }
Example #4
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            MovementEventId other = obj as MovementEventId;

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

            return(true &&
                   Object.Equals(this.DocumentNumber, other.DocumentNumber) &&
                   Object.Equals(this.Version, other.Version)
                   );
        }
Example #5
0
 protected MovementEventBase(MovementEventId stateEventId)
 {
     this.MovementEventId = stateEventId;
 }
Example #6
0
 public MovementStateDeleted(MovementEventId stateEventId) : base(stateEventId)
 {
 }
Example #7
0
 public MovementStateMergePatched(MovementEventId stateEventId) : base(stateEventId)
 {
 }
Example #8
0
 public MovementStateCreated(MovementEventId stateEventId) : base(stateEventId)
 {
 }
Example #9
0
 protected MovementStateEventBase(MovementEventId stateEventId) : base(stateEventId)
 {
 }
Example #10
0
 private MovementStateDeleted NewMovementStateDeleted(MovementEventId stateEventId)
 {
     return(new MovementStateDeleted(stateEventId));
 }
Example #11
0
 private MovementStateMergePatched NewMovementStateMergePatched(MovementEventId stateEventId)
 {
     return(new MovementStateMergePatched(stateEventId));
 }