' This class is "generated" and will be overwritten. ' Your customizations should be made in PersonalSalaryRecord.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 PersonalSalary. ''' ''' ''' 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 ''' PersonalSalaryTable.Instance. ''' ''' ''' Public Class BasePersonalSalaryTable Inherits PrimaryKeyTable Private ReadOnly TableDefinitionString As String = PersonalSalaryDefinition.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.PersonalSalaryTable") def.InitializeTableDefinition(Me.TableDefinition) Me.ConnectionName = def.GetConnectionName() Me.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "Persons.Business.PersonalSalaryRecord") Me.ApplicationName = "App_Code" Me.DataAdapter = New PersonalSalarySqlTable() Directcast(Me.DataAdapter, PersonalSalarySqlTable).ConnectionName = Me.ConnectionName Me.TableDefinition.AdapterMetaData = Me.DataAdapter.AdapterMetaData id0Column.CodeName = "id0" PersonalIdColumn.CodeName = "PersonalId" SalaryDateColumn.CodeName = "SalaryDate" SalaryRankColumn.CodeName = "SalaryRank" SalaryStepColumn.CodeName = "SalaryStep" SalaryYearColumn.CodeName = "SalaryYear" SalaryRoundColumn.CodeName = "SalaryRound" SalaryAmoutColumn.CodeName = "SalaryAmout" SalaryExtra_NotUsedColumn.CodeName = "SalaryExtra_NotUsed" SalaryPlusColumn.CodeName = "SalaryPlus" PositionSalaryColumn.CodeName = "PositionSalary" SalaryCommandColumn.CodeName = "SalaryCommand" CommandDateColumn.CodeName = "CommandDate" End Sub #Region "Overriden methods" #End Region #Region "Properties for columns" ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.id column object. ''' Public ReadOnly Property id0Column() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(0), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.id column object. ''' Public Shared ReadOnly Property id0() As BaseClasses.Data.NumberColumn Get Return PersonalSalaryTable.Instance.id0Column End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PersonalId column object. ''' Public ReadOnly Property PersonalIdColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(1), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PersonalId column object. ''' Public Shared ReadOnly Property PersonalId() As BaseClasses.Data.StringColumn Get Return PersonalSalaryTable.Instance.PersonalIdColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryDate column object. ''' Public ReadOnly Property SalaryDateColumn() As BaseClasses.Data.DateColumn Get Return CType(Me.TableDefinition.ColumnList(2), BaseClasses.Data.DateColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryDate column object. ''' Public Shared ReadOnly Property SalaryDate() As BaseClasses.Data.DateColumn Get Return PersonalSalaryTable.Instance.SalaryDateColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryRank column object. ''' Public ReadOnly Property SalaryRankColumn() 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 PersonalSalary_.SalaryRank column object. ''' Public Shared ReadOnly Property SalaryRank() As BaseClasses.Data.StringColumn Get Return PersonalSalaryTable.Instance.SalaryRankColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryStep column object. ''' Public ReadOnly Property SalaryStepColumn() 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 PersonalSalary_.SalaryStep column object. ''' Public Shared ReadOnly Property SalaryStep() As BaseClasses.Data.NumberColumn Get Return PersonalSalaryTable.Instance.SalaryStepColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryYear column object. ''' Public ReadOnly Property SalaryYearColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(5), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryYear column object. ''' Public Shared ReadOnly Property SalaryYear() As BaseClasses.Data.StringColumn Get Return PersonalSalaryTable.Instance.SalaryYearColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryRound column object. ''' Public ReadOnly Property SalaryRoundColumn() As BaseClasses.Data.NumberColumn Get Return CType(Me.TableDefinition.ColumnList(6), BaseClasses.Data.NumberColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryRound column object. ''' Public Shared ReadOnly Property SalaryRound() As BaseClasses.Data.NumberColumn Get Return PersonalSalaryTable.Instance.SalaryRoundColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryAmout column object. ''' Public ReadOnly Property SalaryAmoutColumn() As BaseClasses.Data.CurrencyColumn Get Return CType(Me.TableDefinition.ColumnList(7), BaseClasses.Data.CurrencyColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryAmout column object. ''' Public Shared ReadOnly Property SalaryAmout() As BaseClasses.Data.CurrencyColumn Get Return PersonalSalaryTable.Instance.SalaryAmoutColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryExtra_NotUsed column object. ''' Public ReadOnly Property SalaryExtra_NotUsedColumn() As BaseClasses.Data.StringColumn Get Return CType(Me.TableDefinition.ColumnList(8), BaseClasses.Data.StringColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryExtra_NotUsed column object. ''' Public Shared ReadOnly Property SalaryExtra_NotUsed() As BaseClasses.Data.StringColumn Get Return PersonalSalaryTable.Instance.SalaryExtra_NotUsedColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryPlus column object. ''' Public ReadOnly Property SalaryPlusColumn() As BaseClasses.Data.CurrencyColumn Get Return CType(Me.TableDefinition.ColumnList(9), BaseClasses.Data.CurrencyColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryPlus column object. ''' Public Shared ReadOnly Property SalaryPlus() As BaseClasses.Data.CurrencyColumn Get Return PersonalSalaryTable.Instance.SalaryPlusColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PositionSalary column object. ''' Public ReadOnly Property PositionSalaryColumn() As BaseClasses.Data.CurrencyColumn Get Return CType(Me.TableDefinition.ColumnList(10), BaseClasses.Data.CurrencyColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.PositionSalary column object. ''' Public Shared ReadOnly Property PositionSalary() As BaseClasses.Data.CurrencyColumn Get Return PersonalSalaryTable.Instance.PositionSalaryColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.SalaryCommand column object. ''' Public ReadOnly Property SalaryCommandColumn() 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 PersonalSalary_.SalaryCommand column object. ''' Public Shared ReadOnly Property SalaryCommand() As BaseClasses.Data.StringColumn Get Return PersonalSalaryTable.Instance.SalaryCommandColumn End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.CommandDate column object. ''' Public ReadOnly Property CommandDateColumn() As BaseClasses.Data.DateColumn Get Return CType(Me.TableDefinition.ColumnList(12), BaseClasses.Data.DateColumn) End Get End Property ''' ''' This is a convenience property that provides direct access to the table's PersonalSalary_.CommandDate column object. ''' Public Shared ReadOnly Property CommandDate() As BaseClasses.Data.DateColumn Get Return PersonalSalaryTable.Instance.CommandDateColumn End Get End Property #End Region #Region "Shared helper methods" ''' ''' This is a shared function that can be used to get an array of PersonalSalaryRecord records using a where clause. ''' Public Shared Function GetRecords(ByVal where As String) As PersonalSalaryRecord() 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 PersonalSalaryRecord records using a where clause. ''' Public Shared Function GetRecords(ByVal join As BaseFilter, ByVal where As String) As PersonalSalaryRecord() 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 PersonalSalaryRecord records using a where and order by clause. ''' Public Shared Function GetRecords( _ ByVal where As String, _ ByVal orderBy As OrderBy) As PersonalSalaryRecord() 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 PersonalSalaryRecord 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 PersonalSalaryRecord() 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 PersonalSalaryRecord 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 PersonalSalaryRecord() 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 = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) End Function ''' ''' This is a shared function that can be used to get an array of PersonalSalaryRecord 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 PersonalSalaryRecord() Dim whereFilter As SqlFilter = Nothing If Not where Is Nothing AndAlso where.trim() <> "" Then whereFilter = New SqlFilter(where) End If Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) End Function Public Shared Function GetRecords( _ ByVal where As WhereClause, _ ByVal orderBy As OrderBy, _ ByVal pageIndex As Integer, _ ByVal pageSize As Integer) As PersonalSalaryRecord() Dim join As BaseClasses.Data.BaseFilter = Nothing Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) 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 PersonalSalaryRecord() Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize) Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) 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 PersonalSalaryRecord() Dim join As BaseClasses.Data.BaseFilter = Nothing Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) 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 PersonalSalaryRecord() Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, where.GetFilter(), Nothing, orderBy, pageIndex, pageSize, totalRecords) Return CType(recList.ToArray(GetType(Persons.Business.PersonalSalaryRecord)), PersonalSalaryRecord()) 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(PersonalSalaryTable.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(PersonalSalaryTable.Instance.GetRecordListCount(join, whereFilter, Nothing, Nothing)) End Function Public Shared Function GetRecordCount(ByVal where As WhereClause) As Integer Return CInt(PersonalSalaryTable.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(PersonalSalaryTable.Instance.GetRecordListCount(join, where.GetFilter(), Nothing, Nothing)) End Function ''' ''' This is a shared function that can be used to get a PersonalSalaryRecord record using a where clause. ''' Public Shared Function GetRecord(ByVal where As String) As PersonalSalaryRecord Dim orderBy As OrderBy = Nothing Return GetRecord(where, orderBy) End Function ''' ''' This is a shared function that can be used to get a PersonalSalaryRecord record using a where clause. ''' Public Shared Function GetRecord(ByVal join As BaseFilter, ByVal where As String) As PersonalSalaryRecord Dim orderBy As OrderBy = Nothing Return GetRecord(join, where, orderBy) End Function ''' ''' This is a shared function that can be used to get a PersonalSalaryRecord record using a where and order by clause. ''' Public Shared Function GetRecord( _ ByVal where As String, _ ByVal orderBy As OrderBy) As PersonalSalaryRecord 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 = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) Dim rec As PersonalSalaryRecord = Nothing If recList.Count > 0 Then rec = CType(recList(0), PersonalSalaryRecord) End If Return rec End Function ''' ''' This is a shared function that can be used to get a PersonalSalaryRecord 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 PersonalSalaryRecord Dim whereFilter As SqlFilter = Nothing If Not where Is Nothing AndAlso where.Trim() <> "" Then whereFilter = New SqlFilter(where) End If Dim recList As ArrayList = PersonalSalaryTable.Instance.GetRecordList(join, whereFilter, Nothing, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE) Dim rec As PersonalSalaryRecord = Nothing If recList.Count > 0 Then rec = CType(recList(0), PersonalSalaryRecord) 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 PersonalSalaryTable.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 PersonalSalaryTable.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 PersonalSalaryRecord = GetRecords(where) Return PersonalSalaryTable.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 PersonalSalaryRecord = GetRecords(join, where) Return PersonalSalaryTable.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 PersonalSalaryRecord = GetRecords(where, orderBy) Return PersonalSalaryTable.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 PersonalSalaryRecord = GetRecords(join, where, orderBy) Return PersonalSalaryTable.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 PersonalSalaryRecord = GetRecords(where, orderBy, pageIndex, pageSize) Return PersonalSalaryTable.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 PersonalSalaryRecord = GetRecords(join, where, orderBy, pageIndex, pageSize) Return PersonalSalaryTable.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) PersonalSalaryTable.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 PersonalSalaryTable.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 PersonalSalaryTable.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 PersonalSalaryTable.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 PersonalSalaryTable.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 PersonalSalaryTable.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 PersonalSalaryTable.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 PersonalSalaryTable.Instance.TableDefinition.Columns End Function ''' ''' This method returns the columnlist in the table. ''' Public Shared Function GetColumnList() As ColumnList Return PersonalSalaryTable.Instance.TableDefinition.ColumnList End Function ''' ''' This method creates a new record and returns it to be edited. ''' Public Shared Function CreateNewRecord() As IRecord Return PersonalSalaryTable.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 PersonalSalaryTable.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 = PersonalSalaryTable.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 PersonalSalaryRecord Return CType(PersonalSalaryTable.Instance.GetRecordData(id, bMutable), PersonalSalaryRecord) 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 PersonalSalaryRecord Return CType(PersonalSalaryTable.Instance.GetRecordData(id, bMutable), PersonalSalaryRecord) End Function ' Convenience method for creating a record Public Overloads Function NewRecord( _ ByVal PersonalIdValue As String, _ ByVal SalaryDateValue As String, _ ByVal SalaryRankValue As String, _ ByVal SalaryStepValue As String, _ ByVal SalaryYearValue As String, _ ByVal SalaryRoundValue As String, _ ByVal SalaryAmoutValue As String, _ ByVal SalaryExtra_NotUsedValue As String, _ ByVal SalaryPlusValue As String, _ ByVal PositionSalaryValue As String, _ ByVal SalaryCommandValue As String, _ ByVal CommandDateValue As String _ ) As KeyValue Dim rec As IPrimaryKeyRecord = CType(Me.CreateRecord(), IPrimaryKeyRecord) rec.SetString(PersonalIdValue, PersonalIdColumn) rec.SetString(SalaryDateValue, SalaryDateColumn) rec.SetString(SalaryRankValue, SalaryRankColumn) rec.SetString(SalaryStepValue, SalaryStepColumn) rec.SetString(SalaryYearValue, SalaryYearColumn) rec.SetString(SalaryRoundValue, SalaryRoundColumn) rec.SetString(SalaryAmoutValue, SalaryAmoutColumn) rec.SetString(SalaryExtra_NotUsedValue, SalaryExtra_NotUsedColumn) rec.SetString(SalaryPlusValue, SalaryPlusColumn) rec.SetString(PositionSalaryValue, PositionSalaryColumn) rec.SetString(SalaryCommandValue, SalaryCommandColumn) rec.SetString(CommandDateValue, CommandDateColumn) 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) PersonalSalaryTable.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 PersonalSalaryTable.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(PersonalSalaryTable.Instance.TableDefinition.PrimaryKey)) Then Return PersonalSalaryTable.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(PersonalSalaryTable.Instance.TableDefinition.PrimaryKey))) Then Dim isCompositePrimaryKey As Boolean = False isCompositePrimaryKey = PersonalSalaryTable.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 = PersonalSalaryTable.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 (PersonalSalaryTable.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 = PersonalSalaryTable.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 = PersonalSalaryTable.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 = PersonalSalaryTable.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