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
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
settingsCustomerCenterSettings- The customer center settings.
orderTypeOrderType- The order type.
recurringOrderIdint- The recurring order ID.
Load(long)
Loads customer orders from the database by specified customer ID.
[Obsolete]
public void Load(long customerId)
Parameters
customerIdlong- The customer ID.
Examples
Look at example forCustomerOrderCollection class
Load(long, string)
Loads customer orders from the database by specified customer ID.
[Obsolete]
public void Load(long customerId, string shopIds)
Parameters
Examples
Look at example forCustomerOrderCollection class
Load(long, string, OrderType, bool)
Loads customer orders of specified type
public void Load(long customerId, string shopIds, OrderType orderType, bool useCustomerNumber)
Parameters
customerIdlong- The customer ID.
shopIdsstring- The shops IDs.
orderTypeOrderType- The order type.
useCustomerNumberbool- 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
customerIdlong- The customer ID.
shopIdsstring- The shops IDs.
orderTypeOrderType- The order type.
recurringOrderIdint- The recurring order ID.
useCustomerNumberbool- Select orders by user customer number.
orderContextIdsstring- 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
customerIdlong- The customer ID.
shopIdsstring- The shops IDs.
orderTypeOrderType- The order type.
recurringOrderIdint- The recurring order ID.
useCustomerNumberbool- Select orders by user customer number.
orderContextIdsstring- The order context IDs.
fromDateDateTime- 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
Examples
Look at example forCustomerOrderCollection class
Load(long, string, int, bool)
Loads customer recurring orders
[Obsolete]
public void Load(long customerId, string shopIds, int recurringOrderId, bool useCustomerNumber)
Parameters
LoadPendingOrders(long)
Loads customer unclosed orders from the database by specified customer ID.
public void LoadPendingOrders(long customerId)
Parameters
customerIdlong- The customer ID.
Examples
Look at example forCustomerOrderCollection class
LoadQuotes(long, string)
Loads customer orders from the database by specified customer ID.
[Obsolete]
public void LoadQuotes(long customerId, string shopIds)
Parameters
Examples
Look at example forCustomerOrderCollection class
LoadQuotes(long, string, bool)
[Obsolete]
public void LoadQuotes(long customerId, string shopIds, bool useCustomerNumber)