Ejemplo n.º 1
0
        public virtual void When(IGoodIdentificationStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.IdValue = e.IdValue;

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Ejemplo n.º 2
0
        protected virtual IGoodIdentificationStateCreated MapCreate(ICreateGoodIdentification c, IProductCommand outerCommand, long version, IProductState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new GoodIdentificationEventId(c.ProductId, c.GoodIdentificationTypeId, version);
            IGoodIdentificationStateCreated e = NewGoodIdentificationStateCreated(stateEventId);
            var s = outerState.GoodIdentifications.Get(c.GoodIdentificationTypeId, true);

            e.IdValue = c.IdValue;
            e.Active  = c.Active;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(ICreate... ////////////////////////////
Ejemplo n.º 3
0
 public virtual void AddGoodIdentificationEvent(IGoodIdentificationStateCreated e)
 {
     ThrowOnInconsistentEventIds(e);
     this._goodIdentificationEvents[e.GoodIdentificationEventId] = e;
 }
        public virtual GoodIdentificationStateCreatedDto ToGoodIdentificationStateCreatedDto(IGoodIdentificationStateCreated e)
        {
            var dto = new GoodIdentificationStateCreatedDto();

            dto.GoodIdentificationEventId = e.GoodIdentificationEventId;
            dto.CreatedAt = e.CreatedAt;
            dto.CreatedBy = e.CreatedBy;
            dto.Version   = e.Version;
            dto.CommandId = e.CommandId;
            dto.IdValue   = e.IdValue;
            dto.Active    = e.Active;
            return(dto);
        }
Ejemplo n.º 5
0
        protected virtual IProductStateCreated Map(ICreateProduct c)
        {
            var stateEventId       = new ProductEventId(c.ProductId, c.Version);
            IProductStateCreated e = NewProductStateCreated(stateEventId);

            e.ProductTypeId            = c.ProductTypeId;
            e.PrimaryProductCategoryId = c.PrimaryProductCategoryId;
            e.ManufacturerPartyId      = c.ManufacturerPartyId;
            e.FacilityId                 = c.FacilityId;
            e.IntroductionDate           = c.IntroductionDate;
            e.ReleaseDate                = c.ReleaseDate;
            e.SupportDiscontinuationDate = c.SupportDiscontinuationDate;
            e.SalesDiscontinuationDate   = c.SalesDiscontinuationDate;
            e.SalesDiscWhenNotAvail      = c.SalesDiscWhenNotAvail;
            e.InternalName               = c.InternalName;
            e.BrandName                = c.BrandName;
            e.Comments                 = c.Comments;
            e.ProductName              = c.ProductName;
            e.Description              = c.Description;
            e.PriceDetailText          = c.PriceDetailText;
            e.SmallImageUrl            = c.SmallImageUrl;
            e.MediumImageUrl           = c.MediumImageUrl;
            e.LargeImageUrl            = c.LargeImageUrl;
            e.DetailImageUrl           = c.DetailImageUrl;
            e.OriginalImageUrl         = c.OriginalImageUrl;
            e.DetailScreen             = c.DetailScreen;
            e.InventoryMessage         = c.InventoryMessage;
            e.InventoryItemTypeId      = c.InventoryItemTypeId;
            e.RequireInventory         = c.RequireInventory;
            e.QuantityUomId            = c.QuantityUomId;
            e.QuantityIncluded         = c.QuantityIncluded;
            e.PiecesIncluded           = c.PiecesIncluded;
            e.RequireAmount            = c.RequireAmount;
            e.FixedAmount              = c.FixedAmount;
            e.AmountUomTypeId          = c.AmountUomTypeId;
            e.WeightUomId              = c.WeightUomId;
            e.ShippingWeight           = c.ShippingWeight;
            e.ProductWeight            = c.ProductWeight;
            e.HeightUomId              = c.HeightUomId;
            e.ProductHeight            = c.ProductHeight;
            e.ShippingHeight           = c.ShippingHeight;
            e.WidthUomId               = c.WidthUomId;
            e.ProductWidth             = c.ProductWidth;
            e.ShippingWidth            = c.ShippingWidth;
            e.DepthUomId               = c.DepthUomId;
            e.ProductDepth             = c.ProductDepth;
            e.ShippingDepth            = c.ShippingDepth;
            e.DiameterUomId            = c.DiameterUomId;
            e.ProductDiameter          = c.ProductDiameter;
            e.ProductRating            = c.ProductRating;
            e.RatingTypeEnum           = c.RatingTypeEnum;
            e.Returnable               = c.Returnable;
            e.Taxable                  = c.Taxable;
            e.ChargeShipping           = c.ChargeShipping;
            e.AutoCreateKeywords       = c.AutoCreateKeywords;
            e.IncludeInPromotions      = c.IncludeInPromotions;
            e.IsVirtual                = c.IsVirtual;
            e.IsVariant                = c.IsVariant;
            e.VirtualVariantMethodEnum = c.VirtualVariantMethodEnum;
            e.InShippingBox            = c.InShippingBox;
            e.DefaultShipmentBoxTypeId = c.DefaultShipmentBoxTypeId;
            e.IsSerialNumbered         = c.IsSerialNumbered;
            e.IsManagedByLot           = c.IsManagedByLot;
            e.AttributeSetId           = c.AttributeSetId;
            e.AttributeSetInstanceId   = c.AttributeSetInstanceId;
            e.Active    = c.Active;
            e.CommandId = c.CommandId;


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

            foreach (ICreateGoodIdentification innerCommand in c.GoodIdentifications)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IGoodIdentificationStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddGoodIdentificationEvent(innerEvent);
            }


            return(e);
        }
Ejemplo n.º 6
0
 void IProductStateCreated.AddGoodIdentificationEvent(IGoodIdentificationStateCreated e)
 {
     this._goodIdentificationEvents.AddGoodIdentificationEvent(e);
 }
 void IGoodIdentificationState.When(IGoodIdentificationStateCreated e)
 {
     throw new NotSupportedException();
 }