EDMIService: Rework NewFile and SetAttributeValue

This commit is contained in:
Jonathan Jenne
2021-11-29 11:07:46 +01:00
parent 2bd54ccad0
commit 23aad7e9c0
28 changed files with 847 additions and 203 deletions

View File

@@ -0,0 +1,44 @@
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