' This class is "generated" and will be overwritten. ' Your customizations should be made in PersonalIdRecord.vb Imports System.Data.SqlTypes Imports System.Data Imports BaseClasses Imports BaseClasses.Data Imports BaseClasses.Data.SqlProvider Imports Persons.Data Namespace Persons.Business ''' ''' The generated superclass for the class. ''' Provides access to the schema information and record data of a database table or view named PersonalId. ''' ''' ''' 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. ''' ''' This class is not intended to be instantiated directly. To obtain an instance of this class, use ''' PersonalIdTable.Instance. ''' ''' ''' Public Class BasePersonalIdTable Inherits PrimaryKeyTable Implements IUserIdentityTable Private ReadOnly TableDefinitionString As String = PersonalIdDefinition.GetXMLString() #Region "IUserTable Members" ' Get the column that specifies the user's unique identifier Public ReadOnly Property UserId() As BaseColumn Implements IUserTable.UserIdColumn Get Return Me.TableDefinition.ColumnList.GetByNumber(0) End Get End Property ' Get a list of records that match the criteria specified in a filter Public Overloads Function GetRecordList( _ ByVal userId As String, _ ByVal filter As BaseFilter, _ ByVal orderBy As OrderBy, _ ByVal pageNumber As Integer, _ ByVal batchSize As Integer, _ Optional ByRef totalRows As Integer = Nothing _ ) As ArrayList If (Not IsNothing(userId)) Then filter = BaseFilter.CombineFilters( _ CompoundFilter.CompoundingOperators.And_Operator, _ filter, _ BaseFilter.CreateUserIdFilter(CType(Me, IUserTable), userId)) End If Dim join As BaseClasses.Data.BaseFilter = Nothing Return CType(Me, ITable).GetRecordList(join, filter, Nothing, orderBy, pageNumber, batchSize, totalRows) End Function #End Region #Region "IUserIdentityTable Members" ' Get the column that specifies the user's name Public ReadOnly Property UserName() As BaseColumn Implements IUserIdentityTable.UserNameColumn Get Return Me.TableDefinition.ColumnList.GetByNumber(0) End Get End Property ' Get the column that specifies the user's password Public ReadOnly Property UserPassword() As BaseColumn Implements IUserIdentityTable.UserPasswordColumn Get Return Me.TableDefinition.ColumnList.GetByNumber(9) End Get End Property ' Get the column that specifies the user's email address Public ReadOnly Property UserEmail() As BaseColumn Implements IUserIdentityTable.UserEmailColumn Get Return Nothing End Get End Property ' Get a role table object Public Function GetUserRoleTable() As IUserRoleTable Implements IUserIdentityTable.GetUserRoleTable Return TblUserRoleTable.Instance End Function ' Get a list of records that match the user's name/password Public Overloads Function GetRecordList( _ ByVal userName As String, _ ByVal userPassword As String, _ ByVal filter As BaseFilter, _ ByVal orderBy As OrderBy, _ ByVal pageNumber As Integer, _ ByVal batchSize As Integer, _ Optional ByRef totalRows As Integer = Nothing _ ) As ArrayList ' Set up a name/password filter If (Not (IsNothing(userName) AndAlso IsNothing(userPassword))) Then filter = BaseFilter.CombineFilters( _ CompoundFilter.CompoundingOperators.And_Operator, _ filter, _ BaseFilter.CreateUserAuthenticationFilter(CType(Me, IUserIdentityTable), userName, userPassword)) End If Dim join As BaseClasses.Data.BaseFilter = Nothing Return CType(Me, ITable).GetRecordList(join, filter, Nothing, orderBy, pageNumber, batchSize, totalRows) End Function #End Region 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.PersonalIdTable") def.InitializeTableDefinition(Me.TableDefinition) Me.ConnectionName = def.GetConnectionName() Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalIdRecord") Me.ApplicationName = "App_Code" Me.DataAdapter = New PersonalIdSqlTable() Directcast(Me.DataAdapter, PersonalIdSqlTable).ConnectionName = Me.ConnectionName Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData PersonalIdColumn.CodeName = "PersonalId" SectionIdColumn.CodeName = "SectionId" MIdColumn.CodeName = "MId" TIdColumn.CodeName = "TId" ArmyIdColumn.CodeName = "ArmyId" RankIdColumn.CodeName = "RankId" PersonalNameColumn.CodeName = "PersonalName" PersonalLastNameColumn.CodeName = "PersonalLastName" SexColumn.CodeName = "Sex" BirthDateColumn.CodeName = "BirthDate" PlaceOfBirthColumn.CodeName = "PlaceOfBirth" BAmphurColumn.CodeName = "BAmphur" BProvinceColumn.CodeName = "BProvince" BloodIdColumn.CodeName = "BloodId" OriginColumn.CodeName = "Origin" NationalityColumn.CodeName = "Nationality" ReligionColumn.CodeName = "Religion" ArmIdColumn.CodeName = "ArmId" RegDateColumn.CodeName = "RegDate" RegNo1Column.CodeName = "RegNo1" RegNo2Column.CodeName = "RegNo2" OfficerDateColumn.CodeName = "OfficerDate" BornColumn.CodeName = "Born" CremateMemIdColumn.CodeName = "CremateMemId" ArmyWelfareMemIdColumn.CodeName = "ArmyWelfareMemId" StatusIdColumn.CodeName = "StatusId" CommissionColumn.CodeName = "Commission" DeptIdColumn.CodeName = "DeptId" AddrColumn.CodeName = "Addr" AmphurColumn.CodeName = "Amphur" ProvinceColumn.CodeName = "Province" PostCodeColumn.CodeName = "PostCode" PhoneColumn.CodeName = "Phone" PhoneExtColumn.CodeName = "PhoneExt" MobilePhoneColumn.CodeName = "MobilePhone" pictureColumn.CodeName = "picture" PictureNameColumn.CodeName = "PictureName" DateRankColumn.CodeName = "DateRank" DatePrevRankColumn.CodeName = "DatePrevRank" End Sub #Region "Overriden methods" #End Region #Region "Properties for columns" ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalId column object. ''' Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalId column object. ''' Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PersonalIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.SectionId column object. ''' Public ReadOnly Property SectionIdColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.SectionId column object. ''' Public Shared ReadOnly Property SectionId() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.SectionIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.MId column object. ''' Public ReadOnly Property MIdColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.MId column object. ''' Public Shared ReadOnly Property MId() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.MIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.TId column object. ''' Public ReadOnly Property TIdColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(3), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.TId column object. ''' Public Shared ReadOnly Property TId() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.TIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyId column object. ''' Public ReadOnly Property ArmyIdColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(4), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyId column object. ''' Public Shared ReadOnly Property ArmyId() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.ArmyIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RankId column object. ''' Public ReadOnly Property RankIdColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RankId column object. ''' Public Shared ReadOnly Property RankId() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.RankIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalName column object. ''' Public ReadOnly Property PersonalNameColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalName column object. ''' Public Shared ReadOnly Property PersonalName() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PersonalNameColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalLastName column object. ''' Public ReadOnly Property PersonalLastNameColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PersonalLastName column object. ''' Public Shared ReadOnly Property PersonalLastName() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PersonalLastNameColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Sex column object. ''' Public ReadOnly Property SexColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Sex column object. ''' Public Shared ReadOnly Property Sex() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.SexColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BirthDate column object. ''' Public ReadOnly Property BirthDateColumn() As BaseClasses.Data.DateColumn Get Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.DateColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BirthDate column object. ''' Public Shared ReadOnly Property BirthDate() As BaseClasses.Data.DateColumn Get Return PersonalIdTable.Instance.BirthDateColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PlaceOfBirth column object. ''' Public ReadOnly Property PlaceOfBirthColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PlaceOfBirth column object. ''' Public Shared ReadOnly Property PlaceOfBirth() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PlaceOfBirthColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BAmphur column object. ''' Public ReadOnly Property BAmphurColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(11), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BAmphur column object. ''' Public Shared ReadOnly Property BAmphur() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.BAmphurColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BProvince column object. ''' Public ReadOnly Property BProvinceColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BProvince column object. ''' Public Shared ReadOnly Property BProvince() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.BProvinceColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BloodId column object. ''' Public ReadOnly Property BloodIdColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(13), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.BloodId column object. ''' Public Shared ReadOnly Property BloodId() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.BloodIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Origin column object. ''' Public ReadOnly Property OriginColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(14), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Origin column object. ''' Public Shared ReadOnly Property Origin() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.OriginColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Nationality column object. ''' Public ReadOnly Property NationalityColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(15), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Nationality column object. ''' Public Shared ReadOnly Property Nationality() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.NationalityColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Religion column object. ''' Public ReadOnly Property ReligionColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(16), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Religion column object. ''' Public Shared ReadOnly Property Religion() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.ReligionColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmId column object. ''' Public ReadOnly Property ArmIdColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(17), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmId column object. ''' Public Shared ReadOnly Property ArmId() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.ArmIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RegDate column object. ''' Public ReadOnly Property RegDateColumn() As BaseClasses.Data.DateColumn Get Return CType(Me.TableDefinition.ColumnList(18), BaseClasses.Data.DateColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RegDate column object. ''' Public Shared ReadOnly Property RegDate() As BaseClasses.Data.DateColumn Get Return PersonalIdTable.Instance.RegDateColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo1 column object. ''' Public ReadOnly Property RegNo1Column() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(19), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo1 column object. ''' Public Shared ReadOnly Property RegNo1() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.RegNo1Column End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo2 column object. ''' Public ReadOnly Property RegNo2Column() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(20), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.RegNo2 column object. ''' Public Shared ReadOnly Property RegNo2() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.RegNo2Column End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.OfficerDate column object. ''' Public ReadOnly Property OfficerDateColumn() As BaseClasses.Data.DateColumn Get Return CType(Me.TableDefinition.ColumnList(21), BaseClasses.Data.DateColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.OfficerDate column object. ''' Public Shared ReadOnly Property OfficerDate() As BaseClasses.Data.DateColumn Get Return PersonalIdTable.Instance.OfficerDateColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Born column object. ''' Public ReadOnly Property BornColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(22), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Born column object. ''' Public Shared ReadOnly Property Born() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.BornColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.CremateMemId column object. ''' Public ReadOnly Property CremateMemIdColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(23), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.CremateMemId column object. ''' Public Shared ReadOnly Property CremateMemId() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.CremateMemIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyWelfareMemId column object. ''' Public ReadOnly Property ArmyWelfareMemIdColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(24), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.ArmyWelfareMemId column object. ''' Public Shared ReadOnly Property ArmyWelfareMemId() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.ArmyWelfareMemIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.StatusId column object. ''' Public ReadOnly Property StatusIdColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(25), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.StatusId column object. ''' Public Shared ReadOnly Property StatusId() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.StatusIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Commission column object. ''' Public ReadOnly Property CommissionColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(26), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Commission column object. ''' Public Shared ReadOnly Property Commission() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.CommissionColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.DeptId column object. ''' Public ReadOnly Property DeptIdColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(27), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.DeptId column object. ''' Public Shared ReadOnly Property DeptId() As BaseClasses.Data.NumberColumn Get Return PersonalIdTable.Instance.DeptIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Addr column object. ''' Public ReadOnly Property AddrColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(28), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Addr column object. ''' Public Shared ReadOnly Property Addr() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.AddrColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Amphur column object. ''' Public ReadOnly Property AmphurColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(29), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Amphur column object. ''' Public Shared ReadOnly Property Amphur() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.AmphurColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Province column object. ''' Public ReadOnly Property ProvinceColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(30), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Province column object. ''' Public Shared ReadOnly Property Province() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.ProvinceColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PostCode column object. ''' Public ReadOnly Property PostCodeColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(31), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PostCode column object. ''' Public Shared ReadOnly Property PostCode() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PostCodeColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Phone column object. ''' Public ReadOnly Property PhoneColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(32), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.Phone column object. ''' Public Shared ReadOnly Property Phone() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PhoneColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PhoneExt column object. ''' Public ReadOnly Property PhoneExtColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(33), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PhoneExt column object. ''' Public Shared ReadOnly Property PhoneExt() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PhoneExtColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.MobilePhone column object. ''' Public ReadOnly Property MobilePhoneColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(34), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.MobilePhone column object. ''' Public Shared ReadOnly Property MobilePhone() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.MobilePhoneColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.picture column object. ''' Public ReadOnly Property pictureColumn() As BaseClasses.Data.ImageColumn Get Return CType(Me.TableDefinition.ColumnList(35), BaseClasses.Data.ImageColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.picture column object. ''' Public Shared ReadOnly Property picture() As BaseClasses.Data.ImageColumn Get Return PersonalIdTable.Instance.pictureColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PictureName column object. ''' Public ReadOnly Property PictureNameColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(36), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.PictureName column object. ''' Public Shared ReadOnly Property PictureName() As BaseClasses.Data.StringColumn Get Return PersonalIdTable.Instance.PictureNameColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.DateRank column object. ''' Public ReadOnly Property DateRankColumn() As BaseClasses.Data.DateColumn Get Return CType(Me.TableDefinition.ColumnList(37), BaseClasses.Data.DateColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.DateRank column object. ''' Public Shared ReadOnly Property DateRank() As BaseClasses.Data.DateColumn Get Return PersonalIdTable.Instance.DateRankColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.DatePrevRank column object. ''' Public ReadOnly Property DatePrevRankColumn() As BaseClasses.Data.DateColumn Get Return CType(Me.TableDefinition.ColumnList(38), BaseClasses.Data.DateColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalId_.DatePrevRank column object. ''' Public Shared ReadOnly Property DatePrevRank() As BaseClasses.Data.DateColumn Get Return PersonalIdTable.Instance.DatePrevRankColumn End Get End Property #End Region #Region "Shared helper methods" ''' ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where clause. ''' Public Shared Function GetRecords(ByVal where As String) As PersonalIdRecord() Return GetRecords(where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) End Function ''' ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where clause. ''' Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalIdRecord() Return GetRecords(join, where, Nothing, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) End Function ''' ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause. ''' Public Shared Function GetRecords( _ ByVal where As String, _ ByVal orderBy As OrderBy) As PersonalIdRecord() Return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) End Function ''' ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause. ''' Public Shared Function GetRecords( _ ByVal join As BaseFilter, _ ByVal where As String, _ ByVal orderBy As OrderBy) As PersonalIdRecord() Return GetRecords(join, where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE) End Function ''' ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause clause with pagination. ''' Public Shared Function GetRecords( _ ByVal where As String, _ ByVal orderBy As OrderBy, _ ByVal pageIndex As Integer, _ ByVal pageSize As Integer) As PersonalIdRecord() 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 = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) End Function ''' ''' This is a shared function that can be used to get an array of PersonalIdRecord records using a where and order by clause clause with pagination. ''' 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 PersonalIdRecord() Dim whereFilter As SqlFilter = Nothing If Not where Is Nothing AndAlso where.trim() <> "" Then whereFilter = New SqlFilter(where) End If Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) End Function Public Shared Function GetRecords( _ ByVal where As WhereClause, _ ByVal orderBy As OrderBy, _ ByVal pageIndex As Integer, _ ByVal pageSize As Integer) As PersonalIdRecord() Dim join As BaseClasses.Data.BaseFilter = Nothing Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) 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 PersonalIdRecord() Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) 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 PersonalIdRecord() Dim join As BaseClasses.Data.BaseFilter = Nothing Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) 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 PersonalIdRecord() Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) Return CType(recList.ToArray(GetType(Persons.Business.PersonalIdRecord)), PersonalIdRecord()) End Function ''' ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. ''' 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(PersonalIdTable.Instance.GetRecordListCount(Nothing, whereFilter, Nothing, Nothing)) End Function ''' ''' This is a shared function that can be used to get total number of records that will be returned using the where clause. ''' 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(PersonalIdTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) End Function Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer Return CInt(PersonalIdTable.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(PersonalIdTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) End Function ''' ''' This is a shared function that can be used to get a PersonalIdRecord record using a where clause. ''' Public Shared Function GetRecord(ByVal where As String) As PersonalIdRecord Dim orderBy As OrderBy = Nothing Return GetRecord(where, orderBy) End Function ''' ''' This is a shared function that can be used to get a PersonalIdRecord record using a where clause. ''' Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalIdRecord Dim orderBy As OrderBy = Nothing Return GetRecord(join, where, orderBy) End Function ''' ''' This is a shared function that can be used to get a PersonalIdRecord record using a where and order by clause. ''' Public Shared Function GetRecord( _ ByVal where As String, _ ByVal orderBy As OrderBy) As PersonalIdRecord 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 = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) Dim rec As PersonalIdRecord = Nothing If recList.Count > 0 Then rec = CType(recList(0), PersonalIdRecord) End If Return rec End Function ''' ''' This is a shared function that can be used to get a PersonalIdRecord record using a where and order by clause. ''' Public Shared Function GetRecord( _ ByVal join As BaseFilter, _ ByVal where As String, _ ByVal orderBy As OrderBy) As PersonalIdRecord Dim whereFilter As SqlFilter = Nothing If Not where Is Nothing AndAlso where.Trim() <> "" Then whereFilter = New SqlFilter(where) End If Dim recList As ArrayList = PersonalIdTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) Dim rec As PersonalIdRecord = Nothing If recList.Count > 0 Then rec = CType(recList(0), PersonalIdRecord) 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 PersonalIdTable.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 PersonalIdTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems) End Function ''' ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. ''' Public Shared Function GetDataTable(ByVal where As String) As System.Data.DataTable Dim recs() As PersonalIdRecord = GetRecords(where) Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) End Function ''' ''' This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause. ''' Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String) As System.Data.DataTable Dim recs() As PersonalIdRecord = GetRecords(join, where) Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) End Function ''' ''' 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. ''' Public Shared Function GetDataTable(ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable Dim recs() As PersonalIdRecord = GetRecords(where, orderBy) Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) End Function ''' ''' 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. ''' Public Shared Function GetDataTable(ByVal join As BaseFilter, ByVal where As String, ByVal orderBy As OrderBy) As System.Data.DataTable Dim recs() As PersonalIdRecord = GetRecords(join, where, orderBy) Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) End Function ''' ''' 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. ''' 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 PersonalIdRecord = GetRecords(where, orderBy, pageIndex, pageSize) Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) End Function ''' ''' 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. ''' 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 PersonalIdRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) Return PersonalIdTable.Instance.CreateDataTable(recs, Nothing) End Function ''' ''' This is a shared function that can be used to delete records using a where clause. ''' 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) PersonalIdTable.Instance.DeleteRecordList(whereFilter) End Sub ''' ''' This is a shared function that can be used to export records using a where clause. ''' 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 PersonalIdTable.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 PersonalIdTable.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 PersonalIdTable.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 PersonalIdTable.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 PersonalIdTable.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 PersonalIdTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) End Function ''' ''' This method returns the columns in the table. ''' Public Shared Function GetColumns() As BaseColumn() Return PersonalIdTable.Instance.TableDefinition.Columns End Function ''' ''' This method returns the columnlist in the table. ''' Public Shared Function GetColumnList() As ColumnList Return PersonalIdTable.Instance.TableDefinition.ColumnList End Function ''' ''' This method creates a new record and returns it to be edited. ''' Public Shared Function CreateNewRecord() As IRecord Return PersonalIdTable.Instance.CreateRecord() End Function ''' ''' This method creates a new record and returns it to be edited. ''' ''' ID of the new record. Public Shared Function CreateNewRecord(ByVal tempId As String) As IRecord Return PersonalIdTable.Instance.CreateRecord(tempId) End Function ''' ''' This method checks if column is editable. ''' ''' Name of the column to check. 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 ''' ''' This method gets the specified column. ''' ''' Unique name of the column to fetch. Public Shared Function GetColumn(ByVal uniqueColumnName As String) As BaseColumn Dim column As BaseColumn = PersonalIdTable.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 PersonalIdRecord Return CType(PersonalIdTable.Instance.GetRecordData(id, bMutable), PersonalIdRecord) 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 PersonalIdRecord Return CType(PersonalIdTable.Instance.GetRecordData(id, bMutable), PersonalIdRecord) End Function ' Convenience method for creating a record Public Overloads Function NewRecord( _ ByVal PersonalIdValue As String, _ ByVal SectionIdValue As String, _ ByVal MIdValue As String, _ ByVal TIdValue As String, _ ByVal ArmyIdValue As String, _ ByVal RankIdValue As String, _ ByVal PersonalNameValue As String, _ ByVal PersonalLastNameValue As String, _ ByVal SexValue As String, _ ByVal BirthDateValue As String, _ ByVal PlaceOfBirthValue As String, _ ByVal BAmphurValue As String, _ ByVal BProvinceValue As String, _ ByVal BloodIdValue As String, _ ByVal OriginValue As String, _ ByVal NationalityValue As String, _ ByVal ReligionValue As String, _ ByVal ArmIdValue As String, _ ByVal RegDateValue As String, _ ByVal RegNo1Value As String, _ ByVal RegNo2Value As String, _ ByVal OfficerDateValue As String, _ ByVal BornValue As String, _ ByVal CremateMemIdValue As String, _ ByVal ArmyWelfareMemIdValue As String, _ ByVal StatusIdValue As String, _ ByVal CommissionValue As String, _ ByVal DeptIdValue As String, _ ByVal AddrValue As String, _ ByVal AmphurValue As String, _ ByVal ProvinceValue As String, _ ByVal PostCodeValue As String, _ ByVal PhoneValue As String, _ ByVal PhoneExtValue As String, _ ByVal MobilePhoneValue As String, _ ByVal pictureValue As String, _ ByVal PictureNameValue As String, _ ByVal DateRankValue As String, _ ByVal DatePrevRankValue As String _ ) As KeyValue Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) rec.SetString(PersonalIdValue, PersonalIdColumn) rec.SetString(SectionIdValue, SectionIdColumn) rec.SetString(MIdValue, MIdColumn) rec.SetString(TIdValue, TIdColumn) rec.SetString(ArmyIdValue, ArmyIdColumn) rec.SetString(RankIdValue, RankIdColumn) rec.SetString(PersonalNameValue, PersonalNameColumn) rec.SetString(PersonalLastNameValue, PersonalLastNameColumn) rec.SetString(SexValue, SexColumn) rec.SetString(BirthDateValue, BirthDateColumn) rec.SetString(PlaceOfBirthValue, PlaceOfBirthColumn) rec.SetString(BAmphurValue, BAmphurColumn) rec.SetString(BProvinceValue, BProvinceColumn) rec.SetString(BloodIdValue, BloodIdColumn) rec.SetString(OriginValue, OriginColumn) rec.SetString(NationalityValue, NationalityColumn) rec.SetString(ReligionValue, ReligionColumn) rec.SetString(ArmIdValue, ArmIdColumn) rec.SetString(RegDateValue, RegDateColumn) rec.SetString(RegNo1Value, RegNo1Column) rec.SetString(RegNo2Value, RegNo2Column) rec.SetString(OfficerDateValue, OfficerDateColumn) rec.SetString(BornValue, BornColumn) rec.SetString(CremateMemIdValue, CremateMemIdColumn) rec.SetString(ArmyWelfareMemIdValue, ArmyWelfareMemIdColumn) rec.SetString(StatusIdValue, StatusIdColumn) rec.SetString(CommissionValue, CommissionColumn) rec.SetString(DeptIdValue, DeptIdColumn) rec.SetString(AddrValue, AddrColumn) rec.SetString(AmphurValue, AmphurColumn) rec.SetString(ProvinceValue, ProvinceColumn) rec.SetString(PostCodeValue, PostCodeColumn) rec.SetString(PhoneValue, PhoneColumn) rec.SetString(PhoneExtValue, PhoneExtColumn) rec.SetString(MobilePhoneValue, MobilePhoneColumn) rec.SetString(pictureValue, pictureColumn) rec.SetString(PictureNameValue, PictureNameColumn) rec.SetString(DateRankValue, DateRankColumn) rec.SetString(DatePrevRankValue, DatePrevRankColumn) 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 ''' ''' This method deletes a specified record ''' ''' Keyvalue of the record to be deleted. Public Shared Sub DeleteRecord(ByVal kv As KeyValue) PersonalIdTable.Instance.DeleteOneRecord(kv) End Sub ''' ''' This method checks if record exist in the database using the keyvalue provided. ''' ''' Key value of the record. Public Shared Function DoesRecordExist(ByVal kv As KeyValue) As Boolean Dim recordExist As Boolean = True Try PersonalIdTable.GetRecord(kv, False) Catch ex As Exception recordExist = False End Try Return recordExist End Function ''' ''' This method returns all the primary columns in the table. ''' Public Shared Function GetPrimaryKeyColumns() As ColumnList If (Not IsNothing(PersonalIdTable.Instance.TableDefinition.PrimaryKey)) Then Return PersonalIdTable.Instance.TableDefinition.PrimaryKey.Columns Else Return Nothing End If End Function ''' ''' This method takes a key and returns a keyvalue. ''' ''' 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. Public Shared Function GetKeyValue(ByVal key As Object) As KeyValue Dim kv As KeyValue = Nothing If (Not (IsNothing(PersonalIdTable.Instance.TableDefinition.PrimaryKey))) Then Dim isCompositePrimaryKey As Boolean = False isCompositePrimaryKey = PersonalIdTable.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 = PersonalIdTable.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 (PersonalIdTable.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 = PersonalIdTable.Instance.TableDefinition.PrimaryKey.ParseValue(CType(key, String)) End If End If Return kv End Function ''' ''' This method takes a record and a Column and returns an evaluated value of DFKA formula. ''' Public Shared Function GetDFKA(ByVal rec As BaseRecord, ByVal col As BaseColumn) As String Dim fkColumn As ForeignKey = PersonalIdTable.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 "= ., 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 ''' ''' This method takes a keyValue and a Column and returns an evaluated value of DFKA formula. ''' 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 = PersonalIdTable.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 "= ., 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 ''' ''' Evaluates the formula ''' 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