Exemplo n.º 1
0
        protected virtual ILocatorStateMergePatched Map(IMergePatchLocator c)
        {
            var stateEventId            = new LocatorStateEventId(c.LocatorId, c.Version);
            ILocatorStateMergePatched e = NewLocatorStateMergePatched(stateEventId);

            e.WarehouseId     = c.WarehouseId;
            e.ParentLocatorId = c.ParentLocatorId;
            e.LocatorType     = c.LocatorType;
            e.PriorityNumber  = c.PriorityNumber;
            e.IsDefault       = c.IsDefault;
            e.X      = c.X;
            e.Y      = c.Y;
            e.Z      = c.Z;
            e.Active = c.Active;
            e.IsPropertyWarehouseIdRemoved     = c.IsPropertyWarehouseIdRemoved;
            e.IsPropertyParentLocatorIdRemoved = c.IsPropertyParentLocatorIdRemoved;
            e.IsPropertyLocatorTypeRemoved     = c.IsPropertyLocatorTypeRemoved;
            e.IsPropertyPriorityNumberRemoved  = c.IsPropertyPriorityNumberRemoved;
            e.IsPropertyIsDefaultRemoved       = c.IsPropertyIsDefaultRemoved;
            e.IsPropertyXRemoved      = c.IsPropertyXRemoved;
            e.IsPropertyYRemoved      = c.IsPropertyYRemoved;
            e.IsPropertyZRemoved      = c.IsPropertyZRemoved;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;

            var version = c.Version;


            return(e);
        }
        public virtual LocatorStateMergePatchedDto ToLocatorStateMergePatchedDto(ILocatorStateMergePatched e)
        {
            var dto = new LocatorStateMergePatchedDto();

            dto.StateEventId    = new LocatorStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt       = e.CreatedAt;
            dto.CreatedBy       = e.CreatedBy;
            dto.CommandId       = e.CommandId;
            dto.WarehouseId     = e.WarehouseId;
            dto.ParentLocatorId = e.ParentLocatorId;
            dto.LocatorType     = e.LocatorType;
            dto.PriorityNumber  = e.PriorityNumber;
            dto.IsDefault       = e.IsDefault;
            dto.X      = e.X;
            dto.Y      = e.Y;
            dto.Z      = e.Z;
            dto.Active = e.Active;
            dto.IsPropertyWarehouseIdRemoved     = e.IsPropertyWarehouseIdRemoved;
            dto.IsPropertyParentLocatorIdRemoved = e.IsPropertyParentLocatorIdRemoved;
            dto.IsPropertyLocatorTypeRemoved     = e.IsPropertyLocatorTypeRemoved;
            dto.IsPropertyPriorityNumberRemoved  = e.IsPropertyPriorityNumberRemoved;
            dto.IsPropertyIsDefaultRemoved       = e.IsPropertyIsDefaultRemoved;
            dto.IsPropertyXRemoved      = e.IsPropertyXRemoved;
            dto.IsPropertyYRemoved      = e.IsPropertyYRemoved;
            dto.IsPropertyZRemoved      = e.IsPropertyZRemoved;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

            return(dto);
        }
Exemplo n.º 3
0
 void ILocatorState.When(ILocatorStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 4
0
        public virtual void MergePatch(IMergePatchLocator c)
        {
            ILocatorStateMergePatched e = Map(c);

            Apply(e);
        }
Exemplo n.º 5
0
        public virtual void When(ILocatorStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.WarehouseId == null)
            {
                if (e.IsPropertyWarehouseIdRemoved)
                {
                    this.WarehouseId = default(string);
                }
            }
            else
            {
                this.WarehouseId = e.WarehouseId;
            }

            if (e.ParentLocatorId == null)
            {
                if (e.IsPropertyParentLocatorIdRemoved)
                {
                    this.ParentLocatorId = default(string);
                }
            }
            else
            {
                this.ParentLocatorId = e.ParentLocatorId;
            }

            if (e.LocatorType == null)
            {
                if (e.IsPropertyLocatorTypeRemoved)
                {
                    this.LocatorType = default(string);
                }
            }
            else
            {
                this.LocatorType = e.LocatorType;
            }

            if (e.PriorityNumber == null)
            {
                if (e.IsPropertyPriorityNumberRemoved)
                {
                    this.PriorityNumber = default(string);
                }
            }
            else
            {
                this.PriorityNumber = e.PriorityNumber;
            }

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

            if (e.X == null)
            {
                if (e.IsPropertyXRemoved)
                {
                    this.X = default(string);
                }
            }
            else
            {
                this.X = e.X;
            }

            if (e.Y == null)
            {
                if (e.IsPropertyYRemoved)
                {
                    this.Y = default(string);
                }
            }
            else
            {
                this.Y = e.Y;
            }

            if (e.Z == null)
            {
                if (e.IsPropertyZRemoved)
                {
                    this.Z = default(string);
                }
            }
            else
            {
                this.Z = e.Z;
            }

            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;
        }