Public Class ClassRecordCommands
    Public Shared Function CreateRecord(EntityID)
        Dim SQL = "INSERT INTO TBPMO_RECORD(ADDED_WHO, FORM_ID,RECORD_ENTITY_ID) VALUES ('" & USER_USERNAME & "', " & EntityID & ",4711)"
        Return ClassDatabase.Execute_non_Query(SQL) = True
    End Function
    Public Shared Function GetLastRecord()
        Dim SQL = "SELECT (MAX(GUID)) FROM TBPMO_RECORD where PARENT_RECORD = 0 AND ADDED_WHO = '" & USER_USERNAME & "'"
        Return ClassDatabase.Execute_Scalar(SQL)
    End Function

    Public Shared Function ConnectRecord(PARENT_RECORD As Integer, LINK_RECORD As Integer, Optional Comment As String = "")
        Dim SQL = "INSERT INTO TBPMO_RECORD_CONNECT(RECORD1_ID,RECORD2_ID,COMMENT,ADDED_WHO) VALUES (" & PARENT_RECORD & "," & LINK_RECORD & ",'" & Comment & "','" & USER_USERNAME & "')"
        If LogErrorsOnly = False Then ClassLogger.Add(" >> ConnectRecord SQL:  " & SQL, False)
        Return ClassDatabase.Execute_non_Query(SQL)
    End Function
End Class
