Wrox Programmer Forums
|
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2009, 11:49 AM
Authorized User
 
Join Date: Apr 2009
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Audit trail does not work for lists of EO objects

Hi,

I have set up the ENTRoleEO , ENTRoleCapabilityEO, ENTRoleUserAccountEO for audit trail.

The changes made to the Role's name are logged but the changes made to the ENTRoleCapability & ENTRoleUserAccount tables are not.
because _originalPropertyValues = nothing

The ENTRoleEO has ENTRoleCapabilityEOList and ENTRoleUserAccountEOList as
prperties. When a new role is created the audit trail log works OK ie it logs the changes for all role, roleCapability and roleUserAccount.



The question any suggestion please on how to make the properties update work?

Regards

Last edited by luckystar; June 2nd, 2009 at 01:41 PM.. Reason: clarification
 
Old June 5th, 2009, 06:47 AM
Wrox Author
 
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts
Default

Hi Luckystar,
Could you zip your project and email it to me so I can take a look. My email is [email protected]

Vince
 
Old June 12th, 2009, 06:25 PM
Authorized User
 
Join Date: Apr 2009
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vince

Many thanks for your reply and sorry for the delay in replying . All my EO objects have the audit trail code in them . two issues were encountered

1 - if an object is not selected for audit trail from the UI I get an exception when I update I got around it
by making the following mod ( ****** ) to the AuditUpdate method in the base class

Code:
PublicSub AuditUpdate(ByRef validationErrors As ENTValidationErrors, ByVal userAccountId AsInteger)
Using db2 AsNew ENTFrammeworkDataContext(DBHelper.GetConnectionString(DBHelper.SCADADBConnectionKey))
' Check if the object has been selected for auditing
Dim auditObject AsNew ENTAuditObjectEO()
 
************** If auditObject.Load(db2, Me.[GetType]().Name) *************Then
'
ForEach [property] As ENTProperty In _originalPropertyValues
' Get the value of this property in this instance
Dim value AsObject = Me.GetType.GetProperty([property].Name).GetValue(Me, Nothing)
' compare properties in before and after update and if changed log in audit.
IfNot (value IsNothing) AndNot ([property].Value IsNothing) And _
Convert.ToString(value) <> Convert.ToString([property].Value) Then
Dim audit AsNew ENTAuditEO
audit.ObjectName = Me.GetType.Name
audit.RecordId = ID
audit.PropertyName = [property].Name
audit.OldValue = (If([property].Value IsNothing, Nothing, Convert.ToString([property].Value)))
audit.NewValue = (If(value IsNothing, Nothing, Convert.ToString(value)))
audit.AuditType = ENTAuditEO.AuditTypeEnum.Update
' save to audit object
audit.Save(db2, validationErrors, userAccountId)
EndIf
Next
'
EndIf
'
EndUsing
EndSub
The second issue is, to audit trail the role capabilities/ role user accounts as and when
a role is changed. the issue here is the storePropertyValues method is in the load mehtod. of the EO object not the EOList object so I got arrount it as follows:

Code:
 
PrivateSub LoadFromList(ByVal roleCapabilities As List(Of ENTRoleCapability))
 
If roleCapabilities.Count > 0 Then
ForEach roleCapability As ENTRoleCapability In roleCapabilities
Dim newRoleCapabilityEO AsNew ENTRoleCapabilityEO()

*************newRoleCapabilityEO.Load(roleCapability.ENTRoleCapabilityId) ***********
 
Me.Add(newRoleCapabilityEO)
Next
EndIf
EndSub
I did send you an email a while ago regarding my other issues posted in multuple datacontext thread. I would be grateful if you let me have your opinion.

regards





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an Audit Trail Jade08 Pro VB 6 3 October 23rd, 2008 12:44 AM
Infopath Audit Trail sqaengineer Infopath 0 August 13th, 2007 10:10 AM
Crumb trail muks XSLT 8 October 6th, 2006 03:15 AM
BizTalk trail download josekarun Biztalk 0 August 4th, 2006 10:52 AM
JavaScript trail for books varelg Javascript 1 April 25th, 2004 07:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.