示例#1
0
        /// <summary>
        ///     Allows you to populate the current order package object using a OrderPackageDTO instance
        /// </summary>
        /// <param name="dto">An instance of the order package from the REST API</param>
        public void FromDto(OrderPackageDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            if (dto.CustomProperties != null)
            {
                CustomProperties.Clear();
                foreach (var prop in dto.CustomProperties)
                {
                    var p = new CustomProperty();
                    p.FromDto(prop);
                    CustomProperties.Add(p);
                }
            }
            Description           = dto.Description ?? string.Empty;
            EstimatedShippingCost = dto.EstimatedShippingCost;
            HasShipped            = dto.HasShipped;
            Height = dto.Height;
            Id     = dto.Id;
            if (dto.Items != null)
            {
                Items.Clear();
                foreach (var item in dto.Items)
                {
                    var pak = new OrderPackageItem();
                    pak.FromDto(item);
                    Items.Add(pak);
                }
            }
            LastUpdatedUtc              = dto.LastUpdatedUtc;
            Length                      = dto.Length;
            OrderId                     = dto.OrderId ?? string.Empty;
            ShipDateUtc                 = dto.ShipDateUtc;
            ShippingMethodId            = dto.ShippingMethodId ?? string.Empty;
            ShippingProviderId          = dto.ShippingProviderId ?? string.Empty;
            ShippingProviderServiceCode = dto.ShippingProviderServiceCode ?? string.Empty;
            SizeUnits                   = (LengthType)(int)dto.SizeUnits;
            StoreId                     = dto.StoreId;
            TrackingNumber              = dto.TrackingNumber ?? string.Empty;
            Weight                      = dto.Weight;
            WeightUnits                 = (WeightType)(int)dto.WeightUnits;
            Width = dto.Width;
        }
示例#2
0
        public void FromDto(OrderPackageDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            if (dto.CustomProperties != null)
            {
                this.CustomProperties.Clear();
                foreach (CustomPropertyDTO prop in dto.CustomProperties)
                {
                    CustomProperty p = new CustomProperty();
                    p.FromDto(prop);
                    this.CustomProperties.Add(p);
                }
            }
            this.Description           = dto.Description ?? string.Empty;
            this.EstimatedShippingCost = dto.EstimatedShippingCost;
            this.HasShipped            = dto.HasShipped;
            this.Height = dto.Height;
            this.Id     = dto.Id;
            if (dto.Items != null)
            {
                this.Items.Clear();
                foreach (OrderPackageItemDTO item in dto.Items)
                {
                    OrderPackageItem pak = new OrderPackageItem();
                    pak.FromDto(item);
                    this.Items.Add(pak);
                }
            }
            this.LastUpdatedUtc              = dto.LastUpdatedUtc;
            this.Length                      = dto.Length;
            this.OrderId                     = dto.OrderId ?? string.Empty;
            this.ShipDateUtc                 = dto.ShipDateUtc;
            this.ShippingMethodId            = dto.ShippingMethodId ?? string.Empty;
            this.ShippingProviderId          = dto.ShippingProviderId ?? string.Empty;
            this.ShippingProviderServiceCode = dto.ShippingProviderServiceCode ?? string.Empty;
            this.SizeUnits                   = (MerchantTribe.Shipping.LengthType)((int)dto.SizeUnits);
            this.StoreId                     = dto.StoreId;
            this.TrackingNumber              = dto.TrackingNumber ?? string.Empty;
            this.Weight                      = dto.Weight;
            this.WeightUnits                 = (MerchantTribe.Shipping.WeightType)((int)dto.WeightUnits);
            this.Width = dto.Width;
        }
示例#3
0
        public void FromDto(LineItemDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            this.Id               = dto.Id;
            this.StoreId          = dto.StoreId;
            this.LastUpdatedUtc   = dto.LastUpdatedUtc;
            this.BasePricePerItem = dto.BasePricePerItem;
            this.DiscountDetails.Clear();
            if (dto.DiscountDetails != null)
            {
                foreach (DiscountDetailDTO detail in dto.DiscountDetails)
                {
                    DiscountDetail d = new DiscountDetail();
                    d.FromDto(detail);
                    this.DiscountDetails.Add(d);
                }
            }
            this.OrderBvin               = dto.OrderBvin ?? string.Empty;
            this.ProductId               = dto.ProductId ?? string.Empty;
            this.VariantId               = dto.VariantId ?? string.Empty;
            this.ProductName             = dto.ProductName ?? string.Empty;
            this.ProductSku              = dto.ProductSku ?? string.Empty;
            this.ProductShortDescription = dto.ProductShortDescription ?? string.Empty;
            this.Quantity         = dto.Quantity;
            this.QuantityReturned = dto.QuantityReturned;
            this.QuantityShipped  = dto.QuantityShipped;
            this.ShippingPortion  = dto.ShippingPortion;
            this.StatusCode       = dto.StatusCode ?? string.Empty;
            this.StatusName       = dto.StatusName ?? string.Empty;
            this.TaxPortion       = dto.TaxPortion;
            this.SelectionData.Clear();
            if (dto.SelectionData != null)
            {
                foreach (OptionSelectionDTO op in dto.SelectionData)
                {
                    Catalog.OptionSelection o = new Catalog.OptionSelection();
                    o.FromDto(op);
                    this.SelectionData.Add(o);
                }
            }
            this.ShippingSchedule      = dto.ShippingSchedule;
            this.TaxSchedule           = dto.TaxSchedule;
            this.ProductShippingHeight = dto.ProductShippingHeight;
            this.ProductShippingLength = dto.ProductShippingLength;
            this.ProductShippingWeight = dto.ProductShippingWeight;
            this.ProductShippingWidth  = dto.ProductShippingWidth;
            this.CustomProperties.Clear();
            if (dto.CustomProperties != null)
            {
                foreach (CustomPropertyDTO cpd in dto.CustomProperties)
                {
                    CustomProperty prop = new CustomProperty();
                    prop.FromDto(cpd);
                    this.CustomProperties.Add(prop);
                }
            }
            this.ShipFromAddress.FromDto(dto.ShipFromAddress);
            this.ShipFromMode           = (Shipping.ShippingMode)((int)dto.ShipFromMode);
            this.ShipFromNotificationId = dto.ShipFromNotificationId ?? string.Empty;
            this.ShipSeparately         = dto.ShipSeparately;
            this.ExtraShipCharge        = dto.ExtraShipCharge;
        }
示例#4
0
        public void FromDto(OrderPackageDTO dto)
        {
            if (dto == null) return;

            if (dto.CustomProperties != null)
            {
                this.CustomProperties.Clear();
                foreach (CustomPropertyDTO prop in dto.CustomProperties)
                {
                    CustomProperty p = new CustomProperty();
                    p.FromDto(prop);
                    this.CustomProperties.Add(p);
                }
            }
            this.Description = dto.Description ?? string.Empty;
            this.EstimatedShippingCost = dto.EstimatedShippingCost;
            this.HasShipped = dto.HasShipped;
            this.Height = dto.Height;
            this.Id = dto.Id;
            if (dto.Items != null)
            {
                this.Items.Clear();
                foreach (OrderPackageItemDTO item in dto.Items)
                {
                    OrderPackageItem pak = new OrderPackageItem();
                    pak.FromDto(item);
                    this.Items.Add(pak);
                }
            }
            this.LastUpdatedUtc = dto.LastUpdatedUtc;
            this.Length = dto.Length;
            this.OrderId = dto.OrderId ?? string.Empty;
            this.ShipDateUtc = dto.ShipDateUtc;
            this.ShippingMethodId = dto.ShippingMethodId ?? string.Empty;
            this.ShippingProviderId = dto.ShippingProviderId ?? string.Empty;
            this.ShippingProviderServiceCode = dto.ShippingProviderServiceCode ?? string.Empty;
            this.SizeUnits = (MerchantTribe.Shipping.LengthType)((int)dto.SizeUnits);
            this.StoreId = dto.StoreId;
            this.TrackingNumber = dto.TrackingNumber ?? string.Empty;
            this.Weight = dto.Weight;
            this.WeightUnits = (MerchantTribe.Shipping.WeightType)((int)dto.WeightUnits);
            this.Width = dto.Width;

        }
        /// <summary>
        ///     Allows you to populate the current line item object using a LineItemDTO instance
        /// </summary>
        /// <param name="dto">An instance of the line item from the REST API</param>
        public void FromDto(LineItemDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            Id                   = dto.Id;
            StoreId              = dto.StoreId;
            LastUpdatedUtc       = dto.LastUpdatedUtc;
            BasePricePerItem     = dto.BasePricePerItem;
            LineTotal            = dto.LineTotal;
            AdjustedPricePerItem = dto.AdjustedPricePerItem;
            IsUserSuppliedPrice  = dto.IsUserSuppliedPrice;
            IsBundle             = dto.IsBundle;
            IsGiftCard           = dto.IsGiftCard;
            PromotionIds         = dto.PromotionIds;
            FreeQuantity         = dto.FreeQuantity;

            DiscountDetails.Clear();
            if (dto.DiscountDetails != null)
            {
                foreach (var detail in dto.DiscountDetails)
                {
                    var d = new DiscountDetail();
                    d.FromDto(detail);
                    DiscountDetails.Add(d);
                }
            }
            OrderBvin               = dto.OrderBvin ?? string.Empty;
            ProductId               = dto.ProductId ?? string.Empty;
            VariantId               = dto.VariantId ?? string.Empty;
            ProductName             = dto.ProductName ?? string.Empty;
            ProductSku              = dto.ProductSku ?? string.Empty;
            ProductShortDescription = dto.ProductShortDescription ?? string.Empty;
            Quantity         = dto.Quantity;
            QuantityReturned = dto.QuantityReturned;
            QuantityShipped  = dto.QuantityShipped;
            ShippingPortion  = dto.ShippingPortion;
            TaxRate          = dto.TaxRate;
            TaxPortion       = dto.TaxPortion;
            StatusCode       = dto.StatusCode ?? string.Empty;
            StatusName       = dto.StatusName ?? string.Empty;
            SelectionData.Clear();
            if (dto.SelectionData != null)
            {
                foreach (var op in dto.SelectionData)
                {
                    var o = new OptionSelection();
                    o.FromDto(op);
                    SelectionData.OptionSelectionList.Add(o);
                }
            }
            IsNonShipping         = dto.IsNonShipping;
            TaxSchedule           = dto.TaxSchedule;
            ProductShippingHeight = dto.ProductShippingHeight;
            ProductShippingLength = dto.ProductShippingLength;
            ProductShippingWeight = dto.ProductShippingWeight;
            ProductShippingWidth  = dto.ProductShippingWidth;
            CustomProperties.Clear();
            if (dto.CustomProperties != null)
            {
                foreach (var cpd in dto.CustomProperties)
                {
                    var prop = new CustomProperty();
                    prop.FromDto(cpd);
                    CustomProperties.Add(prop);
                }
            }
            ShipFromAddress.FromDto(dto.ShipFromAddress);
            ShipFromMode           = (ShippingMode)(int)dto.ShipFromMode;
            ShipFromNotificationId = dto.ShipFromNotificationId ?? string.Empty;
            ShipSeparately         = dto.ShipSeparately;
            ExtraShipCharge        = dto.ExtraShipCharge;
            ShippingCharge         = (ShippingChargeType)(int)dto.ShippingCharge;
        }
示例#6
0
        public void FromDTO(OrderDTO dto)
        {
            if (dto == null) return;

            this.AffiliateID = dto.AffiliateID ?? string.Empty;
            this.BillingAddress.FromDto(dto.BillingAddress);
            this.bvin = dto.Bvin ?? string.Empty;
            this.Coupons.Clear();
            if (dto.Coupons != null)
            {
                foreach (OrderCouponDTO c in dto.Coupons)
                {
                    OrderCoupon cp = new OrderCoupon();
                    cp.FromDto(c);
                    this.Coupons.Add(cp);
                }
            }
            this.CustomProperties.Clear();
            if (dto.CustomProperties != null)
            {
                foreach (CustomPropertyDTO prop in dto.CustomProperties)
                {
                    CustomProperty p = new CustomProperty();
                    p.FromDto(prop);
                    this.CustomProperties.Add(p);
                }
            }
            this.FraudScore = dto.FraudScore;
            this.Id = dto.Id;
            this.Instructions = dto.Instructions ?? string.Empty;
            this.IsPlaced = dto.IsPlaced;
            this.Items.Clear();
            if (dto.Items != null)
            {
                foreach (LineItemDTO li in dto.Items)
                {
                    LineItem l = new LineItem();
                    l.FromDto(li);
                    this.Items.Add(l);
                }
            }
            this.LastUpdatedUtc = dto.LastUpdatedUtc;
            this.Notes.Clear();
            if (dto.Notes != null)
            {
                foreach (OrderNoteDTO n in dto.Notes)
                {
                    OrderNote nn = new OrderNote();
                    nn.FromDto(n);
                    this.Notes.Add(nn);
                }
            }
            this.OrderDiscountDetails.Clear();
            if (dto.OrderDiscountDetails != null)
            {
                foreach (DiscountDetailDTO d in dto.OrderDiscountDetails)
                {
                    Marketing.DiscountDetail m = new Marketing.DiscountDetail();
                    m.FromDto(d);
                    this.OrderDiscountDetails.Add(m);
                }
            }
            this.OrderNumber = dto.OrderNumber ?? string.Empty;
            this.Packages.Clear();
            if (dto.Packages != null)
            {
                foreach (OrderPackageDTO pak in dto.Packages)
                {
                    OrderPackage pak2 = new OrderPackage();
                    pak2.FromDto(pak);
                    this.Packages.Add(pak2);
                }
            }
            this.PaymentStatus = (OrderPaymentStatus)((int)dto.PaymentStatus);
            this.ShippingAddress.FromDto(dto.ShippingAddress);
            this.ShippingDiscountDetails.Clear();
            if (dto.ShippingDiscountDetails != null)
            {
                foreach (DiscountDetailDTO sd in dto.ShippingDiscountDetails)
                {
                    Marketing.DiscountDetail sdd = new Marketing.DiscountDetail();
                    sdd.FromDto(sd);
                    this.ShippingDiscountDetails.Add(sdd);
                }
            }
            this.ShippingMethodDisplayName = dto.ShippingMethodDisplayName ?? string.Empty;
            this.ShippingMethodId = dto.ShippingMethodId ?? string.Empty;
            this.ShippingProviderId = dto.ShippingProviderId ?? string.Empty;
            this.ShippingProviderServiceCode = dto.ShippingProviderServiceCode ?? string.Empty;
            this.ShippingStatus = (OrderShippingStatus)((int)dto.ShippingStatus);
            this.StatusCode = dto.StatusCode ?? string.Empty;
            this.StatusName = dto.StatusName ?? string.Empty;
            this.StoreId = dto.StoreId;
            this.ThirdPartyOrderId = dto.ThirdPartyOrderId ?? string.Empty;
            this.TimeOfOrderUtc = dto.TimeOfOrderUtc;
            this.TotalHandling = dto.TotalHandling;
            this.TotalShippingBeforeDiscounts = dto.TotalShippingBeforeDiscounts;
            this.TotalTax = dto.TotalTax;
            this.TotalTax2 = dto.TotalTax2;
            this.UserEmail = dto.UserEmail ?? string.Empty;
            this.UserID = dto.UserID ?? string.Empty;
        }