Example #1
0
        protected virtual IProductCategoryStateMergePatched Map(IMergePatchProductCategory c)
        {
            var stateEventId = new ProductCategoryEventId(c.ProductCategoryId, c.Version);
            IProductCategoryStateMergePatched e = NewProductCategoryStateMergePatched(stateEventId);

            e.ProductCategoryTypeId   = c.ProductCategoryTypeId;
            e.PrimaryParentCategoryId = c.PrimaryParentCategoryId;
            e.CategoryName            = c.CategoryName;
            e.Description             = c.Description;
            e.CategoryImageUrl        = c.CategoryImageUrl;
            e.DetailScreen            = c.DetailScreen;
            e.ShowInSelect            = c.ShowInSelect;
            e.AttributeSetId          = c.AttributeSetId;
            e.Active = c.Active;
            e.IsPropertyProductCategoryTypeIdRemoved   = c.IsPropertyProductCategoryTypeIdRemoved;
            e.IsPropertyPrimaryParentCategoryIdRemoved = c.IsPropertyPrimaryParentCategoryIdRemoved;
            e.IsPropertyCategoryNameRemoved            = c.IsPropertyCategoryNameRemoved;
            e.IsPropertyDescriptionRemoved             = c.IsPropertyDescriptionRemoved;
            e.IsPropertyCategoryImageUrlRemoved        = c.IsPropertyCategoryImageUrlRemoved;
            e.IsPropertyDetailScreenRemoved            = c.IsPropertyDetailScreenRemoved;
            e.IsPropertyShowInSelectRemoved            = c.IsPropertyShowInSelectRemoved;
            e.IsPropertyAttributeSetIdRemoved          = c.IsPropertyAttributeSetIdRemoved;
            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(IProductCategoryStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ProductCategoryTypeId == null)
            {
                if (e.IsPropertyProductCategoryTypeIdRemoved)
                {
                    this.ProductCategoryTypeId = default(string);
                }
            }
            else
            {
                this.ProductCategoryTypeId = e.ProductCategoryTypeId;
            }

            if (e.PrimaryParentCategoryId == null)
            {
                if (e.IsPropertyPrimaryParentCategoryIdRemoved)
                {
                    this.PrimaryParentCategoryId = default(string);
                }
            }
            else
            {
                this.PrimaryParentCategoryId = e.PrimaryParentCategoryId;
            }

            if (e.CategoryName == null)
            {
                if (e.IsPropertyCategoryNameRemoved)
                {
                    this.CategoryName = default(string);
                }
            }
            else
            {
                this.CategoryName = e.CategoryName;
            }

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

            if (e.CategoryImageUrl == null)
            {
                if (e.IsPropertyCategoryImageUrlRemoved)
                {
                    this.CategoryImageUrl = default(string);
                }
            }
            else
            {
                this.CategoryImageUrl = e.CategoryImageUrl;
            }

            if (e.DetailScreen == null)
            {
                if (e.IsPropertyDetailScreenRemoved)
                {
                    this.DetailScreen = default(string);
                }
            }
            else
            {
                this.DetailScreen = e.DetailScreen;
            }

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

            if (e.AttributeSetId == null)
            {
                if (e.IsPropertyAttributeSetIdRemoved)
                {
                    this.AttributeSetId = default(string);
                }
            }
            else
            {
                this.AttributeSetId = e.AttributeSetId;
            }

            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 ProductCategoryStateMergePatchedDto ToProductCategoryStateMergePatchedDto(IProductCategoryStateMergePatched e)
        {
            var dto = new ProductCategoryStateMergePatchedDto();

            dto.ProductCategoryEventId = e.ProductCategoryEventId;
            dto.CreatedAt               = e.CreatedAt;
            dto.CreatedBy               = e.CreatedBy;
            dto.CommandId               = e.CommandId;
            dto.ProductCategoryTypeId   = e.ProductCategoryTypeId;
            dto.PrimaryParentCategoryId = e.PrimaryParentCategoryId;
            dto.CategoryName            = e.CategoryName;
            dto.Description             = e.Description;
            dto.CategoryImageUrl        = e.CategoryImageUrl;
            dto.DetailScreen            = e.DetailScreen;
            dto.ShowInSelect            = e.ShowInSelect;
            dto.AttributeSetId          = e.AttributeSetId;
            dto.Active = e.Active;
            dto.IsPropertyProductCategoryTypeIdRemoved   = e.IsPropertyProductCategoryTypeIdRemoved;
            dto.IsPropertyPrimaryParentCategoryIdRemoved = e.IsPropertyPrimaryParentCategoryIdRemoved;
            dto.IsPropertyCategoryNameRemoved            = e.IsPropertyCategoryNameRemoved;
            dto.IsPropertyDescriptionRemoved             = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyCategoryImageUrlRemoved        = e.IsPropertyCategoryImageUrlRemoved;
            dto.IsPropertyDetailScreenRemoved            = e.IsPropertyDetailScreenRemoved;
            dto.IsPropertyShowInSelectRemoved            = e.IsPropertyShowInSelectRemoved;
            dto.IsPropertyAttributeSetIdRemoved          = e.IsPropertyAttributeSetIdRemoved;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

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

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