Ejemplo n.º 1
0
        protected virtual ISupplierProductStateMergePatched Map(IMergePatchSupplierProduct c)
        {
            var stateEventId = new SupplierProductEventId(c.SupplierProductId, c.Version);
            ISupplierProductStateMergePatched e = NewSupplierProductStateMergePatched(stateEventId);

            e.AvailableThruDate         = c.AvailableThruDate;
            e.SupplierPrefOrderId       = c.SupplierPrefOrderId;
            e.SupplierRatingTypeId      = c.SupplierRatingTypeId;
            e.StandardLeadTimeDays      = c.StandardLeadTimeDays;
            e.ManufacturingLeadTimeDays = c.ManufacturingLeadTimeDays;
            e.DeliveryLeadTimeDays      = c.DeliveryLeadTimeDays;
            e.QuantityUomId             = c.QuantityUomId;
            e.LastPrice           = c.LastPrice;
            e.ShippingPrice       = c.ShippingPrice;
            e.ExternalProductName = c.ExternalProductName;
            e.ExternalProductId   = c.ExternalProductId;
            e.CanDropShip         = c.CanDropShip;
            e.Comments            = c.Comments;
            e.Active = c.Active;
            e.IsPropertyAvailableThruDateRemoved         = c.IsPropertyAvailableThruDateRemoved;
            e.IsPropertySupplierPrefOrderIdRemoved       = c.IsPropertySupplierPrefOrderIdRemoved;
            e.IsPropertySupplierRatingTypeIdRemoved      = c.IsPropertySupplierRatingTypeIdRemoved;
            e.IsPropertyStandardLeadTimeDaysRemoved      = c.IsPropertyStandardLeadTimeDaysRemoved;
            e.IsPropertyManufacturingLeadTimeDaysRemoved = c.IsPropertyManufacturingLeadTimeDaysRemoved;
            e.IsPropertyDeliveryLeadTimeDaysRemoved      = c.IsPropertyDeliveryLeadTimeDaysRemoved;
            e.IsPropertyQuantityUomIdRemoved             = c.IsPropertyQuantityUomIdRemoved;
            e.IsPropertyLastPriceRemoved           = c.IsPropertyLastPriceRemoved;
            e.IsPropertyShippingPriceRemoved       = c.IsPropertyShippingPriceRemoved;
            e.IsPropertyExternalProductNameRemoved = c.IsPropertyExternalProductNameRemoved;
            e.IsPropertyExternalProductIdRemoved   = c.IsPropertyExternalProductIdRemoved;
            e.IsPropertyCanDropShipRemoved         = c.IsPropertyCanDropShipRemoved;
            e.IsPropertyCommentsRemoved            = c.IsPropertyCommentsRemoved;
            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);
        }
Ejemplo n.º 2
0
 void ISupplierProductState.When(ISupplierProductStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 3
0
        public virtual void When(ISupplierProductStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.AvailableThruDate == null)
            {
                if (e.IsPropertyAvailableThruDateRemoved)
                {
                    this.AvailableThruDate = default(DateTime?);
                }
            }
            else
            {
                this.AvailableThruDate = e.AvailableThruDate;
            }

            if (e.SupplierPrefOrderId == null)
            {
                if (e.IsPropertySupplierPrefOrderIdRemoved)
                {
                    this.SupplierPrefOrderId = default(string);
                }
            }
            else
            {
                this.SupplierPrefOrderId = e.SupplierPrefOrderId;
            }

            if (e.SupplierRatingTypeId == null)
            {
                if (e.IsPropertySupplierRatingTypeIdRemoved)
                {
                    this.SupplierRatingTypeId = default(string);
                }
            }
            else
            {
                this.SupplierRatingTypeId = e.SupplierRatingTypeId;
            }

            if (e.StandardLeadTimeDays == null)
            {
                if (e.IsPropertyStandardLeadTimeDaysRemoved)
                {
                    this.StandardLeadTimeDays = default(decimal?);
                }
            }
            else
            {
                this.StandardLeadTimeDays = e.StandardLeadTimeDays;
            }

            if (e.ManufacturingLeadTimeDays == null)
            {
                if (e.IsPropertyManufacturingLeadTimeDaysRemoved)
                {
                    this.ManufacturingLeadTimeDays = default(decimal?);
                }
            }
            else
            {
                this.ManufacturingLeadTimeDays = e.ManufacturingLeadTimeDays;
            }

            if (e.DeliveryLeadTimeDays == null)
            {
                if (e.IsPropertyDeliveryLeadTimeDaysRemoved)
                {
                    this.DeliveryLeadTimeDays = default(decimal?);
                }
            }
            else
            {
                this.DeliveryLeadTimeDays = e.DeliveryLeadTimeDays;
            }

            if (e.QuantityUomId == null)
            {
                if (e.IsPropertyQuantityUomIdRemoved)
                {
                    this.QuantityUomId = default(string);
                }
            }
            else
            {
                this.QuantityUomId = e.QuantityUomId;
            }

            if (e.LastPrice == null)
            {
                if (e.IsPropertyLastPriceRemoved)
                {
                    this.LastPrice = default(decimal?);
                }
            }
            else
            {
                this.LastPrice = e.LastPrice;
            }

            if (e.ShippingPrice == null)
            {
                if (e.IsPropertyShippingPriceRemoved)
                {
                    this.ShippingPrice = default(decimal?);
                }
            }
            else
            {
                this.ShippingPrice = e.ShippingPrice;
            }

            if (e.ExternalProductName == null)
            {
                if (e.IsPropertyExternalProductNameRemoved)
                {
                    this.ExternalProductName = default(string);
                }
            }
            else
            {
                this.ExternalProductName = e.ExternalProductName;
            }

            if (e.ExternalProductId == null)
            {
                if (e.IsPropertyExternalProductIdRemoved)
                {
                    this.ExternalProductId = default(string);
                }
            }
            else
            {
                this.ExternalProductId = e.ExternalProductId;
            }

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

            if (e.Comments == null)
            {
                if (e.IsPropertyCommentsRemoved)
                {
                    this.Comments = default(string);
                }
            }
            else
            {
                this.Comments = e.Comments;
            }

            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;
        }
        public virtual SupplierProductStateMergePatchedDto ToSupplierProductStateMergePatchedDto(ISupplierProductStateMergePatched e)
        {
            var dto = new SupplierProductStateMergePatchedDto();

            dto.SupplierProductEventId = e.SupplierProductEventId;
            dto.CreatedAt                 = e.CreatedAt;
            dto.CreatedBy                 = e.CreatedBy;
            dto.CommandId                 = e.CommandId;
            dto.AvailableThruDate         = e.AvailableThruDate;
            dto.SupplierPrefOrderId       = e.SupplierPrefOrderId;
            dto.SupplierRatingTypeId      = e.SupplierRatingTypeId;
            dto.StandardLeadTimeDays      = e.StandardLeadTimeDays;
            dto.ManufacturingLeadTimeDays = e.ManufacturingLeadTimeDays;
            dto.DeliveryLeadTimeDays      = e.DeliveryLeadTimeDays;
            dto.QuantityUomId             = e.QuantityUomId;
            dto.LastPrice                 = e.LastPrice;
            dto.ShippingPrice             = e.ShippingPrice;
            dto.ExternalProductName       = e.ExternalProductName;
            dto.ExternalProductId         = e.ExternalProductId;
            dto.CanDropShip               = e.CanDropShip;
            dto.Comments = e.Comments;
            dto.Active   = e.Active;
            dto.IsPropertyAvailableThruDateRemoved         = e.IsPropertyAvailableThruDateRemoved;
            dto.IsPropertySupplierPrefOrderIdRemoved       = e.IsPropertySupplierPrefOrderIdRemoved;
            dto.IsPropertySupplierRatingTypeIdRemoved      = e.IsPropertySupplierRatingTypeIdRemoved;
            dto.IsPropertyStandardLeadTimeDaysRemoved      = e.IsPropertyStandardLeadTimeDaysRemoved;
            dto.IsPropertyManufacturingLeadTimeDaysRemoved = e.IsPropertyManufacturingLeadTimeDaysRemoved;
            dto.IsPropertyDeliveryLeadTimeDaysRemoved      = e.IsPropertyDeliveryLeadTimeDaysRemoved;
            dto.IsPropertyQuantityUomIdRemoved             = e.IsPropertyQuantityUomIdRemoved;
            dto.IsPropertyLastPriceRemoved           = e.IsPropertyLastPriceRemoved;
            dto.IsPropertyShippingPriceRemoved       = e.IsPropertyShippingPriceRemoved;
            dto.IsPropertyExternalProductNameRemoved = e.IsPropertyExternalProductNameRemoved;
            dto.IsPropertyExternalProductIdRemoved   = e.IsPropertyExternalProductIdRemoved;
            dto.IsPropertyCanDropShipRemoved         = e.IsPropertyCanDropShipRemoved;
            dto.IsPropertyCommentsRemoved            = e.IsPropertyCommentsRemoved;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

            return(dto);
        }
Ejemplo n.º 5
0
        public virtual void MergePatch(IMergePatchSupplierProduct c)
        {
            ISupplierProductStateMergePatched e = Map(c);

            Apply(e);
        }