cudreg-saml2/App_Code/Business Layer/BasePersonRelativeTable.vb
2025-06-08 16:22:20 +07:00

1282 lines
50 KiB
VB.net

' This class is "generated" and will be overwritten.
' Your customizations should be made in PersonRelativeRecord.vb
Imports System.Data.SqlTypes
Imports System.Data
Imports BaseClasses
Imports BaseClasses.Data
Imports BaseClasses.Data.SqlProvider
Imports Persons.Data
Namespace Persons.Business
''' <summary>
''' The generated superclass for the <see cref="PersonRelativeTable"></see> class.
''' Provides access to the schema information and record data of a database table or view named PersonRelative.
''' </summary>
''' <remarks>
''' The connection details (name, location, etc.) of the database and table (or view) accessed by this class
''' are resolved at runtime based on the connection string in the application's Web.Config file.
''' <para>
''' This class is not intended to be instantiated directly. To obtain an instance of this class, use
''' <see cref="PersonRelativeTable.Instance">PersonRelativeTable.Instance</see>.
''' </para>
''' </remarks>
''' <seealso cref="PersonRelativeTable"></seealso>
<Serializable()> Public Class BasePersonRelativeTable
Inherits PrimaryKeyTable
Private ReadOnly TableDefinitionString As String = PersonRelativeDefinition.GetXMLString()
Protected Sub New()
MyBase.New()
Me.Initialize()
End Sub
Protected Overridable Sub Initialize()
Dim def As New XmlTableDefinition(TableDefinitionString)
Me.TableDefinition = New TableDefinition()
Me.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonRelativeTable")
def.InitializeTableDefinition(Me.TableDefinition)
Me.ConnectionName = def.GetConnectionName()
Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonRelativeRecord")
Me.ApplicationName = "App_Code"
Me.DataAdapter = New PersonRelativeSqlTable()
Directcast(Me.DataAdapter, PersonRelativeSqlTable).ConnectionName = Me.ConnectionName
Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData
RelativeIdColumn.CodeName = "RelativeId"
PersonalIdColumn.CodeName = "PersonalId"
RPreNameColumn.CodeName = "RPreName"
RFirstNameColumn.CodeName = "RFirstName"
RLastNameColumn.CodeName = "RLastName"
ROrLastNameColumn.CodeName = "ROrLastName"
FNameColumn.CodeName = "FName"
FLastNameColumn.CodeName = "FLastName"
MNameColumn.CodeName = "MName"
MLastNameColumn.CodeName = "MLastName"
MOrLastNameColumn.CodeName = "MOrLastName"
ROriginColumn.CodeName = "ROrigin"
RNationalityColumn.CodeName = "RNationality"
RReligionColumn.CodeName = "RReligion"
RAddressColumn.CodeName = "RAddress"
RAmphurColumn.CodeName = "RAmphur"
RProvinceColumn.CodeName = "RProvince"
RBirthDateColumn.CodeName = "RBirthDate"
RelationIdColumn.CodeName = "RelationId"
Ref0Column.CodeName = "Ref0"
RefDateColumn.CodeName = "RefDate"
RStatusColumn.CodeName = "RStatus"
RStatusRefColumn.CodeName = "RStatusRef"
RStatusDateColumn.CodeName = "RStatusDate"
RRemarkColumn.CodeName = "RRemark"
End Sub
#Region "Overriden methods"
#End Region
#Region "Properties for columns"
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RelativeId column object.
''' </summary>
Public ReadOnly Property RelativeIdColumn() As BaseClasses.Data.NumberColumn
Get
Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RelativeId column object.
''' </summary>
Public Shared ReadOnly Property RelativeId() As BaseClasses.Data.NumberColumn
Get
Return PersonRelativeTable.Instance.RelativeIdColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.PersonalId column object.
''' </summary>
Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.PersonalId column object.
''' </summary>
Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.PersonalIdColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RPreName column object.
''' </summary>
Public ReadOnly Property RPreNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RPreName column object.
''' </summary>
Public Shared ReadOnly Property RPreName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RPreNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RFirstName column object.
''' </summary>
Public ReadOnly Property RFirstNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RFirstName column object.
''' </summary>
Public Shared ReadOnly Property RFirstName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RFirstNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RLastName column object.
''' </summary>
Public ReadOnly Property RLastNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RLastName column object.
''' </summary>
Public Shared ReadOnly Property RLastName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RLastNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrLastName column object.
''' </summary>
Public ReadOnly Property ROrLastNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrLastName column object.
''' </summary>
Public Shared ReadOnly Property ROrLastName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.ROrLastNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.FName column object.
''' </summary>
Public ReadOnly Property FNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.FName column object.
''' </summary>
Public Shared ReadOnly Property FName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.FNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.FLastName column object.
''' </summary>
Public ReadOnly Property FLastNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.FLastName column object.
''' </summary>
Public Shared ReadOnly Property FLastName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.FLastNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.MName column object.
''' </summary>
Public ReadOnly Property MNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.MName column object.
''' </summary>
Public Shared ReadOnly Property MName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.MNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.MLastName column object.
''' </summary>
Public ReadOnly Property MLastNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.MLastName column object.
''' </summary>
Public Shared ReadOnly Property MLastName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.MLastNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.MOrLastName column object.
''' </summary>
Public ReadOnly Property MOrLastNameColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.MOrLastName column object.
''' </summary>
Public Shared ReadOnly Property MOrLastName() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.MOrLastNameColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrigin column object.
''' </summary>
Public ReadOnly Property ROriginColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.ROrigin column object.
''' </summary>
Public Shared ReadOnly Property ROrigin() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.ROriginColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RNationality column object.
''' </summary>
Public ReadOnly Property RNationalityColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RNationality column object.
''' </summary>
Public Shared ReadOnly Property RNationality() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RNationalityColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RReligion column object.
''' </summary>
Public ReadOnly Property RReligionColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RReligion column object.
''' </summary>
Public Shared ReadOnly Property RReligion() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RReligionColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RAddress column object.
''' </summary>
Public ReadOnly Property RAddressColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RAddress column object.
''' </summary>
Public Shared ReadOnly Property RAddress() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RAddressColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RAmphur column object.
''' </summary>
Public ReadOnly Property RAmphurColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RAmphur column object.
''' </summary>
Public Shared ReadOnly Property RAmphur() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RAmphurColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RProvince column object.
''' </summary>
Public ReadOnly Property RProvinceColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RProvince column object.
''' </summary>
Public Shared ReadOnly Property RProvince() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RProvinceColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RBirthDate column object.
''' </summary>
Public ReadOnly Property RBirthDateColumn() As BaseClasses.Data.DateColumn
Get
Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.DateColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RBirthDate column object.
''' </summary>
Public Shared ReadOnly Property RBirthDate() As BaseClasses.Data.DateColumn
Get
Return PersonRelativeTable.Instance.RBirthDateColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RelationId column object.
''' </summary>
Public ReadOnly Property RelationIdColumn() As BaseClasses.Data.NumberColumn
Get
Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.NumberColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RelationId column object.
''' </summary>
Public Shared ReadOnly Property RelationId() As BaseClasses.Data.NumberColumn
Get
Return PersonRelativeTable.Instance.RelationIdColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.Ref column object.
''' </summary>
Public ReadOnly Property Ref0Column() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.Ref column object.
''' </summary>
Public Shared ReadOnly Property Ref0() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.Ref0Column
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RefDate column object.
''' </summary>
Public ReadOnly Property RefDateColumn() As BaseClasses.Data.DateColumn
Get
Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.DateColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RefDate column object.
''' </summary>
Public Shared ReadOnly Property RefDate() As BaseClasses.Data.DateColumn
Get
Return PersonRelativeTable.Instance.RefDateColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatus column object.
''' </summary>
Public ReadOnly Property RStatusColumn() As BaseClasses.Data.NumberColumn
Get
Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.NumberColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatus column object.
''' </summary>
Public Shared ReadOnly Property RStatus() As BaseClasses.Data.NumberColumn
Get
Return PersonRelativeTable.Instance.RStatusColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusRef column object.
''' </summary>
Public ReadOnly Property RStatusRefColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusRef column object.
''' </summary>
Public Shared ReadOnly Property RStatusRef() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RStatusRefColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusDate column object.
''' </summary>
Public ReadOnly Property RStatusDateColumn() As BaseClasses.Data.DateColumn
Get
Return CType(Me.TableDefinition.ColumnList(23), BaseClasses.Data.DateColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RStatusDate column object.
''' </summary>
Public Shared ReadOnly Property RStatusDate() As BaseClasses.Data.DateColumn
Get
Return PersonRelativeTable.Instance.RStatusDateColumn
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RRemark column object.
''' </summary>
Public ReadOnly Property RRemarkColumn() As BaseClasses.Data.StringColumn
Get
Return CType(Me.TableDefinition.ColumnList(24), BaseClasses.Data.StringColumn)
End Get
End Property
''' <summary>
''' This is a convenience property that provides direct access to the table's PersonRelative_.RRemark column object.
''' </summary>
Public Shared ReadOnly Property RRemark() As BaseClasses.Data.StringColumn
Get
Return PersonRelativeTable.Instance.RRemarkColumn
End Get
End Property
#End Region
#Region "Shared helper methods"
''' <summary>
''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where clause.
''' </summary>
Public Shared Function GetRecords(ByVal where As String) As PersonRelativeRecord()
Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE)
End Function
''' <summary>
''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where clause.
''' </summary>
Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonRelativeRecord()
Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE)
End Function
''' <summary>
''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause.
''' </summary>
Public Shared Function GetRecords( _
ByVal where As String, _
ByVal orderBy As OrderBy) As PersonRelativeRecord()
Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE)
End Function
''' <summary>
''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause.
''' </summary>
Public Shared Function GetRecords( _
ByVal join As BaseFilter, _
ByVal where As String, _
ByVal orderBy As OrderBy) As PersonRelativeRecord()
Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE)
End Function
''' <summary>
''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause clause with pagination.
''' </summary>
Public Shared Function GetRecords( _
ByVal where As String, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) As PersonRelativeRecord()
Dim whereFilter As SqlFilter = Nothing
If Not where Is Nothing AndAlso where.trim() <> "" Then
whereFilter = New SqlFilter(where)
End If
Dim join As BaseClasses.Data.BaseFilter = Nothing
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize)
Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord())
End Function
''' <summary>
''' This is a shared function that can be used to get an array of PersonRelativeRecord records using a where and order by clause clause with pagination.
''' </summary>
Public Shared Function GetRecords( _
ByVal join As BaseFilter, _
ByVal where As String, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) As PersonRelativeRecord()
Dim whereFilter As SqlFilter = Nothing
If Not where Is Nothing AndAlso where.trim() <> "" Then
whereFilter = New SqlFilter(where)
End If
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize)
Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord())
End Function
Public Shared Function GetRecords( _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) As PersonRelativeRecord()
Dim join As BaseClasses.Data.BaseFilter = Nothing
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize)
Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord())
End Function
Public Shared Function GetRecords( _
ByVal join As BaseFilter, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) As PersonRelativeRecord()
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize)
Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord())
End Function
Public Shared Function GetRecords( _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer, _
ByRef totalRecords As Integer) As PersonRelativeRecord()
Dim join As BaseClasses.Data.BaseFilter = Nothing
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords)
Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord())
End Function
Public Shared Function GetRecords( _
ByVal join As BaseFilter, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer, _
ByRef totalRecords As Integer) As PersonRelativeRecord()
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords)
Return CType(recList.ToArray(GetType(Persons.Business.PersonRelativeRecord)), PersonRelativeRecord())
End Function
''' <summary>
''' This is a shared function that can be used to get total number of records that will be returned using the where clause.
''' </summary>
Public Shared Function GetRecordCount(ByVal where As String) As Integer
Dim whereFilter As SqlFilter = Nothing
If Not where Is Nothing AndAlso where.Trim() <> "" Then
whereFilter = New SqlFilter(where)
End If
Return CInt(PersonRelativeTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing))
End Function
''' <summary>
''' This is a shared function that can be used to get total number of records that will be returned using the where clause.
''' </summary>
Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As String) As Integer
Dim whereFilter As SqlFilter = Nothing
If Not where Is Nothing AndAlso where.Trim() <> "" Then
whereFilter = New SqlFilter(where)
End If
Return CInt(PersonRelativeTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing))
End Function
Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer
Return CInt(PersonRelativeTable.Instance.GetRecordListCount(Nothing, where.GetFilter(), Nothing, Nothing))
End Function
Public Shared Function GetRecordCount(ByVal join As BaseFilter, ByVal where As WhereClause) As Integer
Return CInt(PersonRelativeTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing))
End Function
''' <summary>
''' This is a shared function that can be used to get a PersonRelativeRecord record using a where clause.
''' </summary>
Public Shared Function GetRecord(ByVal where As String) As PersonRelativeRecord
Dim orderBy As OrderBy = Nothing
Return GetRecord(where, orderBy)
End Function
''' <summary>
''' This is a shared function that can be used to get a PersonRelativeRecord record using a where clause.
''' </summary>
Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonRelativeRecord
Dim orderBy As OrderBy = Nothing
Return GetRecord(join, where, orderBy)
End Function
''' <summary>
''' This is a shared function that can be used to get a PersonRelativeRecord record using a where and order by clause.
''' </summary>
Public Shared Function GetRecord( _
ByVal where As String, _
ByVal orderBy As OrderBy) As PersonRelativeRecord
Dim whereFilter As SqlFilter = Nothing
If Not where Is Nothing AndAlso where.Trim() <> "" Then
whereFilter = New SqlFilter(where)
End If
Dim join As BaseClasses.Data.BaseFilter = Nothing
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE)
Dim rec As PersonRelativeRecord = Nothing
If recList.Count > 0 Then
rec = CType(recList(0), PersonRelativeRecord)
End If
Return rec
End Function
''' <summary>
''' This is a shared function that can be used to get a PersonRelativeRecord record using a where and order by clause.
''' </summary>
Public Shared Function GetRecord( _
ByVal join As BaseFilter, _
ByVal where As String, _
ByVal orderBy As OrderBy) As PersonRelativeRecord
Dim whereFilter As SqlFilter = Nothing
If Not where Is Nothing AndAlso where.Trim() <> "" Then
whereFilter = New SqlFilter(where)
End If
Dim recList As ArrayList = PersonRelativeTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE)
Dim rec As PersonRelativeRecord = Nothing
If recList.Count > 0 Then
rec = CType(recList(0), PersonRelativeRecord)
End If
Return rec
End Function
Public Shared Function GetValues( _
ByVal col As BaseColumn, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal maxItems As Integer) As String()
' Create the filter list.
Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True)
retCol.AddColumn(col)
Return PersonRelativeTable.Instance.GetColumnValues(retCol, Nothing, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems)
End Function
Public Shared Function GetValues( _
ByVal col As BaseColumn, _
ByVal join As BaseFilter, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal maxItems As Integer) As String()
' Create the filter list.
Dim retCol As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, True)
retCol.AddColumn(col)
Return PersonRelativeTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems)
End Function
''' <summary>
''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause.
''' </summary>
Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable
Dim recs() As PersonRelativeRecord = GetRecords(where)
Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing)
End Function
''' <summary>
''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause.
''' </summary>
Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable
Dim recs() As PersonRelativeRecord = GetRecords(join, where)
Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing)
End Function
''' <summary>
''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause.
''' </summary>
Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable
Dim recs() As PersonRelativeRecord = GetRecords(where, orderBy)
Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing)
End Function
''' <summary>
''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause.
''' </summary>
Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable
Dim recs() As PersonRelativeRecord = GetRecords(join, where, orderBy)
Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing)
End Function
''' <summary>
''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination.
''' </summary>
Public Shared Function GetDataTable( _
ByVal where As String, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) As System.Data.DataTable
Dim recs() As PersonRelativeRecord = GetRecords(where, orderBy, pageIndex, pageSize)
Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing)
End Function
''' <summary>
''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination.
''' </summary>
Public Shared Function GetDataTable( _
ByVal join As BaseFilter, _
ByVal where As String, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) As System.Data.DataTable
Dim recs() As PersonRelativeRecord = GetRecords(join, where, orderBy, pageIndex, pageSize)
Return PersonRelativeTable.Instance.CreateDataTable(recs, Nothing)
End Function
''' <summary>
''' This is a shared function that can be used to delete records using a where clause.
''' </summary>
Public Shared Sub DeleteRecords(ByVal where As String)
If where = Nothing OrElse where.Trim() = "" Then
Return
End If
Dim whereFilter As SqlFilter = New SqlFilter(where)
PersonRelativeTable.Instance.DeleteRecordList(whereFilter)
End Sub
''' <summary>
''' This is a shared function that can be used to export records using a where clause.
''' </summary>
Public Shared Function Export(ByVal where As String) As String
Dim whereFilter As SqlFilter = Nothing
If Not where Is Nothing AndAlso where.Trim() <> "" Then
whereFilter = New SqlFilter(where)
End If
Return PersonRelativeTable.Instance.ExportRecordData(whereFilter)
End Function
Public Shared Function Export(ByVal where As WhereClause) As String
Dim whereFilter As BaseFilter = Nothing
If Not where Is Nothing Then
whereFilter = where.GetFilter()
End If
Return PersonRelativeTable.Instance.ExportRecordData(whereFilter)
End Function
Public Shared Function GetSum( _
ByVal col As BaseColumn, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) _
As String
Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False)
colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum)
Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize)
End Function
Public Shared Function GetSum( _
ByVal col As BaseColumn, _
ByVal join As BaseFilter, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) _
As String
Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False)
colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum)
Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize)
End Function
Public Shared Function GetCount( _
ByVal col As BaseColumn, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) _
As String
Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False)
colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count)
Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, Nothing, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize)
End Function
Public Shared Function GetCount( _
ByVal col As BaseColumn, _
ByVal join As BaseFilter, _
ByVal where As WhereClause, _
ByVal orderBy As OrderBy, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer) _
As String
Dim colSel As SqlBuilderColumnSelection = New SqlBuilderColumnSelection(False, False)
colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count)
Return PersonRelativeTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize)
End Function
''' <summary>
''' This method returns the columns in the table.
''' </summary>
Public Shared Function GetColumns() As BaseColumn()
Return PersonRelativeTable.Instance.TableDefinition.Columns
End Function
''' <summary>
''' This method returns the columnlist in the table.
''' </summary>
Public Shared Function GetColumnList() As ColumnList
Return PersonRelativeTable.Instance.TableDefinition.ColumnList
End Function
''' <summary>
''' This method creates a new record and returns it to be edited.
''' </summary>
Public Shared Function CreateNewRecord() As IRecord
Return PersonRelativeTable.Instance.CreateRecord()
End Function
''' <summary>
''' This method creates a new record and returns it to be edited.
''' </summary>
''' <param name="tempId">ID of the new record.</param>
Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord
Return PersonRelativeTable.Instance.CreateRecord(tempId)
End Function
''' <summary>
''' This method checks if column is editable.
''' </summary>
''' <param name="columnName">Name of the column to check.</param>
Public Shared Function isReadOnlyColumn(ByVal columnName As String) As Boolean
Dim column As BaseColumn = GetColumn(columnName)
If (Not IsNothing(column)) Then
Return column.IsValuesReadOnly
Else
Return True
End If
End Function
''' <summary>
''' This method gets the specified column.
''' </summary>
''' <param name="uniqueColumnName">Unique name of the column to fetch.</param>
Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn
Dim column As BaseColumn = PersonRelativeTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName)
Return column
End Function
' Convenience method for getting a record using a string-based record identifier
Public Shared Function GetRecord(ByVal id As String, ByVal bMutable As Boolean) As PersonRelativeRecord
Return CType(PersonRelativeTable.Instance.GetRecordData(id, bMutable), PersonRelativeRecord)
End Function
' Convenience method for getting a record using a KeyValue record identifier
Public Shared Function GetRecord(ByVal id As KeyValue, ByVal bMutable As Boolean) As PersonRelativeRecord
Return CType(PersonRelativeTable.Instance.GetRecordData(id, bMutable), PersonRelativeRecord)
End Function
' Convenience method for creating a record
Public Overloads Function NewRecord( _
ByVal PersonalIdValue As String, _
ByVal RPreNameValue As String, _
ByVal RFirstNameValue As String, _
ByVal RLastNameValue As String, _
ByVal ROrLastNameValue As String, _
ByVal FNameValue As String, _
ByVal FLastNameValue As String, _
ByVal MNameValue As String, _
ByVal MLastNameValue As String, _
ByVal MOrLastNameValue As String, _
ByVal ROriginValue As String, _
ByVal RNationalityValue As String, _
ByVal RReligionValue As String, _
ByVal RAddressValue As String, _
ByVal RAmphurValue As String, _
ByVal RProvinceValue As String, _
ByVal RBirthDateValue As String, _
ByVal RelationIdValue As String, _
ByVal Ref0Value As String, _
ByVal RefDateValue As String, _
ByVal RStatusValue As String, _
ByVal RStatusRefValue As String, _
ByVal RStatusDateValue As String, _
ByVal RRemarkValue As String _
) As KeyValue
Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord)
rec.SetString(PersonalIdValue, PersonalIdColumn)
rec.SetString(RPreNameValue, RPreNameColumn)
rec.SetString(RFirstNameValue, RFirstNameColumn)
rec.SetString(RLastNameValue, RLastNameColumn)
rec.SetString(ROrLastNameValue, ROrLastNameColumn)
rec.SetString(FNameValue, FNameColumn)
rec.SetString(FLastNameValue, FLastNameColumn)
rec.SetString(MNameValue, MNameColumn)
rec.SetString(MLastNameValue, MLastNameColumn)
rec.SetString(MOrLastNameValue, MOrLastNameColumn)
rec.SetString(ROriginValue, ROriginColumn)
rec.SetString(RNationalityValue, RNationalityColumn)
rec.SetString(RReligionValue, RReligionColumn)
rec.SetString(RAddressValue, RAddressColumn)
rec.SetString(RAmphurValue, RAmphurColumn)
rec.SetString(RProvinceValue, RProvinceColumn)
rec.SetString(RBirthDateValue, RBirthDateColumn)
rec.SetString(RelationIdValue, RelationIdColumn)
rec.SetString(Ref0Value, Ref0Column)
rec.SetString(RefDateValue, RefDateColumn)
rec.SetString(RStatusValue, RStatusColumn)
rec.SetString(RStatusRefValue, RStatusRefColumn)
rec.SetString(RStatusDateValue, RStatusDateColumn)
rec.SetString(RRemarkValue, RRemarkColumn)
rec.Create() 'update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized
Dim key As KeyValue = rec.GetID()
Return key
End Function
''' <summary>
''' This method deletes a specified record
''' </summary>
''' <param name="kv">Keyvalue of the record to be deleted.</param>
Public Shared Sub DeleteRecord(ByVal kv As KeyValue)
PersonRelativeTable.Instance.DeleteOneRecord(kv)
End Sub
''' <summary>
''' This method checks if record exist in the database using the keyvalue provided.
''' </summary>
''' <param name="kv">Key value of the record.</param>
Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean
Dim recordExist As Boolean = True
Try
PersonRelativeTable.GetRecord(kv, False)
Catch ex As Exception
recordExist = False
End Try
Return recordExist
End Function
''' <summary>
''' This method returns all the primary columns in the table.
''' </summary>
Public Shared Function GetPrimaryKeyColumns() As ColumnList
If (Not IsNothing(PersonRelativeTable.Instance.TableDefinition.PrimaryKey)) Then
Return PersonRelativeTable.Instance.TableDefinition.PrimaryKey.Columns
Else
Return Nothing
End If
End Function
''' <summary>
''' This method takes a key and returns a keyvalue.
''' </summary>
''' <param name="key">key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key.</param>
Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue
Dim kv As KeyValue = Nothing
If (Not (IsNothing(PersonRelativeTable.Instance.TableDefinition.PrimaryKey))) Then
Dim isCompositePrimaryKey As Boolean = False
isCompositePrimaryKey = PersonRelativeTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey
If ((isCompositePrimaryKey) AndAlso (key.GetType.IsArray())) Then
' If the key is composite, then construct a key value.
kv = New KeyValue
Dim fullKeyString As String = ""
Dim keyArray As Array = CType(key, Array)
If (Not IsNothing(keyArray)) Then
Dim length As Integer = keyArray.Length
Dim pkColumns As ColumnList = PersonRelativeTable.Instance.TableDefinition.PrimaryKey.Columns
Dim pkColumn As BaseColumn
Dim index As Integer = 0
For Each pkColumn In pkColumns
Dim keyString As String = CType(keyArray.GetValue(index), String)
If (PersonRelativeTable.Instance.TableDefinition.TableType = BaseClasses.Data.TableDefinition.TableTypes.Virtual) Then
kv.AddElement(pkColumn.UniqueName, keyString)
Else
kv.AddElement(pkColumn.InternalName, keyString)
End If
index = index + 1
Next pkColumn
End If
Else
' If the key is not composite, then get the key value.
kv = PersonRelativeTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String))
End If
End If
Return kv
End Function
''' <summary>
''' This method takes a record and a Column and returns an evaluated value of DFKA formula.
''' </summary>
Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String
Dim fkColumn As ForeignKey = PersonRelativeTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col)
If fkColumn Is Nothing Then
Return Nothing
End If
Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns
If (_DFKA.Trim().StartsWith("=")) Then
' if the formula is in the format of "= <Primary table>.<Field name>, then pull out the data from the rec object instead of doing formula evaluation
Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName
Dim column As String = _DFKA.Trim("="c).Trim()
If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then
column = column.Substring(tableCodeName.Length + 1)
End If
For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns
If column = c.CodeName Then
Return rec.Format(c)
End If
Next
Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName
Return EvaluateFormula(_DFKA, rec, Nothing, tableName)
Else
Return Nothing
End If
End Function
''' <summary>
''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula.
''' </summary>
Public Shared Function GetDFKA(ByVal keyValue As String, ByVal col As BaseColumn, ByVal formatPattern as String) As String
If keyValue Is Nothing Then
Return Nothing
End If
Dim fkColumn As ForeignKey = PersonRelativeTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col)
If fkColumn Is Nothing Then
Return Nothing
End If
Dim _DFKA As String = fkColumn.PrimaryKeyDisplayColumns
If (_DFKA.Trim().StartsWith("=")) Then
Dim tableName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName
Dim t As PrimaryKeyTable = CType(DatabaseObjects.GetTableObject(tableName), PrimaryKeyTable)
Dim rec As BaseRecord = Nothing
If Not t Is Nothing Then
Try
rec = CType(t.GetRecordData(keyValue, False), BaseRecord)
Catch
rec = Nothing
End Try
End If
If rec Is Nothing Then
Return ""
End If
' if the formula is in the format of "= <Primary table>.<Field name>, then pull out the data from the rec object instead of doing formula evaluation
Dim tableCodeName As String = fkColumn.PrimaryKeyTableDefinition.TableCodeName
Dim column As String = _DFKA.Trim("="c).Trim()
If column.StartsWith(tableCodeName & ".", StringComparison.InvariantCultureIgnoreCase) Then
column = column.Substring(tableCodeName.Length + 1)
End If
For Each c As BaseColumn In fkColumn.PrimaryKeyTableDefinition.Columns
If column = c.CodeName Then
Return rec.Format(c)
End If
Next
Return EvaluateFormula(_DFKA, rec, Nothing, tableName)
Else
Return Nothing
End If
End Function
''' <summary>
''' Evaluates the formula
''' </summary>
Public Shared Function EvaluateFormula(ByVal formula As String, Optional ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord = Nothing, Optional ByVal format As String = Nothing, Optional ByVal name As String = "") As String
Dim e As BaseFormulaEvaluator = New BaseFormulaEvaluator()
If Not dataSourceForEvaluate Is Nothing Then
e.Evaluator.Variables.Add(name, dataSourceForEvaluate)
end if
e.DataSource = dataSourceForEvaluate
Dim resultObj As Object = e.Evaluate(formula)
If resultObj Is Nothing Then
Return ""
End If
If Not String.IsNullOrEmpty(format) Then
Return BaseFormulaUtils.Format(resultObj, format)
Else
Return resultObj.ToString()
End If
End Function
#End Region
End Class
End Namespace