1) it makes sense to logically separate these 3 steps to keep actions small and with a single responsibility, that's fine. I would see them as 3 server actions inside maybe your CS module. And that CS exposing a single service action "InitiateQuote" that is called from your ui. That takes care of creating it in your own database with status Generated (maybe calling a crud wrapper from your CS module) followed by these 3 other steps.
For this, here are some options :
- just execute all in the same service action, and only go back to client after all is done.
- set your initial status to some distinctive value, and kick off a timer to pick any with that status up and do those 3 extra steps.
- use the events that were discussed on the ODC conference (don't know exactly what OS is calling them, it is a bit like light BPT, I think, a piece of logic triggered by some database action)
the bottom 2 options will free up the ui quicker
2) if you don't see a reason for waiting, then you solve it (as you already seem to have done in your client side logic) by just moving right on to creating in sage, right after creating in your own database. If there is a reason for waiting, than it should probably be done by options 2 or 3 above, where your timer or process kicks of on the desired status change
3) Aah, ok, i think it might be this : whenever the quote gets update in your database, the sage quote has to be brought in sync. And if the quote reaches EndOfLife, the process can stop. You should be able to confirm this by looking at the CloseOn property of the Wait, it is probably an update of quote entity in your database with the given id.
For this, you will probably have a second service action on your CS module, called something like "SaveQuote",which takes care of both updating in your own database and in Sage. You have similar options as for 1)
4) this is not primarily about performance (although also relevant) but about where your business logic should live. I think it should live first and foremost inside a CS or maybe BL module, that is the module that is responsible for all the rules and what steps should or should not be taken under what conditions, what changes are or are not possible, what consequence do they have, etc., not your UI module. As an extra, you can make your UI also reflect some of these rules, but the CS or BL should guard and own them.
Dorine