Table of Contents

Class CustomerOrderCollection

Namespace
Dynamicweb.Ecommerce.Orders
Assembly
Dynamicweb.Ecommerce.dll
Represents a collection of customer orders
[Serializable]
public class CustomerOrderCollection : OrderCollection, IList<Order>, ICollection<Order>, IReadOnlyList<Order>, IReadOnlyCollection<Order>, IEnumerable<Order>, IList, ICollection, IEnumerable
Inheritance
CustomerOrderCollection
Implements
Inherited Members
Extension Methods

Examples

using Dynamicweb.Ecommerce.Frontend;
using Dynamicweb.Ecommerce.Orders;
using Dynamicweb.Environment.Helpers;
using Dynamicweb.Rendering;

namespace Dynamicweb.Ecommerce.Examples.Orders
{
    public class CustomerOrdersRendererSample
    {
        private struct Tags
        {
            public const string LoopStartOrders = "LoopStart(Orders)";
            public const string OrderCount = "Ecom:CustomerCenter.Orders.Count";
            public const string EmptyOrderList = "Ecom:CustomerCenter.Orders.EmptyList";
            public const string LoopOrders = "Orders";
            public const string Reorder = "Ecom:Order.ReorderID";
        }

        public void RenderCustomerOrders(Template template, string customerId, Dynamicweb.Frontend.PageView pageView, int paragraphId)
        {
            if (template.LoopExists(Tags.LoopStartOrders))
            {
                CustomerOrderCollection customerOrders = new CustomerOrderCollection();
                customerOrders.Load(customerId);

                // Add filtering
                CustomerOrderCollectionFilter filter = new CustomerOrderCollectionFilter(ref customerOrders);
                filter.ApplyFromQueryString(paragraphId);

                OrderCollection ordersToRender = filter.Output;

                template.SetTag(Tags.OrderCount, ordersToRender.Count);
                if (ordersToRender.Count == 0)
                {
                    template.SetTag(Tags.EmptyOrderList, "true");
                }
                else
                {
                    Template orderTemplate = template.GetLoop(Tags.LoopOrders);

                    Renderer renderer = new Renderer(pageView);

                    // Create querystrings common to add all products in the order to the cart command
                    string rawQString = LinkHelper.StripQueryString("CC" + paragraphId + ",ReorderID" + paragraphId + ",ResendOrderID" + paragraphId + ",Addresses" + paragraphId + ",CCAddToMyLists" + paragraphId + "*,CCRemoveFromMyLists" + paragraphId + "*");
                    string reorderQString = LinkHelper.AddToQueryString(rawQString, "CC" + paragraphId + "=Orders");

                    foreach (Order order in ordersToRender)
                    {
                        // Adds all products in the order to the cart
                        orderTemplate.SetTag(Tags.Reorder, LinkHelper.AddToQueryString(reorderQString, "ReorderID=" + order.Id));

                        renderer.RenderOrder(order, orderTemplate);
                        orderTemplate.CommitLoop();
                    }
                }
            }
        }
    }
}

Fields

OrderContextEmpty

public const string OrderContextEmpty = "-1"

Field Value

string

Properties

MaxDate

Find the max date of order.
public DateTime MaxDate { get; }

Property Value

DateTime
The max date.

MinDate

Find the min date of order.
public DateTime MinDate { get; }

Property Value

DateTime
The min date.

UniqueProducts

Gets the array of unique products.
public ArrayList UniqueProducts { get; }

Property Value

ArrayList
The unique products.

Methods

Load(CustomerCenterSettings, OrderType, int)

Loads customer orders of specified type
public void Load(CustomerCenterSettings settings, OrderType orderType, int recurringOrderId)

Parameters

settings CustomerCenterSettings
The customer center settings.
orderType OrderType
The order type.
recurringOrderId int
The recurring order ID.

Load(long)

Loads customer orders from the database by specified customer ID.
[Obsolete]
public void Load(long customerId)

Parameters

customerId long
The customer ID.

Examples

Look at example for CustomerOrderCollection class

Load(long, string)

Loads customer orders from the database by specified customer ID.
[Obsolete]
public void Load(long customerId, string shopIds)

Parameters

customerId long
The customer ID.
shopIds string
The shops IDs.

Examples

Look at example for CustomerOrderCollection class

Load(long, string, OrderType, bool)

Loads customer orders of specified type
public void Load(long customerId, string shopIds, OrderType orderType, bool useCustomerNumber)

Parameters

customerId long
The customer ID.
shopIds string
The shops IDs.
orderType OrderType
The order type.
useCustomerNumber bool
Select orders by user customer number.

Load(long, string, OrderType, int, bool, string)

Loads customer orders of specified type
public void Load(long customerId, string shopIds, OrderType orderType, int recurringOrderId, bool useCustomerNumber, string orderContextIds)

Parameters

customerId long
The customer ID.
shopIds string
The shops IDs.
orderType OrderType
The order type.
recurringOrderId int
The recurring order ID.
useCustomerNumber bool
Select orders by user customer number.
orderContextIds string
The order context IDs.

Load(long, string, OrderType, int, bool, string, DateTime)

Loads customer orders of specified type
public void Load(long customerId, string shopIds, OrderType orderType, int recurringOrderId, bool useCustomerNumber, string orderContextIds, DateTime fromDate)

Parameters

customerId long
The customer ID.
shopIds string
The shops IDs.
orderType OrderType
The order type.
recurringOrderId int
The recurring order ID.
useCustomerNumber bool
Select orders by user customer number.
orderContextIds string
The order context IDs.
fromDate DateTime
The minimum order date.

Load(long, string, int)

Loads customer orders from the database by specified customer ID.
[Obsolete]
public void Load(long customerId, string shopIds, int recurringOrderId)

Parameters

customerId long
The customer ID.
shopIds string
The shops IDs.
recurringOrderId int
The shops IDs.

Examples

Look at example for CustomerOrderCollection class

Load(long, string, int, bool)

Loads customer recurring orders
[Obsolete]
public void Load(long customerId, string shopIds, int recurringOrderId, bool useCustomerNumber)

Parameters

customerId long
shopIds string
recurringOrderId int
useCustomerNumber bool

LoadPendingOrders(long)

Loads customer unclosed orders from the database by specified customer ID.
public void LoadPendingOrders(long customerId)

Parameters

customerId long
The customer ID.

Examples

Look at example for CustomerOrderCollection class

LoadQuotes(long, string)

Loads customer orders from the database by specified customer ID.
[Obsolete]
public void LoadQuotes(long customerId, string shopIds)

Parameters

customerId long
The customer ID.
shopIds string
The shops IDs.

Examples

Look at example for CustomerOrderCollection class

LoadQuotes(long, string, bool)

[Obsolete]
public void LoadQuotes(long customerId, string shopIds, bool useCustomerNumber)

Parameters

customerId long
shopIds string
useCustomerNumber bool
To top