Page 1 of 1

How to set profile when creating a order through API?

Posted: Mon May 16, 2011 4:05 pm
by kqian
How can I set the profile when creating an order? Thanks.
// Create the server object. Note the use of the constant to define custom login.
NetworkCredential credential = new NetworkCredential(@"<username>", @"<password>", SoftPro.Select.Client.Constants.SelectDomain);
SelectServer server = new SelectServer(null, new Uri(@"http://localHost:80/SelectServer"), credential);

// Create the order tracking client
SoftPro.OrderTracking.Client.OrderTracking ot = server.GetService<SoftPro.OrderTracking.Client.OrderTracking>();

// Create the specification for the new order number.
OrderCreationSpec spec = new OrderCreationSpec()
{
BaseOrderNumber = @"MyOrderNumber",
Prefix = @"Pre",
Suffix = @"Suf"
}

using ( IOrder order = ot.CreateOrder(spec) )
....

Re: How to set profile when creating a order through API?

Posted: Tue May 17, 2011 9:06 am
by Hadi Chemaly
The profile used is the one associated with the user with which the network credential instance is created.

Can you be more specific about what you are trying to achieve?

Re: How to set profile when creating a order through API?

Posted: Tue May 17, 2011 2:24 pm
by kqian
When creating a instance of "SelectServer", it has a "CurrentProfile" as readonly. I want to know how I can change the Profile dynamically to create order for different profile, let say the user account has multiple profiles associated.

I tried to subscribe the SelectServer.ChooseProfile event but the event was never raised.

Thanks.

Kevin

Re: How to set profile when creating a order through API?

Posted: Wed May 18, 2011 5:34 pm
by Hadi Chemaly
The OrderCreationSpec class passed in as an argument to OrderTracking.CreateOrder(spec) lets you specify the OwningProfileID upon order creation. Equivalently, once an order is created, you can change its associated profile through the IOrder.OwningProfileID property.

Down the road, we plan to provide a ProfileManagement API with which you will be able to inspect the profiles associated with a trustee. For the time being, you can retrieve the profile IDs you need directly from the database.

Re: How to set profile when creating a order through API?

Posted: Wed Jun 01, 2011 5:03 pm
by roteague
What about when templates are attached to a profile. We use unique profiles for each brach. Each of these profiles has unique templates associated with them. We would like to create an order using the API, assign it to a profile, and make sure that the templates are executed when the order is created.