57 lines
2.3 KiB
VB.net
57 lines
2.3 KiB
VB.net
|
|
Imports System.Data.SQLite
|
|||
|
|
Imports UTS_Core.Database.Sqlite
|
|||
|
|
Imports UTS_Core.UTSModule.DatabaseTable
|
|||
|
|
|
|||
|
|
Namespace UTSModule.Project
|
|||
|
|
Public Class PlanColHelper
|
|||
|
|
Property ColName() As String
|
|||
|
|
|
|||
|
|
Property ColType() As String
|
|||
|
|
|
|||
|
|
Property ColDesc() As String
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Shared Function SearchPlanCol(path As String, password As String) As DataTable
|
|||
|
|
Dim connectString As String = CommandHelpers.ConnectionString(path, password)
|
|||
|
|
Using sqliteConn As New SQLiteConnection(connectString)
|
|||
|
|
sqliteConn.Open()
|
|||
|
|
Dim tableName As String = StationPlanColHelperTable.TableName
|
|||
|
|
Dim colNames As New List(Of String)
|
|||
|
|
colNames.Add(StationPlanColHelperTable.ColNamesEnum.ID.ToString())
|
|||
|
|
colNames.Add(StationPlanColHelperTable.ColNamesEnum.ColName.ToString())
|
|||
|
|
colNames.Add(StationPlanColHelperTable.ColNamesEnum.ColType.ToString())
|
|||
|
|
colNames.Add(StationPlanColHelperTable.ColNamesEnum.ColDesc.ToString())
|
|||
|
|
|
|||
|
|
Return Executor.Search(sqliteConn, tableName, colNames)
|
|||
|
|
End Using
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Function InitPlanColHelper(dtRow As DataRow) As Boolean
|
|||
|
|
ColName = dtRow.Item(StationPlanColHelperTable.ColNamesEnum.ColName).ToString()
|
|||
|
|
ColType = dtRow.Item(StationPlanColHelperTable.ColNamesEnum.ColType).ToString()
|
|||
|
|
ColDesc = dtRow.Item(StationPlanColHelperTable.ColNamesEnum.ColDesc).ToString()
|
|||
|
|
|
|||
|
|
Return True
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Public Shared Function InitPlanColHelper(dtPlanCol As DataTable) As Dictionary(Of String, PlanColHelper)
|
|||
|
|
Dim dicCommandHelpers As New Dictionary(Of String, PlanColHelper)
|
|||
|
|
|
|||
|
|
For row As Integer = 0 To dtPlanCol.Rows.Count - 1
|
|||
|
|
Dim colHelper As New PlanColHelper
|
|||
|
|
colHelper.InitPlanColHelper(dtPlanCol.Rows(row))
|
|||
|
|
|
|||
|
|
dicCommandHelpers.Add(colHelper.ColName, colHelper)
|
|||
|
|
Next
|
|||
|
|
|
|||
|
|
Return dicCommandHelpers
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Public Shared Function InitPlanColHelper(path As String, password As String) As Dictionary(Of String, PlanColHelper)
|
|||
|
|
Dim dtPlanCol As DataTable = SearchPlanCol(path, password)
|
|||
|
|
|
|||
|
|
Return InitPlanColHelper(dtPlanCol)
|
|||
|
|
End Function
|
|||
|
|
End Class
|
|||
|
|
End Namespace
|