Class OrderCollection
- Namespace
- Dynamicweb.Ecommerce.Orders
- Assembly
- Dynamicweb.Ecommerce.dll
Represents a collection of the orders.
[Serializable]
[Obsolete]
public class OrderCollection : Collection<Order>, IList<Order>, ICollection<Order>, IReadOnlyList<Order>, IReadOnlyCollection<Order>, IEnumerable<Order>, IList, ICollection, IEnumerable
- Inheritance
-
OrderCollection
- Implements
- Inherited Members
- Extension Methods
Examples
class MyPage : System.Web.UI.Page
{
private int NumPages(ref Dynamicweb.eCommerce.Orders.OrderCollection Orders, ref Dynamicweb.eCommerce.CustomerCenter.CustomerCenterSettings Settings)
{
int pageSize = Settings.ItemsPerPage;
int ret = 0;
ret = Convert.ToInt32(Orders.Count / pageSize);
if ((ret * pageSize) < Orders.Count)
{
ret += 1;
}
return ret;
}
}
Properties
this[int]
Gets or sets the element at the specified index.
public Order this[int index] { get; }
Parameters
index
int
Property Value
- Order
- The element at the specified index.
SortByField
Gets or sets the sort by field.
public string SortByField { get; set; }
Property Value
SortOrder
Gets or sets the sort order.
public SortOrderType SortOrder { get; set; }
Property Value
Methods
Load(string)
Loads the specified orders from DB.
public void Load(string sql)
Parameters
sql
string- The SQL query.
Examples
class MyPage : System.Web.UI.Page
{
private OrderCollection GetOrderCollection()
{
string sql = "SELECT * FROM EcomOrders";
OrderCollection col = default(OrderCollection);
col = new OrderCollection();
col.Load(sql);
return col;
}
}
Sort()
Sorts this instance.
public void Sort()
Examples
class MyPage : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
int uid = new Dynamicweb.Frontend.Extranet().UserID;
if (uid == 0) { Response.End(); }
CustomerOrderCollection customerOrders = new CustomerOrderCollection();
customerOrders.Load(uid);
customerOrders.Sort();
foreach (Order enumOrder in customerOrders)
{
foreach (OrderLine orderLine in enumOrder.OrderLines)
{
TODO: insert your code here
}
}
}
}
Sort(string, SortOrderType)
Sorts the specified field name.
public void Sort(string fieldName, SortOrderType order)
Parameters
fieldName
string- Name of the field.
order
SortOrderType- The sort order.
Examples
class MyPage : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
int uid = new Dynamicweb.Frontend.Extranet().UserID;
if (uid == 0) { Response.End(); }
CustomerOrderCollection customerOrders = new CustomerOrderCollection();
customerOrders.Load(uid);
customerOrders.Sort("OrderID", SortOrderType.Asc);
foreach (Order enumOrder in customerOrders)
{
foreach (OrderLine orderLine in enumOrder.OrderLines)
{
TODO: insert your code here
}
}
}
}