' This is a "safe" class, meaning that it is created once 
' and never overwritten. Any custom code you add to this class 
' will be preserved when you regenerate your application.
'
' Typical customizations that may be done in this class include
'  - adding custom event handlers
'  - overriding base class methods

Imports System.Data.SqlTypes
Imports BaseClasses
Imports BaseClasses.Data
Imports BaseClasses.Data.SqlProvider

Namespace AuditTrail.Business

''' <summary>
''' Provides access to the data in a database record.
''' Also provides access to the <see cref="EmployeesTable"></see> that each record is associated with.
''' </summary>
''' <remarks>
''' </remarks>
''' <seealso cref="EmployeesTable"></seealso>

<Serializable()> Public Class EmployeesRecord
	Inherits BaseEmployeesRecord

	' Constructors
	
	Public Sub New()
		MyBase.New()
	End Sub
	


	#Region "Code Customization"
	
	''' <summary>
	''' This custom method is an event handler for the insert event in the Data Access Layer.
	''' </summary>
	Private Sub Audit_Insert(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) _
	    Handles MyBase.InsertingRecord    
		''' You can modify the following sample code to fit specific need
		   
		Dim mySession As System.Web.SessionState.HttpSessionState
		mySession = System.Web.HttpContext.Current.Session
	
		Me.CreatedOn = DateTime.Now()
		Me.CreatedBy = mySession("LoginInfo")("UserId")

	End Sub
	    
	#End Region
	
	#Region "Code Customization"
	
	''' <summary>
	''' This custom method is an event handler for the update event in the Data Access layer.
	''' </summary>
	Private Sub Audit_Update(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) _
	    Handles MyBase.UpdatingRecord   
		''' You can modify the following sample code to fit specific need
		   
		Dim mySession As System.Web.SessionState.HttpSessionState
		mySession = System.Web.HttpContext.Current.Session
	
		Me.LastUpdatedOn = DateTime.Now()
		Me.LastUpdatedBy = mySession("LoginInfo")("UserId")
	End Sub
	    
	#End Region
	End Class
End Namespace
