Creates an order modification object which can be filled with desired changes and passed to Modify method.
Visual Basic |
---|
Public Function PrepareModify() As CQGOrderModify |
CQGOrderModify object, ready to be configured.
See the remarks section of Modify Method for details on order modification.
The following example shows how to modify an internal order via CQG API.
VB
C#
Public Sub ModifyOrder(selectedOrderID As String) Dim currentOrderModify As CQGOrderModify Dim orderToModify As CQGOrder ' Get order with GWOrderID = SelectedOrderID from internal orders collection Set orderToModify = CEL.InternalOrders.Item(selectedOrderID) If orderToModify Is Nothing Then Debug.Print "Order is not found in internal orders collection." Exit Sub End If Debug.Print "Order " & orderToModify.UEName & " was found in internal orders collection." 'Checking order availability for modification. If Not orderToModify.CanBeModified Then Debug.Print "Selected order cannot be modified." Exit Sub End If Set currentOrderModify = orderToModify.PrepareModify 'Change order quantity currentOrderModify.Properties(opQuantity) = 11 orderToModify.Modify currentOrderModify Debug.Print "Order modification request was sent." End Sub
public void ModifyOrder(String selectedOrderID) { // Get order with GWOrderID = SelectedOrderID from internal orders collection CQGOrder orderToModify = cel.InternalOrders[selectedOrderID]; if (orderToModify == null) { Console.WriteLine("Order is not found in internal orders collection."); return; } Console.WriteLine("Order {0} was found in internal orders collection.", orderToModify.UEName); //Checking order availability for modification. if (!orderToModify.CanBeModified) { Console.WriteLine("Selected order cannot be modified."); return; } CQGOrderModify currentOrderModify = orderToModify.PrepareModify(); // Change order quantity currentOrderModify.Properties[eOrderProperty.opQuantity].Value = 11; orderToModify.Modify(currentOrderModify); Console.WriteLine("Order modification request was sent."); }