Exemplo n.º 1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IMovementConfirmationLineStateMergePatched MapMergePatch(IMergePatchMovementConfirmationLine c, IMovementConfirmationCommand outerCommand, long version, IMovementConfirmationState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new MovementConfirmationLineEventId(c.MovementConfirmationDocumentNumber, c.LineNumber, version);
            IMovementConfirmationLineStateMergePatched e = NewMovementConfirmationLineStateMergePatched(stateEventId);
            var s = outerState.MovementConfirmationLines.Get(c.LineNumber);

            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.Active             = c.Active;
            e.IsPropertyMovementLineNumberRemoved = c.IsPropertyMovementLineNumberRemoved;
            e.IsPropertyTargetQuantityRemoved     = c.IsPropertyTargetQuantityRemoved;
            e.IsPropertyConfirmedQuantityRemoved  = c.IsPropertyConfirmedQuantityRemoved;
            e.IsPropertyDifferenceQuantityRemoved = c.IsPropertyDifferenceQuantityRemoved;
            e.IsPropertyScrappedQuantityRemoved   = c.IsPropertyScrappedQuantityRemoved;
            e.IsPropertyDescriptionRemoved        = c.IsPropertyDescriptionRemoved;
            e.IsPropertyProcessedRemoved          = c.IsPropertyProcessedRemoved;
            e.IsPropertyActiveRemoved             = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Exemplo n.º 2
0
        public virtual void When(IMovementConfirmationLineStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.MovementLineNumber == null)
            {
                if (e.IsPropertyMovementLineNumberRemoved)
                {
                    this.MovementLineNumber = default(string);
                }
            }
            else
            {
                this.MovementLineNumber = e.MovementLineNumber;
            }

            if (e.TargetQuantity == null)
            {
                if (e.IsPropertyTargetQuantityRemoved)
                {
                    this.TargetQuantity = default(decimal);
                }
            }
            else
            {
                this.TargetQuantity = (e.TargetQuantity != null && e.TargetQuantity.HasValue) ? e.TargetQuantity.Value : default(decimal);
            }

            if (e.ConfirmedQuantity == null)
            {
                if (e.IsPropertyConfirmedQuantityRemoved)
                {
                    this.ConfirmedQuantity = default(decimal);
                }
            }
            else
            {
                this.ConfirmedQuantity = (e.ConfirmedQuantity != null && e.ConfirmedQuantity.HasValue) ? e.ConfirmedQuantity.Value : default(decimal);
            }

            if (e.DifferenceQuantity == null)
            {
                if (e.IsPropertyDifferenceQuantityRemoved)
                {
                    this.DifferenceQuantity = default(decimal);
                }
            }
            else
            {
                this.DifferenceQuantity = (e.DifferenceQuantity != null && e.DifferenceQuantity.HasValue) ? e.DifferenceQuantity.Value : default(decimal);
            }

            if (e.ScrappedQuantity == null)
            {
                if (e.IsPropertyScrappedQuantityRemoved)
                {
                    this.ScrappedQuantity = default(decimal);
                }
            }
            else
            {
                this.ScrappedQuantity = (e.ScrappedQuantity != null && e.ScrappedQuantity.HasValue) ? e.ScrappedQuantity.Value : default(decimal);
            }

            if (e.Description == null)
            {
                if (e.IsPropertyDescriptionRemoved)
                {
                    this.Description = default(string);
                }
            }
            else
            {
                this.Description = e.Description;
            }

            if (e.Processed == null)
            {
                if (e.IsPropertyProcessedRemoved)
                {
                    this.Processed = default(bool);
                }
            }
            else
            {
                this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool);
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }
        public virtual MovementConfirmationLineStateMergePatchedDto ToMovementConfirmationLineStateMergePatchedDto(IMovementConfirmationLineStateMergePatched e)
        {
            var dto = new MovementConfirmationLineStateMergePatchedDto();

            dto.MovementConfirmationLineEventId = e.MovementConfirmationLineEventId;
            dto.CreatedAt          = e.CreatedAt;
            dto.CreatedBy          = e.CreatedBy;
            dto.Version            = e.Version;
            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.Active             = e.Active;
            dto.IsPropertyMovementLineNumberRemoved = e.IsPropertyMovementLineNumberRemoved;
            dto.IsPropertyTargetQuantityRemoved     = e.IsPropertyTargetQuantityRemoved;
            dto.IsPropertyConfirmedQuantityRemoved  = e.IsPropertyConfirmedQuantityRemoved;
            dto.IsPropertyDifferenceQuantityRemoved = e.IsPropertyDifferenceQuantityRemoved;
            dto.IsPropertyScrappedQuantityRemoved   = e.IsPropertyScrappedQuantityRemoved;
            dto.IsPropertyDescriptionRemoved        = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyProcessedRemoved          = e.IsPropertyProcessedRemoved;
            dto.IsPropertyActiveRemoved             = e.IsPropertyActiveRemoved;

            return(dto);
        }
Exemplo n.º 4
0
 void IMovementConfirmationLineState.When(IMovementConfirmationLineStateMergePatched e)
 {
     throw new NotSupportedException();
 }