' This class is "generated" and will be overwritten.
' Your customizations should be made in PersonalDDRecord.vb

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

Namespace Persons.Business

''' <summary>
''' The generated superclass for the <see cref="PersonalDDRecord"></see> class.
''' </summary>
''' <remarks>
''' This class is not intended to be instantiated directly.  To obtain an instance of this class, 
''' use the methods of the <see cref="PersonalDDTable"></see> class.
''' </remarks>
''' <seealso cref="PersonalDDTable"></seealso>
''' <seealso cref="PersonalDDRecord"></seealso>

<Serializable()> Public Class BasePersonalDDRecord
	Inherits PrimaryKeyRecord
	

	Public Shared Shadows ReadOnly TableUtils As PersonalDDTable = PersonalDDTable.Instance

	' Constructors
 
	Protected Sub New()
		MyBase.New(TableUtils)
	End Sub

	Protected Sub New(ByVal record As PrimaryKeyRecord)
		MyBase.New(record, TableUtils)
	End Sub
	
	'Evaluates Initialize when->Inserting record formulas specified at the data access layer
    Public Overridable Sub PersonalDDRecord_InsertingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.InsertingRecord
        'Apply Initialize->Inserting record formula only if validation is successful.
        	        Dim PersonalDDRec As PersonalDDRecord = CType(sender,PersonalDDRecord)
        Validate_Inserting()
        If Not PersonalDDRec Is Nothing AndAlso Not PersonalDDRec.IsReadOnly Then
                End If
    End Sub

	'Evaluates Initialize when->Updating record formulas specified at the data access layer
    Public Overridable Sub PersonalDDRecord_UpdatingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.UpdatingRecord
        'Apply Initialize->Updating record formula only if validation is successful.
        	        Dim PersonalDDRec As PersonalDDRecord = CType(sender,PersonalDDRecord)
        Validate_Updating()
        If Not PersonalDDRec Is Nothing AndAlso Not PersonalDDRec.IsReadOnly Then
                End If
    End Sub
    
    'Evaluates Initialize when->Reading record formulas specified at the data access layer
    Public Overridable Sub PersonalDDRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord
        'Apply Initialize->Reading record formula only if validation is successful.
        	        Dim PersonalDDRec As PersonalDDRecord = CType(sender,PersonalDDRecord)
        If Not PersonalDDRec Is Nothing AndAlso Not PersonalDDRec.IsReadOnly Then
                End If
    End Sub
    
   'Evaluates Validate when->Inserting formulas specified at the data access layer
   Public Overridable Sub Validate_Inserting ()
		Dim fullValidationMessage As String = ""
		Dim validationMessage As String = ""

		dim formula as String = ""


		If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then
			fullValidationMessage &= validationMessage & vbCrLf
		End If

		If fullValidationMessage <> "" Then
			Throw New Exception(fullValidationMessage)
		End If 
	End Sub
	
	'Evaluates Validate when->Updating formulas specified at the data access layer
   Public Overridable Sub Validate_Updating ()
		Dim fullValidationMessage As String = ""
		Dim validationMessage As String = ""

		dim formula as String = ""


		If validationMessage <> "" AndAlso validationMessage.ToLower() <> "true" Then
			fullValidationMessage &= validationMessage & vbCrLf
		End If

		If fullValidationMessage <> "" Then
			Throw New Exception(fullValidationMessage)
		End If 
	End Sub
 
	Public Overridable Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing) As String

		Dim e As Data.BaseFormulaEvaluator = New Data.BaseFormulaEvaluator()

            ' All variables referred to in the formula are expected to be
            ' properties of the DataSource.  For example, referring to
            ' UnitPrice as a variable will refer to DataSource.UnitPrice
            e.DataSource = dataSourceForEvaluate

            Dim resultObj As Object = e.Evaluate(formula)
            If resultObj Is Nothing Then
                Return ""
            End If
        	Return resultObj.ToString()
	End Function







#Region "Convenience methods to get/set values of fields"

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.id field.
	''' </summary>
	Public Function Getid0Value() As ColumnValue
		Return Me.GetValue(TableUtils.id0Column)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.id field.
	''' </summary>
	Public Function Getid0FieldValue() As Int32
		Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.PersonalId field.
	''' </summary>
	Public Function GetPersonalIdValue() As ColumnValue
		Return Me.GetValue(TableUtils.PersonalIdColumn)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.PersonalId field.
	''' </summary>
	Public Function GetPersonalIdFieldValue() As String
		Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String)
	End Function

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.PersonalId field.
	''' </summary>
	Public Sub SetPersonalIdFieldValue(ByVal val As ColumnValue)
		Me.SetValue(val, TableUtils.PersonalIdColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.PersonalId field.
	''' </summary>
	Public Sub SetPersonalIdFieldValue(ByVal val As String)
		Dim colValue As ColumnValue = New ColumnValue(val)
		Me.SetValue(colValue, TableUtils.PersonalIdColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.StartDate field.
	''' </summary>
	Public Function GetStartDateValue() As ColumnValue
		Return Me.GetValue(TableUtils.StartDateColumn)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.StartDate field.
	''' </summary>
	Public Function GetStartDateFieldValue() As DateTime
		Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime)
	End Function

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.StartDate field.
	''' </summary>
	Public Sub SetStartDateFieldValue(ByVal val As ColumnValue)
		Me.SetValue(val, TableUtils.StartDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.StartDate field.
	''' </summary>
	Public Sub SetStartDateFieldValue(ByVal val As String)
		Me.SetString(val, TableUtils.StartDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.StartDate field.
	''' </summary>
	Public Sub SetStartDateFieldValue(ByVal val As DateTime)
		Dim colValue As ColumnValue = New ColumnValue(val)
		Me.SetValue(colValue, TableUtils.StartDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.EndDate field.
	''' </summary>
	Public Function GetEndDateValue() As ColumnValue
		Return Me.GetValue(TableUtils.EndDateColumn)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.EndDate field.
	''' </summary>
	Public Function GetEndDateFieldValue() As DateTime
		Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime)
	End Function

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.EndDate field.
	''' </summary>
	Public Sub SetEndDateFieldValue(ByVal val As ColumnValue)
		Me.SetValue(val, TableUtils.EndDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.EndDate field.
	''' </summary>
	Public Sub SetEndDateFieldValue(ByVal val As String)
		Me.SetString(val, TableUtils.EndDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.EndDate field.
	''' </summary>
	Public Sub SetEndDateFieldValue(ByVal val As DateTime)
		Dim colValue As ColumnValue = New ColumnValue(val)
		Me.SetValue(colValue, TableUtils.EndDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Mission field.
	''' </summary>
	Public Function GetMissionValue() As ColumnValue
		Return Me.GetValue(TableUtils.MissionColumn)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Mission field.
	''' </summary>
	Public Function GetMissionFieldValue() As String
		Return CType(Me.GetValue(TableUtils.MissionColumn).ToString(), String)
	End Function

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Mission field.
	''' </summary>
	Public Sub SetMissionFieldValue(ByVal val As ColumnValue)
		Me.SetValue(val, TableUtils.MissionColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Mission field.
	''' </summary>
	Public Sub SetMissionFieldValue(ByVal val As String)
		Dim colValue As ColumnValue = New ColumnValue(val)
		Me.SetValue(colValue, TableUtils.MissionColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Ref field.
	''' </summary>
	Public Function GetRef0Value() As ColumnValue
		Return Me.GetValue(TableUtils.Ref0Column)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.Ref field.
	''' </summary>
	Public Function GetRef0FieldValue() As String
		Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String)
	End Function

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Ref field.
	''' </summary>
	Public Sub SetRef0FieldValue(ByVal val As ColumnValue)
		Me.SetValue(val, TableUtils.Ref0Column)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.Ref field.
	''' </summary>
	Public Sub SetRef0FieldValue(ByVal val As String)
		Dim colValue As ColumnValue = New ColumnValue(val)
		Me.SetValue(colValue, TableUtils.Ref0Column)
	End Sub

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.RefDate field.
	''' </summary>
	Public Function GetRefDateValue() As ColumnValue
		Return Me.GetValue(TableUtils.RefDateColumn)
	End Function

	''' <summary>
	''' This is a convenience method that provides direct access to the value of the record's PersonalDD_.RefDate field.
	''' </summary>
	Public Function GetRefDateFieldValue() As DateTime
		Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime)
	End Function

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.RefDate field.
	''' </summary>
	Public Sub SetRefDateFieldValue(ByVal val As ColumnValue)
		Me.SetValue(val, TableUtils.RefDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.RefDate field.
	''' </summary>
	Public Sub SetRefDateFieldValue(ByVal val As String)
		Me.SetString(val, TableUtils.RefDateColumn)
	End Sub

	''' <summary>
	''' This is a convenience method that allows direct modification of the value of the record's PersonalDD_.RefDate field.
	''' </summary>
	Public Sub SetRefDateFieldValue(ByVal val As DateTime)
		Dim colValue As ColumnValue = New ColumnValue(val)
		Me.SetValue(colValue, TableUtils.RefDateColumn)
	End Sub



#End Region

#Region "Convenience methods to get field names"

	''' <summary>
	''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.id field.
	''' </summary>
	Public Property id0() As Int32
		Get 
			Return CType(Me.GetValue(TableUtils.id0Column).ToInt32(), Int32)
		End Get
		Set (ByVal val As Int32) 
			Dim colValue As ColumnValue = New ColumnValue(val)
			Me.SetValue(colValue, TableUtils.id0Column)
		End Set
	End Property


	''' <summary>
	''' This is a convenience method that can be used to determine that the column is set.
	''' </summary>
	Public ReadOnly Property id0Specified() As Boolean
        Get
            Dim val As ColumnValue = Me.GetValue(TableUtils.id0Column)
            If val Is Nothing OrElse val.IsNull Then
                Return False
            End If
            Return True
        End Get
    End Property

	''' <summary>
	''' This is a convenience method that can be used to get the default value of a column.
	''' </summary>
    Public ReadOnly Property id0Default() As String
        Get
            Return TableUtils.id0Column.DefaultValue
        End Get
    End Property

	''' <summary>
	''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.PersonalId field.
	''' </summary>
	Public Property PersonalId() As String
		Get 
			Return CType(Me.GetValue(TableUtils.PersonalIdColumn).ToString(), String)
		End Get
		Set (ByVal Value As String) 
			Me.SetString(value, TableUtils.PersonalIdColumn)
		End Set
	End Property


	''' <summary>
	''' This is a convenience method that can be used to determine that the column is set.
	''' </summary>
	Public ReadOnly Property PersonalIdSpecified() As Boolean
        Get
            Dim val As ColumnValue = Me.GetValue(TableUtils.PersonalIdColumn)
            If val Is Nothing OrElse val.IsNull Then
                Return False
            End If
            Return True
        End Get
    End Property

	''' <summary>
	''' This is a convenience method that can be used to get the default value of a column.
	''' </summary>
    Public ReadOnly Property PersonalIdDefault() As String
        Get
            Return TableUtils.PersonalIdColumn.DefaultValue
        End Get
    End Property

	''' <summary>
	''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.StartDate field.
	''' </summary>
	Public Property StartDate() As DateTime
		Get 
			Return CType(Me.GetValue(TableUtils.StartDateColumn).ToDateTime(), DateTime)
		End Get
		Set (ByVal val As DateTime) 
			Dim colValue As ColumnValue = New ColumnValue(val)
			Me.SetValue(colValue, TableUtils.StartDateColumn)
		End Set
	End Property


	''' <summary>
	''' This is a convenience method that can be used to determine that the column is set.
	''' </summary>
	Public ReadOnly Property StartDateSpecified() As Boolean
        Get
            Dim val As ColumnValue = Me.GetValue(TableUtils.StartDateColumn)
            If val Is Nothing OrElse val.IsNull Then
                Return False
            End If
            Return True
        End Get
    End Property

	''' <summary>
	''' This is a convenience method that can be used to get the default value of a column.
	''' </summary>
    Public ReadOnly Property StartDateDefault() As String
        Get
            Return TableUtils.StartDateColumn.DefaultValue
        End Get
    End Property

	''' <summary>
	''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.EndDate field.
	''' </summary>
	Public Property EndDate() As DateTime
		Get 
			Return CType(Me.GetValue(TableUtils.EndDateColumn).ToDateTime(), DateTime)
		End Get
		Set (ByVal val As DateTime) 
			Dim colValue As ColumnValue = New ColumnValue(val)
			Me.SetValue(colValue, TableUtils.EndDateColumn)
		End Set
	End Property


	''' <summary>
	''' This is a convenience method that can be used to determine that the column is set.
	''' </summary>
	Public ReadOnly Property EndDateSpecified() As Boolean
        Get
            Dim val As ColumnValue = Me.GetValue(TableUtils.EndDateColumn)
            If val Is Nothing OrElse val.IsNull Then
                Return False
            End If
            Return True
        End Get
    End Property

	''' <summary>
	''' This is a convenience method that can be used to get the default value of a column.
	''' </summary>
    Public ReadOnly Property EndDateDefault() As String
        Get
            Return TableUtils.EndDateColumn.DefaultValue
        End Get
    End Property

	''' <summary>
	''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.Mission field.
	''' </summary>
	Public Property Mission() As String
		Get 
			Return CType(Me.GetValue(TableUtils.MissionColumn).ToString(), String)
		End Get
		Set (ByVal Value As String) 
			Me.SetString(value, TableUtils.MissionColumn)
		End Set
	End Property


	''' <summary>
	''' This is a convenience method that can be used to determine that the column is set.
	''' </summary>
	Public ReadOnly Property MissionSpecified() As Boolean
        Get
            Dim val As ColumnValue = Me.GetValue(TableUtils.MissionColumn)
            If val Is Nothing OrElse val.IsNull Then
                Return False
            End If
            Return True
        End Get
    End Property

	''' <summary>
	''' This is a convenience method that can be used to get the default value of a column.
	''' </summary>
    Public ReadOnly Property MissionDefault() As String
        Get
            Return TableUtils.MissionColumn.DefaultValue
        End Get
    End Property

	''' <summary>
	''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.Ref field.
	''' </summary>
	Public Property Ref0() As String
		Get 
			Return CType(Me.GetValue(TableUtils.Ref0Column).ToString(), String)
		End Get
		Set (ByVal Value As String) 
			Me.SetString(value, TableUtils.Ref0Column)
		End Set
	End Property


	''' <summary>
	''' This is a convenience method that can be used to determine that the column is set.
	''' </summary>
	Public ReadOnly Property Ref0Specified() As Boolean
        Get
            Dim val As ColumnValue = Me.GetValue(TableUtils.Ref0Column)
            If val Is Nothing OrElse val.IsNull Then
                Return False
            End If
            Return True
        End Get
    End Property

	''' <summary>
	''' This is a convenience method that can be used to get the default value of a column.
	''' </summary>
    Public ReadOnly Property Ref0Default() As String
        Get
            Return TableUtils.Ref0Column.DefaultValue
        End Get
    End Property

	''' <summary>
	''' This is a convenience property that provides direct access to the value of the record's PersonalDD_.RefDate field.
	''' </summary>
	Public Property RefDate() As DateTime
		Get 
			Return CType(Me.GetValue(TableUtils.RefDateColumn).ToDateTime(), DateTime)
		End Get
		Set (ByVal val As DateTime) 
			Dim colValue As ColumnValue = New ColumnValue(val)
			Me.SetValue(colValue, TableUtils.RefDateColumn)
		End Set
	End Property


	''' <summary>
	''' This is a convenience method that can be used to determine that the column is set.
	''' </summary>
	Public ReadOnly Property RefDateSpecified() As Boolean
        Get
            Dim val As ColumnValue = Me.GetValue(TableUtils.RefDateColumn)
            If val Is Nothing OrElse val.IsNull Then
                Return False
            End If
            Return True
        End Get
    End Property

	''' <summary>
	''' This is a convenience method that can be used to get the default value of a column.
	''' </summary>
    Public ReadOnly Property RefDateDefault() As String
        Get
            Return TableUtils.RefDateColumn.DefaultValue
        End Get
    End Property



#End Region

End Class
End Namespace
