Пример #1
0
        /// <summary>
        /// Serializes the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="orderGroup">The order group.</param>
        public static void Serialize(XmlTextWriter writer, OrderGroup orderGroup)
        {
            XmlSerializer serializer = new XmlSerializer(orderGroup.GetType());

            serializer.Serialize(writer, orderGroup);
            serializer = null;
        }
Пример #2
0
 /// <summary>
 /// Sets the parent.
 /// </summary>
 /// <param name="orderGroup">The order group.</param>
 internal void SetParent(OrderGroup orderGroup)
 {
     foreach (OrderAddress address in this)
     {
         address.SetParent(orderGroup);
     }
 }
Пример #3
0
 /// <summary>
 /// Sets the parent.
 /// </summary>
 /// <param name="orderGroup">The order group.</param>
 internal void SetParent(OrderGroup orderGroup)
 {
     foreach (OrderForm form in this)
     {
         form.SetParent(orderGroup);
     }
 }
Пример #4
0
        /// <summary>
        /// Adds the specified order group to the existing cart.
        /// </summary>
        /// <param name="orderGroup">The order group.</param>
        /// <param name="lineItemRollup">if set to <c>true</c> [line item rollup].</param>
        public void Add(OrderGroup orderGroup, bool lineItemRollup)
        {
            if (orderGroup == null)
            {
                throw new ArgumentNullException("orderGroup");
            }

            if ((orderGroup.OrderForms != null) && (orderGroup.OrderForms.Count != 0))
            {
                OrderContext orderSystem   = OrderContext.Current;
                ClassInfo    orderFormInfo = orderSystem.OrderFormClassInfo;

                // need to set meta data context before cloning
                MetaDataContext.DefaultCurrent = OrderContext.MetaDataContext;
                foreach (OrderForm form in orderGroup.OrderForms)
                {
                    OrderForm orderForm = base.OrderForms[form.Name];
                    if (orderForm == null)
                    {
                        orderForm      = (OrderForm)orderFormInfo.CreateInstance();
                        orderForm.Name = form.Name;
                        base.OrderForms.Add(orderForm);
                    }

                    int count = form.LineItems.Count;
                    for (int i = 0; i < count; i++)
                    {
                        LineItem newLineItem = (LineItem)form.LineItems[i].Clone();
                        newLineItem.SetParent(orderForm);
                        orderForm.LineItems.Add(newLineItem, lineItemRollup);
                    }
                }
            }
        }
Пример #5
0
 /// <summary>
 /// Sets the parent order group.
 /// </summary>
 /// <param name="parentGroup">The parent group.</param>
 public override void SetParent(object parentGroup)
 {
     _Parent = (OrderGroup)parentGroup;
     this.Shipments.SetParent(this);
     this.Payments.SetParent(this);
     this.LineItems.SetParent(this);
     this.Discounts.SetParent(this);
 }
Пример #6
0
        /// <summary>
        /// Initializes the object with data from the specified order group.
        /// </summary>
        /// <param name="orderGroup">The order group.</param>
        internal virtual void Initialize(OrderGroup orderGroup)
        {
            _OrderForms     = orderGroup.OrderForms;
            _OrderAddresses = orderGroup.OrderAddresses;

            this.SetParent(this);

            // Copy all the fields
            this.AddressId       = orderGroup.AddressId;
            this.AffiliateId     = orderGroup.AffiliateId;
            this.ApplicationId   = orderGroup.ApplicationId;
            this.BillingCurrency = orderGroup.BillingCurrency;
            this.CustomerId      = orderGroup.CustomerId;
            this.CustomerName    = orderGroup.CustomerName;
            this.HandlingTotal   = orderGroup.HandlingTotal;
            // this must be unique, so use the one generated this.InstanceId = orderGroup.InstanceId;
            this.Name          = orderGroup.Name;
            this.ProviderId    = orderGroup.ProviderId;
            this.ShippingTotal = orderGroup.ShippingTotal;
            this.Status        = orderGroup.Status;
            this.SubTotal      = orderGroup.SubTotal;
            this.TaxTotal      = orderGroup.TaxTotal;
            this.Total         = orderGroup.Total;
        }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderAddressCollection"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public OrderAddressCollection(OrderGroup parent)
 {
     _Parent = parent;
 }
Пример #8
0
 /// <summary>
 /// Sets the parent.
 /// </summary>
 /// <param name="Parent">The parent.</param>
 public override void SetParent(object Parent)
 {
     _Parent = (OrderGroup)Parent;
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderFormCollection"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 public OrderFormCollection(OrderGroup parent)
 {
     _Parent = parent;
 }
Пример #10
0
 /// <summary>
 /// Adds the specified order group to the existing cart.
 /// </summary>
 /// <param name="orderGroup">The order group.</param>
 public void Add(OrderGroup orderGroup)
 {
     Add(orderGroup, false);
 }