Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PreSaveProcessing
Message
 
À
09/10/2009 10:51:06
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01428468
Message ID:
01429240
Vues:
59
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform