Example #1
0
        protected virtual IUomStateMergePatched Map(IMergePatchUom c)
        {
            var stateEventId        = new UomEventId(c.UomId, c.Version);
            IUomStateMergePatched e = NewUomStateMergePatched(stateEventId);

            e.UomTypeId    = c.UomTypeId;
            e.Abbreviation = c.Abbreviation;
            e.Description  = c.Description;
            e.Active       = c.Active;
            e.IsPropertyUomTypeIdRemoved    = c.IsPropertyUomTypeIdRemoved;
            e.IsPropertyAbbreviationRemoved = c.IsPropertyAbbreviationRemoved;
            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);
        }
Example #2
0
        public virtual void When(IUomStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.UomTypeId == null)
            {
                if (e.IsPropertyUomTypeIdRemoved)
                {
                    this.UomTypeId = default(string);
                }
            }
            else
            {
                this.UomTypeId = e.UomTypeId;
            }

            if (e.Abbreviation == null)
            {
                if (e.IsPropertyAbbreviationRemoved)
                {
                    this.Abbreviation = default(string);
                }
            }
            else
            {
                this.Abbreviation = e.Abbreviation;
            }

            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;
        }
Example #3
0
        public virtual UomStateMergePatchedDto ToUomStateMergePatchedDto(IUomStateMergePatched e)
        {
            var dto = new UomStateMergePatchedDto();

            dto.UomEventId   = e.UomEventId;
            dto.CreatedAt    = e.CreatedAt;
            dto.CreatedBy    = e.CreatedBy;
            dto.CommandId    = e.CommandId;
            dto.UomTypeId    = e.UomTypeId;
            dto.Abbreviation = e.Abbreviation;
            dto.Description  = e.Description;
            dto.Active       = e.Active;
            dto.IsPropertyUomTypeIdRemoved    = e.IsPropertyUomTypeIdRemoved;
            dto.IsPropertyAbbreviationRemoved = e.IsPropertyAbbreviationRemoved;
            dto.IsPropertyDescriptionRemoved  = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyActiveRemoved       = e.IsPropertyActiveRemoved;

            return(dto);
        }
Example #4
0
        public virtual void MergePatch(IMergePatchUom c)
        {
            IUomStateMergePatched e = Map(c);

            Apply(e);
        }
Example #5
0
 void IUomState.When(IUomStateMergePatched e)
 {
     throw new NotSupportedException();
 }