public virtual void Initialize(IGoodIdentificationMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.GoodIdentificationMvoEventId.ProductGoodIdentificationId;
            var state       = new GoodIdentificationMvoState();

            state.ProductGoodIdentificationId = aggregateId;
            var aggregate = (GoodIdentificationMvoAggregate)GetGoodIdentificationMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
        public virtual GoodIdentificationMvoStateCreatedDto ToGoodIdentificationMvoStateCreatedDto(IGoodIdentificationMvoStateCreated e)
        {
            var dto = new GoodIdentificationMvoStateCreatedDto();

            dto.GoodIdentificationMvoEventId = e.GoodIdentificationMvoEventId;
            dto.CreatedAt                         = e.CreatedAt;
            dto.CreatedBy                         = e.CreatedBy;
            dto.CommandId                         = e.CommandId;
            dto.IdValue                           = e.IdValue;
            dto.Version                           = e.Version;
            dto.Active                            = e.Active;
            dto.ProductProductTypeId              = e.ProductProductTypeId;
            dto.ProductPrimaryProductCategoryId   = e.ProductPrimaryProductCategoryId;
            dto.ProductManufacturerPartyId        = e.ProductManufacturerPartyId;
            dto.ProductFacilityId                 = e.ProductFacilityId;
            dto.ProductIntroductionDate           = e.ProductIntroductionDate;
            dto.ProductReleaseDate                = e.ProductReleaseDate;
            dto.ProductSupportDiscontinuationDate = e.ProductSupportDiscontinuationDate;
            dto.ProductSalesDiscontinuationDate   = e.ProductSalesDiscontinuationDate;
            dto.ProductSalesDiscWhenNotAvail      = e.ProductSalesDiscWhenNotAvail;
            dto.ProductInternalName               = e.ProductInternalName;
            dto.ProductBrandName                  = e.ProductBrandName;
            dto.ProductComments                   = e.ProductComments;
            dto.ProductProductName                = e.ProductProductName;
            dto.ProductDescription                = e.ProductDescription;
            dto.ProductPriceDetailText            = e.ProductPriceDetailText;
            dto.ProductSmallImageUrl              = e.ProductSmallImageUrl;
            dto.ProductMediumImageUrl             = e.ProductMediumImageUrl;
            dto.ProductLargeImageUrl              = e.ProductLargeImageUrl;
            dto.ProductDetailImageUrl             = e.ProductDetailImageUrl;
            dto.ProductOriginalImageUrl           = e.ProductOriginalImageUrl;
            dto.ProductDetailScreen               = e.ProductDetailScreen;
            dto.ProductInventoryMessage           = e.ProductInventoryMessage;
            dto.ProductInventoryItemTypeId        = e.ProductInventoryItemTypeId;
            dto.ProductRequireInventory           = e.ProductRequireInventory;
            dto.ProductQuantityUomId              = e.ProductQuantityUomId;
            dto.ProductQuantityIncluded           = e.ProductQuantityIncluded;
            dto.ProductPiecesIncluded             = e.ProductPiecesIncluded;
            dto.ProductRequireAmount              = e.ProductRequireAmount;
            dto.ProductFixedAmount                = e.ProductFixedAmount;
            dto.ProductAmountUomTypeId            = e.ProductAmountUomTypeId;
            dto.ProductWeightUomId                = e.ProductWeightUomId;
            dto.ProductShippingWeight             = e.ProductShippingWeight;
            dto.ProductProductWeight              = e.ProductProductWeight;
            dto.ProductHeightUomId                = e.ProductHeightUomId;
            dto.ProductProductHeight              = e.ProductProductHeight;
            dto.ProductShippingHeight             = e.ProductShippingHeight;
            dto.ProductWidthUomId                 = e.ProductWidthUomId;
            dto.ProductProductWidth               = e.ProductProductWidth;
            dto.ProductShippingWidth              = e.ProductShippingWidth;
            dto.ProductDepthUomId                 = e.ProductDepthUomId;
            dto.ProductProductDepth               = e.ProductProductDepth;
            dto.ProductShippingDepth              = e.ProductShippingDepth;
            dto.ProductDiameterUomId              = e.ProductDiameterUomId;
            dto.ProductProductDiameter            = e.ProductProductDiameter;
            dto.ProductProductRating              = e.ProductProductRating;
            dto.ProductRatingTypeEnum             = e.ProductRatingTypeEnum;
            dto.ProductReturnable                 = e.ProductReturnable;
            dto.ProductTaxable                    = e.ProductTaxable;
            dto.ProductChargeShipping             = e.ProductChargeShipping;
            dto.ProductAutoCreateKeywords         = e.ProductAutoCreateKeywords;
            dto.ProductIncludeInPromotions        = e.ProductIncludeInPromotions;
            dto.ProductIsVirtual                  = e.ProductIsVirtual;
            dto.ProductIsVariant                  = e.ProductIsVariant;
            dto.ProductVirtualVariantMethodEnum   = e.ProductVirtualVariantMethodEnum;
            dto.ProductInShippingBox              = e.ProductInShippingBox;
            dto.ProductDefaultShipmentBoxTypeId   = e.ProductDefaultShipmentBoxTypeId;
            dto.ProductIsSerialNumbered           = e.ProductIsSerialNumbered;
            dto.ProductIsManagedByLot             = e.ProductIsManagedByLot;
            dto.ProductAttributeSetId             = e.ProductAttributeSetId;
            dto.ProductAttributeSetInstanceId     = e.ProductAttributeSetInstanceId;
            dto.ProductCreatedBy                  = e.ProductCreatedBy;
            dto.ProductCreatedAt                  = e.ProductCreatedAt;
            dto.ProductUpdatedBy                  = e.ProductUpdatedBy;
            dto.ProductUpdatedAt                  = e.ProductUpdatedAt;
            dto.ProductActive                     = e.ProductActive;
            return(dto);
        }
Ejemplo n.º 3
0
        public virtual void When(IGoodIdentificationMvoStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.IdValue = e.IdValue;

            this.Version = (e.Version != null && e.Version.HasValue) ? e.Version.Value : default(long);

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.ProductProductTypeId = e.ProductProductTypeId;

            this.ProductPrimaryProductCategoryId = e.ProductPrimaryProductCategoryId;

            this.ProductManufacturerPartyId = e.ProductManufacturerPartyId;

            this.ProductFacilityId = e.ProductFacilityId;

            this.ProductIntroductionDate = e.ProductIntroductionDate;

            this.ProductReleaseDate = e.ProductReleaseDate;

            this.ProductSupportDiscontinuationDate = e.ProductSupportDiscontinuationDate;

            this.ProductSalesDiscontinuationDate = e.ProductSalesDiscontinuationDate;

            this.ProductSalesDiscWhenNotAvail = e.ProductSalesDiscWhenNotAvail;

            this.ProductInternalName = e.ProductInternalName;

            this.ProductBrandName = e.ProductBrandName;

            this.ProductComments = e.ProductComments;

            this.ProductProductName = e.ProductProductName;

            this.ProductDescription = e.ProductDescription;

            this.ProductPriceDetailText = e.ProductPriceDetailText;

            this.ProductSmallImageUrl = e.ProductSmallImageUrl;

            this.ProductMediumImageUrl = e.ProductMediumImageUrl;

            this.ProductLargeImageUrl = e.ProductLargeImageUrl;

            this.ProductDetailImageUrl = e.ProductDetailImageUrl;

            this.ProductOriginalImageUrl = e.ProductOriginalImageUrl;

            this.ProductDetailScreen = e.ProductDetailScreen;

            this.ProductInventoryMessage = e.ProductInventoryMessage;

            this.ProductInventoryItemTypeId = e.ProductInventoryItemTypeId;

            this.ProductRequireInventory = e.ProductRequireInventory;

            this.ProductQuantityUomId = e.ProductQuantityUomId;

            this.ProductQuantityIncluded = e.ProductQuantityIncluded;

            this.ProductPiecesIncluded = e.ProductPiecesIncluded;

            this.ProductRequireAmount = e.ProductRequireAmount;

            this.ProductFixedAmount = e.ProductFixedAmount;

            this.ProductAmountUomTypeId = e.ProductAmountUomTypeId;

            this.ProductWeightUomId = e.ProductWeightUomId;

            this.ProductShippingWeight = e.ProductShippingWeight;

            this.ProductProductWeight = e.ProductProductWeight;

            this.ProductHeightUomId = e.ProductHeightUomId;

            this.ProductProductHeight = e.ProductProductHeight;

            this.ProductShippingHeight = e.ProductShippingHeight;

            this.ProductWidthUomId = e.ProductWidthUomId;

            this.ProductProductWidth = e.ProductProductWidth;

            this.ProductShippingWidth = e.ProductShippingWidth;

            this.ProductDepthUomId = e.ProductDepthUomId;

            this.ProductProductDepth = e.ProductProductDepth;

            this.ProductShippingDepth = e.ProductShippingDepth;

            this.ProductDiameterUomId = e.ProductDiameterUomId;

            this.ProductProductDiameter = e.ProductProductDiameter;

            this.ProductProductRating = e.ProductProductRating;

            this.ProductRatingTypeEnum = e.ProductRatingTypeEnum;

            this.ProductReturnable = e.ProductReturnable;

            this.ProductTaxable = e.ProductTaxable;

            this.ProductChargeShipping = e.ProductChargeShipping;

            this.ProductAutoCreateKeywords = e.ProductAutoCreateKeywords;

            this.ProductIncludeInPromotions = e.ProductIncludeInPromotions;

            this.ProductIsVirtual = e.ProductIsVirtual;

            this.ProductIsVariant = e.ProductIsVariant;

            this.ProductVirtualVariantMethodEnum = e.ProductVirtualVariantMethodEnum;

            this.ProductInShippingBox = e.ProductInShippingBox;

            this.ProductDefaultShipmentBoxTypeId = e.ProductDefaultShipmentBoxTypeId;

            this.ProductIsSerialNumbered = (e.ProductIsSerialNumbered != null && e.ProductIsSerialNumbered.HasValue) ? e.ProductIsSerialNumbered.Value : default(bool);

            this.ProductIsManagedByLot = (e.ProductIsManagedByLot != null && e.ProductIsManagedByLot.HasValue) ? e.ProductIsManagedByLot.Value : default(bool);

            this.ProductAttributeSetId = e.ProductAttributeSetId;

            this.ProductAttributeSetInstanceId = e.ProductAttributeSetInstanceId;

            this.ProductCreatedBy = e.ProductCreatedBy;

            this.ProductCreatedAt = (e.ProductCreatedAt != null && e.ProductCreatedAt.HasValue) ? e.ProductCreatedAt.Value : default(DateTime);

            this.ProductUpdatedBy = e.ProductUpdatedBy;

            this.ProductUpdatedAt = (e.ProductUpdatedAt != null && e.ProductUpdatedAt.HasValue) ? e.ProductUpdatedAt.Value : default(DateTime);

            this.ProductActive = (e.ProductActive != null && e.ProductActive.HasValue) ? e.ProductActive.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Ejemplo n.º 4
0
        public virtual void Create(ICreateGoodIdentificationMvo c)
        {
            IGoodIdentificationMvoStateCreated e = Map(c);

            Apply(e);
        }
Ejemplo n.º 5
0
        protected virtual IGoodIdentificationMvoStateCreated Map(ICreateGoodIdentificationMvo c)
        {
            var stateEventId = new GoodIdentificationMvoEventId(c.ProductGoodIdentificationId, c.ProductVersion);
            IGoodIdentificationMvoStateCreated e = NewGoodIdentificationMvoStateCreated(stateEventId);

            e.IdValue = c.IdValue;
            e.Version = c.Version;
            e.Active  = c.Active;
            e.ProductProductTypeId            = c.ProductProductTypeId;
            e.ProductPrimaryProductCategoryId = c.ProductPrimaryProductCategoryId;
            e.ProductManufacturerPartyId      = c.ProductManufacturerPartyId;
            e.ProductFacilityId                 = c.ProductFacilityId;
            e.ProductIntroductionDate           = c.ProductIntroductionDate;
            e.ProductReleaseDate                = c.ProductReleaseDate;
            e.ProductSupportDiscontinuationDate = c.ProductSupportDiscontinuationDate;
            e.ProductSalesDiscontinuationDate   = c.ProductSalesDiscontinuationDate;
            e.ProductSalesDiscWhenNotAvail      = c.ProductSalesDiscWhenNotAvail;
            e.ProductInternalName               = c.ProductInternalName;
            e.ProductBrandName                = c.ProductBrandName;
            e.ProductComments                 = c.ProductComments;
            e.ProductProductName              = c.ProductProductName;
            e.ProductDescription              = c.ProductDescription;
            e.ProductPriceDetailText          = c.ProductPriceDetailText;
            e.ProductSmallImageUrl            = c.ProductSmallImageUrl;
            e.ProductMediumImageUrl           = c.ProductMediumImageUrl;
            e.ProductLargeImageUrl            = c.ProductLargeImageUrl;
            e.ProductDetailImageUrl           = c.ProductDetailImageUrl;
            e.ProductOriginalImageUrl         = c.ProductOriginalImageUrl;
            e.ProductDetailScreen             = c.ProductDetailScreen;
            e.ProductInventoryMessage         = c.ProductInventoryMessage;
            e.ProductInventoryItemTypeId      = c.ProductInventoryItemTypeId;
            e.ProductRequireInventory         = c.ProductRequireInventory;
            e.ProductQuantityUomId            = c.ProductQuantityUomId;
            e.ProductQuantityIncluded         = c.ProductQuantityIncluded;
            e.ProductPiecesIncluded           = c.ProductPiecesIncluded;
            e.ProductRequireAmount            = c.ProductRequireAmount;
            e.ProductFixedAmount              = c.ProductFixedAmount;
            e.ProductAmountUomTypeId          = c.ProductAmountUomTypeId;
            e.ProductWeightUomId              = c.ProductWeightUomId;
            e.ProductShippingWeight           = c.ProductShippingWeight;
            e.ProductProductWeight            = c.ProductProductWeight;
            e.ProductHeightUomId              = c.ProductHeightUomId;
            e.ProductProductHeight            = c.ProductProductHeight;
            e.ProductShippingHeight           = c.ProductShippingHeight;
            e.ProductWidthUomId               = c.ProductWidthUomId;
            e.ProductProductWidth             = c.ProductProductWidth;
            e.ProductShippingWidth            = c.ProductShippingWidth;
            e.ProductDepthUomId               = c.ProductDepthUomId;
            e.ProductProductDepth             = c.ProductProductDepth;
            e.ProductShippingDepth            = c.ProductShippingDepth;
            e.ProductDiameterUomId            = c.ProductDiameterUomId;
            e.ProductProductDiameter          = c.ProductProductDiameter;
            e.ProductProductRating            = c.ProductProductRating;
            e.ProductRatingTypeEnum           = c.ProductRatingTypeEnum;
            e.ProductReturnable               = c.ProductReturnable;
            e.ProductTaxable                  = c.ProductTaxable;
            e.ProductChargeShipping           = c.ProductChargeShipping;
            e.ProductAutoCreateKeywords       = c.ProductAutoCreateKeywords;
            e.ProductIncludeInPromotions      = c.ProductIncludeInPromotions;
            e.ProductIsVirtual                = c.ProductIsVirtual;
            e.ProductIsVariant                = c.ProductIsVariant;
            e.ProductVirtualVariantMethodEnum = c.ProductVirtualVariantMethodEnum;
            e.ProductInShippingBox            = c.ProductInShippingBox;
            e.ProductDefaultShipmentBoxTypeId = c.ProductDefaultShipmentBoxTypeId;
            e.ProductIsSerialNumbered         = c.ProductIsSerialNumbered;
            e.ProductIsManagedByLot           = c.ProductIsManagedByLot;
            e.ProductAttributeSetId           = c.ProductAttributeSetId;
            e.ProductAttributeSetInstanceId   = c.ProductAttributeSetInstanceId;
            e.ProductCreatedBy                = c.ProductCreatedBy;
            e.ProductCreatedAt                = c.ProductCreatedAt;
            e.ProductUpdatedBy                = c.ProductUpdatedBy;
            e.ProductUpdatedAt                = c.ProductUpdatedAt;
            e.ProductActive = c.ProductActive;
            e.CommandId     = c.CommandId;


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


            return(e);
        }