예제 #1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IPhysicalInventoryLineStateMergePatched MapMergePatch(IMergePatchPhysicalInventoryLine c, IPhysicalInventoryCommand outerCommand, long version, IPhysicalInventoryState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new PhysicalInventoryLineEventId(c.PhysicalInventoryDocumentNumber, c.InventoryItemId, version);
            IPhysicalInventoryLineStateMergePatched e = NewPhysicalInventoryLineStateMergePatched(stateEventId);
            var s = outerState.PhysicalInventoryLines.Get(c.InventoryItemId);

            e.BookQuantity                        = c.BookQuantity;
            e.CountedQuantity                     = c.CountedQuantity;
            e.Processed                           = c.Processed;
            e.LineNumber                          = c.LineNumber;
            e.ReversalLineNumber                  = c.ReversalLineNumber;
            e.Description                         = c.Description;
            e.IsPropertyBookQuantityRemoved       = c.IsPropertyBookQuantityRemoved;
            e.IsPropertyCountedQuantityRemoved    = c.IsPropertyCountedQuantityRemoved;
            e.IsPropertyProcessedRemoved          = c.IsPropertyProcessedRemoved;
            e.IsPropertyLineNumberRemoved         = c.IsPropertyLineNumberRemoved;
            e.IsPropertyReversalLineNumberRemoved = c.IsPropertyReversalLineNumberRemoved;
            e.IsPropertyDescriptionRemoved        = c.IsPropertyDescriptionRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
예제 #2
0
 void IPhysicalInventoryLineState.When(IPhysicalInventoryLineStateMergePatched e)
 {
     throw new NotSupportedException();
 }
        public virtual PhysicalInventoryLineStateMergePatchedDto ToPhysicalInventoryLineStateMergePatchedDto(IPhysicalInventoryLineStateMergePatched e)
        {
            var dto = new PhysicalInventoryLineStateMergePatchedDto();

            dto.PhysicalInventoryLineEventId = e.PhysicalInventoryLineEventId;
            dto.CreatedAt                           = e.CreatedAt;
            dto.CreatedBy                           = e.CreatedBy;
            dto.Version                             = e.Version;
            dto.CommandId                           = e.CommandId;
            dto.BookQuantity                        = e.BookQuantity;
            dto.CountedQuantity                     = e.CountedQuantity;
            dto.Processed                           = e.Processed;
            dto.LineNumber                          = e.LineNumber;
            dto.ReversalLineNumber                  = e.ReversalLineNumber;
            dto.Description                         = e.Description;
            dto.IsPropertyBookQuantityRemoved       = e.IsPropertyBookQuantityRemoved;
            dto.IsPropertyCountedQuantityRemoved    = e.IsPropertyCountedQuantityRemoved;
            dto.IsPropertyProcessedRemoved          = e.IsPropertyProcessedRemoved;
            dto.IsPropertyLineNumberRemoved         = e.IsPropertyLineNumberRemoved;
            dto.IsPropertyReversalLineNumberRemoved = e.IsPropertyReversalLineNumberRemoved;
            dto.IsPropertyDescriptionRemoved        = e.IsPropertyDescriptionRemoved;

            return(dto);
        }
예제 #4
0
        public virtual void When(IPhysicalInventoryLineStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

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

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

            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.LineNumber == null)
            {
                if (e.IsPropertyLineNumberRemoved)
                {
                    this.LineNumber = default(string);
                }
            }
            else
            {
                this.LineNumber = e.LineNumber;
            }

            if (e.ReversalLineNumber == null)
            {
                if (e.IsPropertyReversalLineNumberRemoved)
                {
                    this.ReversalLineNumber = default(long);
                }
            }
            else
            {
                this.ReversalLineNumber = (e.ReversalLineNumber != null && e.ReversalLineNumber.HasValue) ? e.ReversalLineNumber.Value : default(long);
            }

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


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }