Create new orders

To create an order, you must perform the following:

  1. Get the orders manager.
    Get an instance of the OrdersManager object.
  2. Get the customer.
    Get the specified customer that the order will be associated with. To do this call the GetCustomer method of the orders manager and pass the ID of the customer as an argument.
  3. Get a number for the order.
    If no number is specified for the order, you must get the next highest order number that is available. To do this, perform the following:
    1. Get an instance of the NextOrderNumber object.
    2. To get the next order number, call the Next method of the NextOrderNumber instance.
    3. Increment the current highest order number by calling the IncrementNextOrderNumber method of the orders manager.
  4. Create a new order.
    To create an instance of the Order class, call the CreateOrder method of the orders manager.
  5. Set the customer.
    To associate the customer with the order set the Customer property of the Order instance.
  6. Set the properties of the order.
    Set the properties of the Order object to the specified values.
  7. Save the changes.
    Save the changes to the manager.

Following is a code example:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?