44 lines
1.4 KiB
VB.net
44 lines
1.4 KiB
VB.net
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Modules.Language
|
|
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Services.EDMIService.Messages
|
|
|
|
Namespace IDB
|
|
Public Class Helpers
|
|
Inherits BaseClass
|
|
|
|
Private MSSQLServer As MSSQLServer
|
|
|
|
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer)
|
|
MyBase.New(pLogConfig)
|
|
MSSQLServer = pMSSQLServer
|
|
End Sub
|
|
|
|
Public Function TestObjectIdExists(pObjectId As Long, Optional ByRef IsDeleted As Boolean = False, Optional ByRef IsActive As Boolean = False) As Boolean
|
|
Try
|
|
Dim oSQL As String = $"SELECT IDB_OBJ_ID, ACTIVE, DELETED FROM TBIDB_OBJECT WHERE IDB_OBJ_ID = {pObjectId}"
|
|
Dim oTable As DataTable = MSSQLServer.GetDatatable(oSQL)
|
|
|
|
If IsNothing(oTable) OrElse oTable.Rows.Count = 0 Then
|
|
Logger.Warn("ObjectId {0} does not exist")
|
|
Return False
|
|
End If
|
|
|
|
Dim oRow As DataRow = oTable.Rows.Item(0)
|
|
Dim oActive = Utils.NotNull(oRow.Item("ACTIVE"), False)
|
|
Dim oDeleted = Utils.NotNull(oRow.Item("DELETED"), False)
|
|
|
|
IsDeleted = oDeleted
|
|
IsActive = oActive
|
|
|
|
Return True
|
|
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Return False
|
|
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
End Namespace |