Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Scott,
If I understand your situation, I'd try this:
1. drop your crm bo on the form
2. drop a SFSUsersBO on the form
3. Bind the controls to the crm BO.
4. If you are using a MaintenanceFormToolStrip, turn off edit/add/delete/save-undo, allow only navigation and browse dialog (if you are using it).
5. Add a new button to the toolstrip or a button on the form to save the user.
6. When the user clicks on this new save user button, in code, you probably would do:
a) verify that this user hasn't already been added (could skip if you are populating the crm bo based on users not added already)
b) call .Add on SFSUsersBO
c) copy data from you crm BO to the SFSUsersBO. I.e. crmBO.UserName = SFSUsersBO.us_name, doing any data transformation needed
d) call .Save on the SFSUsersBO
e) potentially update the UI or display a message to let the users know it was saved.
This way you are simply talking between two BOs, keeping the UI out of it. One BO is presented to the user so they can make decisions, the other is were the data gets added. All SQL is encapsulated within the BOs and you don't have to redo it here. The actual data access to add a new user to the SF security system is not trivial if you tried to add one manually using sql in any case (they use an encrypted field to hold a bunch of sensitive info, like password, password history, etc.). The SFSUsersBO is far easier to work with.
I hope this helps!
|