Order Number Prefix Questions

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
dlerickson
Posts: 80
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Order Number Prefix Questions

Post by dlerickson »

Hi, we have a scenario in which a Title order needs to be transferred between office branches, and possibly Select profiles. In doing so, the user wants to be able to reset the order number with a different prefix which corresponds to the new profile/area.

1) Is it possible to retrieve a list of the Order Number Prefixes for a given Profile using the API? If so, can you provide a snippet?
2) Is it necessary to also switch the order's Profile if resetting the order number with a new prefix from a different profile?

Thanks.
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Order Number Prefix Questions

Post by BobRichards »

1) Is it possible to retrieve a list of the Order Number Prefixes for a given Profile using the API? If so, can you provide a snippet?

You can enumerate the list of Order Numbering groups to find much information.

Code: Select all

var numMgr = ss.GetService<IOrderNumberingManager>();
var group = numMgr.OrderNumberingGroups.Where(t => t.Name == "ANumGrpName").FirstOrDefault();
var prefixes = group.AvailablePrefixes.ToList();
var suffixes = group.AvailableSuffixes.ToList();
var profiles = group.Profiles.ToList();
2) Is it necessary to also switch the order's Profile if resetting the order number with a new prefix from a different profile?

I don't quite understand. Changing the profile for an order will not change the order name.
Bob Richards, Senior Software Developer, SoftPro
dlerickson
Posts: 80
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Re: Order Number Prefix Questions

Post by dlerickson »

OK, that was what I needed. BTW, disregard question 2; it did indeed turn out to be irrelevant.

But now, I have another problem. On the order, the properties "Prefix", "Number", and "BaseNumber" are all read-only for an order that has been created in a previous session. Is there any way of getting around this? Ideally, I'd only need to update the "Number" field.
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Order Number Prefix Questions

Post by BobRichards »

Once the order is saved, Select does not maintain it as separate parts (prefix, number, suffix) - just as a string with a maximum of 30 characters. You can rename an order if you wish (assuming it does not conflict with another order) but you have to figure out the prefix/suffix parts on your own.
Bob Richards, Senior Software Developer, SoftPro
dlerickson
Posts: 80
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Re: Order Number Prefix Questions

Post by dlerickson »

I'm a bit confused here - when you say "rename an order," what field are you referring to specifically? I've tried setting the "Number" field, but it's showing as read-only, and any attempts to set it are failing, as expected. Is there another field I should be setting instead?
dlerickson
Posts: 80
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Re: Order Number Prefix Questions

Post by dlerickson »

OK, I see the "Rename Order" function in the Select client itself, and that's basically the same thing that I'm trying to do programmatically. I'm pulling the prefixes per profile, as this tool seems to be doing, and attempting to reset the "Number" property on the order itself. Is there another way to mimic the "Rename Order" functionality this way?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Order Number Prefix Questions

Post by BobRichards »

The process is to open the order, rename it, then save the new order.

Code: Select all

// Get the orginal order.
IOrderStore os = ss.GetService<IOrderStore>();
IOrderInfo orderInfo = os.Orders.Where(t => t.Number == "OldNumber").First();
using (IOrder order = os.OpenOrder(orderInfo, OrderEditMode.ReadWrite))
{
    // Create a new name for the order.
    var spec = new OrderCreationSpec() { BaseNumber = "NewNumber" };
    
    // Set the new name then save it.
    order.RenameOrder(spec);
    os.ApplyChanges(order);
}
Bob Richards, Senior Software Developer, SoftPro
Post Reply