' This class is "generated" and will be overwritten. ' Your customizations should be made in InsigniaRecord.vb Imports System.Data.SqlTypes Imports BaseClasses Imports BaseClasses.Data Imports BaseClasses.Data.SqlProvider Namespace Persons.Business ''' ''' The generated superclass for the class. ''' ''' ''' This class is not intended to be instantiated directly. To obtain an instance of this class, ''' use the methods of the class. ''' ''' ''' Public Class BaseInsigniaRecord Inherits PrimaryKeyRecord Public Shared Shadows ReadOnly TableUtils As InsigniaTable = InsigniaTable.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 InsigniaRecord_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 InsigniaRec As InsigniaRecord = CType(sender,InsigniaRecord) Validate_Inserting() If Not InsigniaRec Is Nothing AndAlso Not InsigniaRec.IsReadOnly Then End If End Sub 'Evaluates Initialize when->Updating record formulas specified at the data access layer Public Overridable Sub InsigniaRecord_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 InsigniaRec As InsigniaRecord = CType(sender,InsigniaRecord) Validate_Updating() If Not InsigniaRec Is Nothing AndAlso Not InsigniaRec.IsReadOnly Then End If End Sub 'Evaluates Initialize when->Reading record formulas specified at the data access layer Public Overridable Sub InsigniaRecord_ReadRecord(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReadRecord 'Apply Initialize->Reading record formula only if validation is successful. Dim InsigniaRec As InsigniaRecord = CType(sender,InsigniaRecord) If Not InsigniaRec Is Nothing AndAlso Not InsigniaRec.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" ''' ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaId field. ''' Public Function GetInsigniaIdValue() As ColumnValue Return Me.GetValue(TableUtils.InsigniaIdColumn) End Function ''' ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaId field. ''' Public Function GetInsigniaIdFieldValue() As Int16 Return CType(Me.GetValue(TableUtils.InsigniaIdColumn).ToInt16(), Int16) End Function ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. ''' Public Sub SetInsigniaIdFieldValue(ByVal val As ColumnValue) Me.SetValue(val, TableUtils.InsigniaIdColumn) End Sub ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. ''' Public Sub SetInsigniaIdFieldValue(ByVal val As String) Me.SetString(val, TableUtils.InsigniaIdColumn) End Sub ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. ''' Public Sub SetInsigniaIdFieldValue(ByVal val As Double) Dim colValue As ColumnValue = New ColumnValue(val) Me.SetValue(colValue, TableUtils.InsigniaIdColumn) End Sub ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. ''' Public Sub SetInsigniaIdFieldValue(ByVal val As Decimal) Dim colValue As ColumnValue = New ColumnValue(val) Me.SetValue(colValue, TableUtils.InsigniaIdColumn) End Sub ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaId field. ''' Public Sub SetInsigniaIdFieldValue(ByVal val As Int64) Dim colValue As ColumnValue = New ColumnValue(val) Me.SetValue(colValue, TableUtils.InsigniaIdColumn) End Sub ''' ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaAbbr field. ''' Public Function GetInsigniaAbbrValue() As ColumnValue Return Me.GetValue(TableUtils.InsigniaAbbrColumn) End Function ''' ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaAbbr field. ''' Public Function GetInsigniaAbbrFieldValue() As String Return CType(Me.GetValue(TableUtils.InsigniaAbbrColumn).ToString(), String) End Function ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaAbbr field. ''' Public Sub SetInsigniaAbbrFieldValue(ByVal val As ColumnValue) Me.SetValue(val, TableUtils.InsigniaAbbrColumn) End Sub ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaAbbr field. ''' Public Sub SetInsigniaAbbrFieldValue(ByVal val As String) Dim colValue As ColumnValue = New ColumnValue(val) Me.SetValue(colValue, TableUtils.InsigniaAbbrColumn) End Sub ''' ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaName field. ''' Public Function GetInsigniaNameValue() As ColumnValue Return Me.GetValue(TableUtils.InsigniaNameColumn) End Function ''' ''' This is a convenience method that provides direct access to the value of the record's Insignia_.InsigniaName field. ''' Public Function GetInsigniaNameFieldValue() As String Return CType(Me.GetValue(TableUtils.InsigniaNameColumn).ToString(), String) End Function ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaName field. ''' Public Sub SetInsigniaNameFieldValue(ByVal val As ColumnValue) Me.SetValue(val, TableUtils.InsigniaNameColumn) End Sub ''' ''' This is a convenience method that allows direct modification of the value of the record's Insignia_.InsigniaName field. ''' Public Sub SetInsigniaNameFieldValue(ByVal val As String) Dim colValue As ColumnValue = New ColumnValue(val) Me.SetValue(colValue, TableUtils.InsigniaNameColumn) End Sub #End Region #Region "Convenience methods to get field names" ''' ''' This is a convenience property that provides direct access to the value of the record's Insignia_.InsigniaId field. ''' Public Property InsigniaId() As Int16 Get Return CType(Me.GetValue(TableUtils.InsigniaIdColumn).ToInt16(), Int16) End Get Set (ByVal val As Int16) Dim colValue As ColumnValue = New ColumnValue(val) Me.SetValue(colValue, TableUtils.InsigniaIdColumn) End Set End Property ''' ''' This is a convenience method that can be used to determine that the column is set. ''' Public ReadOnly Property InsigniaIdSpecified() As Boolean Get Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaIdColumn) If val Is Nothing OrElse val.IsNull Then Return False End If Return True End Get End Property ''' ''' This is a convenience method that can be used to get the default value of a column. ''' Public ReadOnly Property InsigniaIdDefault() As String Get Return TableUtils.InsigniaIdColumn.DefaultValue End Get End Property ''' ''' This is a convenience property that provides direct access to the value of the record's Insignia_.InsigniaAbbr field. ''' Public Property InsigniaAbbr() As String Get Return CType(Me.GetValue(TableUtils.InsigniaAbbrColumn).ToString(), String) End Get Set (ByVal Value As String) Me.SetString(value, TableUtils.InsigniaAbbrColumn) End Set End Property ''' ''' This is a convenience method that can be used to determine that the column is set. ''' Public ReadOnly Property InsigniaAbbrSpecified() As Boolean Get Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaAbbrColumn) If val Is Nothing OrElse val.IsNull Then Return False End If Return True End Get End Property ''' ''' This is a convenience method that can be used to get the default value of a column. ''' Public ReadOnly Property InsigniaAbbrDefault() As String Get Return TableUtils.InsigniaAbbrColumn.DefaultValue End Get End Property ''' ''' This is a convenience property that provides direct access to the value of the record's Insignia_.InsigniaName field. ''' Public Property InsigniaName() As String Get Return CType(Me.GetValue(TableUtils.InsigniaNameColumn).ToString(), String) End Get Set (ByVal Value As String) Me.SetString(value, TableUtils.InsigniaNameColumn) End Set End Property ''' ''' This is a convenience method that can be used to determine that the column is set. ''' Public ReadOnly Property InsigniaNameSpecified() As Boolean Get Dim val As ColumnValue = Me.GetValue(TableUtils.InsigniaNameColumn) If val Is Nothing OrElse val.IsNull Then Return False End If Return True End Get End Property ''' ''' This is a convenience method that can be used to get the default value of a column. ''' Public ReadOnly Property InsigniaNameDefault() As String Get Return TableUtils.InsigniaNameColumn.DefaultValue End Get End Property #End Region End Class End Namespace