Пример #1
0
        protected virtual IUomTypeStateMergePatched Map(IMergePatchUomType c)
        {
            var stateEventId            = new UomTypeEventId(c.UomTypeId, c.Version);
            IUomTypeStateMergePatched e = NewUomTypeStateMergePatched(stateEventId);

            e.ParentTypeId = c.ParentTypeId;
            e.HasTable     = c.HasTable;
            e.Description  = c.Description;
            e.Active       = c.Active;
            e.IsPropertyParentTypeIdRemoved = c.IsPropertyParentTypeIdRemoved;
            e.IsPropertyHasTableRemoved     = c.IsPropertyHasTableRemoved;
            e.IsPropertyDescriptionRemoved  = c.IsPropertyDescriptionRemoved;
            e.IsPropertyActiveRemoved       = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


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

            var version = c.Version;


            return(e);
        }
Пример #2
0
        public virtual void When(IUomTypeStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ParentTypeId == null)
            {
                if (e.IsPropertyParentTypeIdRemoved)
                {
                    this.ParentTypeId = default(string);
                }
            }
            else
            {
                this.ParentTypeId = e.ParentTypeId;
            }

            if (e.HasTable == null)
            {
                if (e.IsPropertyHasTableRemoved)
                {
                    this.HasTable = default(string);
                }
            }
            else
            {
                this.HasTable = e.HasTable;
            }

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

            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;
        }
Пример #3
0
        public virtual UomTypeStateMergePatchedDto ToUomTypeStateMergePatchedDto(IUomTypeStateMergePatched e)
        {
            var dto = new UomTypeStateMergePatchedDto();

            dto.UomTypeEventId = e.UomTypeEventId;
            dto.CreatedAt      = e.CreatedAt;
            dto.CreatedBy      = e.CreatedBy;
            dto.CommandId      = e.CommandId;
            dto.ParentTypeId   = e.ParentTypeId;
            dto.HasTable       = e.HasTable;
            dto.Description    = e.Description;
            dto.Active         = e.Active;
            dto.IsPropertyParentTypeIdRemoved = e.IsPropertyParentTypeIdRemoved;
            dto.IsPropertyHasTableRemoved     = e.IsPropertyHasTableRemoved;
            dto.IsPropertyDescriptionRemoved  = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyActiveRemoved       = e.IsPropertyActiveRemoved;

            return(dto);
        }
Пример #4
0
 void IUomTypeState.When(IUomTypeStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Пример #5
0
        public virtual void MergePatch(IMergePatchUomType c)
        {
            IUomTypeStateMergePatched e = Map(c);

            Apply(e);
        }