Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PreSaveProcessing
Message
 
To
09/10/2009 10:51:06
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01428468
Message ID:
01429240
Views:
60
John,

>I'm trying to figure out how to use the PreSaveProcessing method in the mmBusinessObject class.
>
>I'm would like to insert the current user name into a stored procedure's parameter prior to it being executed when a form's save button is selected. I didn't find any examples in the documentation and I could not figure out in the framework where to utilize this method. Any assistance would be appreciated.

Ultimately, you don't want the business object to get the user name from the environment since that breaks the rules of n-tier programming. Ultimately, if this is something you want to do for all of your business objects, and an approach that works for both Web and Windows apps, you can create a constructor in your business objects that accepts the user name (or id??) and then have the business object store the value in a property for later use. This property can be defined at the ABusinessObject level so it is inherited by all your business objects.

When you're ready to save, you can then retrieve this value from the business object property and then store it in the business entity (or DataTable if you aren't using entities). You can put this code in one of the business object's HookPreSave methods.

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform