2023-09-25
This commit is contained in:
40
EnvelopeGenerator.Common/Models/ConfigModel.vb
Normal file
40
EnvelopeGenerator.Common/Models/ConfigModel.vb
Normal file
@@ -0,0 +1,40 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ConfigModel
|
||||
Inherits BaseModel
|
||||
|
||||
Public Sub New(pState As State)
|
||||
MyBase.New(pState)
|
||||
End Sub
|
||||
|
||||
Public Function LoadConfiguration() As DbConfig
|
||||
Try
|
||||
Dim oSql As String = "SELECT TOP 1 * FROM TBSIG_CONFIG"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oSql)
|
||||
Dim oRow = oTable.Rows.Item(0)
|
||||
|
||||
Return New DbConfig() With {
|
||||
.DocumentPath = oRow.ItemEx("DOCUMENT_PATH", ""),
|
||||
.SendingProfile = oRow.ItemEx("SENDING_PROFILE", 0),
|
||||
.SignatureHost = oRow.ItemEx("SIGNATURE_HOST", ""),
|
||||
.ExternalProgramName = oRow.ItemEx("EXTERNAL_PROGRAM_NAME", "")
|
||||
}
|
||||
Catch ex As Exception
|
||||
Return New DbConfig()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetUserId() As Integer
|
||||
Try
|
||||
Dim oUserId As Integer = Database.GetScalarValue($"SELECT GUID FROM TBDD_USER WHERE USERNAME = '{Environment.UserName}'")
|
||||
Return oUserId
|
||||
|
||||
Catch ex As Exception
|
||||
Return 0
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user