Dynamicweb.eCommerce.Products Namespace > Product Class > UpdateStock Method : UpdateStock(Order,OrderStockOperator) Method |
'Declaration
Public Overloads Shared Function UpdateStock( _ ByVal order As Order, _ ByVal operator As Product.OrderStockOperator _ ) As Integer
public static int UpdateStock( Order order, Product.OrderStockOperator operator )
class MyPage : System.Web.UI.Page { private void DeleteOrders(string orderID) { Dynamicweb.eCommerce.Orders.OrderState deletedOrderState = null; //Check for a 'Deleted' Order state and use if exists Dynamicweb.eCommerce.Orders.OrderStateCollection orderStates = Dynamicweb.eCommerce.Orders.OrderState.getAllOrderstates(false); foreach (Dynamicweb.eCommerce.Orders.OrderState orderState in orderStates) { if (orderState.IsDeleted) { deletedOrderState = orderState; } } Dynamicweb.eCommerce.Orders.Order order = Dynamicweb.eCommerce.Orders.Order.Create(orderID); order.Deleted = true; order.StateID = deletedOrderState.ID; order.Save(); if (order.Complete) { Product.UpdateStock(order, Product.OrderStockOperator.Positive); } } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2