This commit is contained in:
SchreiberM
2017-02-17 14:38:36 +01:00
parent a7ab84cc3f
commit 4fbf33d5ab
6 changed files with 216 additions and 145 deletions

View File

@@ -32,7 +32,9 @@ Public Class ClassInit
Public Sub InitBasics()
Try
Dim UPDATE_ID As Integer
InitInstallPath()
If InitInstallPath() = False Then
End If
Dim sql = String.Format("SELECT * FROM TBDD_MODULES WHERE UPPER(NAME) = UPPER('Record-Organizer')")
Dim KONFIG_DT As DataTable = clsDatabase.Return_Datatable(sql, False)
If KONFIG_DT.Rows.Count = 1 Then
@@ -82,10 +84,10 @@ Public Class ClassInit
Else
MyServer_UpdatePath = String.Empty
End If
sql = String.Format("SELECT CASE VERSION_CLIENT WHEN '' THEN '1.0.0.0' ELSE VERSION_CLIENT END AS VERSION_CLIENT FROM VWDD_LOGIN_USER_HISTORY WHERE GUID = (select MAX(GUID) from VWDD_LOGIN_USER_HISTORY where USER_ID = {0} AND VERSION_CLIENT <> '' AND UPPER(MACHINE_NAME) = UPPER('{1}') AND UPPER(MODULE) = UPPER('{2}'))", USER_GUID, Environment.MachineName, "Record-Organizer")
sql = String.Format("SELECT CASE VERSION_CLIENT WHEN '' THEN '{3}' ELSE VERSION_CLIENT END AS VERSION_CLIENT FROM VWDD_LOGIN_USER_HISTORY WHERE GUID = (select MAX(GUID) from VWDD_LOGIN_USER_HISTORY where USER_ID = {0} AND VERSION_CLIENT <> '' AND UPPER(MACHINE_NAME) = UPPER('{1}') AND UPPER(MODULE) = UPPER('{2}'))", USER_GUID, Environment.MachineName, "Record-Organizer", VERSION_SERVER)
VERSION_USER = clsDatabase.Execute_Scalar(sql)
If IsNothing(VERSION_USER) Then
sql = String.Format("SELECT CASE VERSION_CLIENT WHEN '' THEN '1.0.0.0' ELSE VERSION_CLIENT END AS VERSION_CLIENT FROM VWDD_LOGIN_USER_HISTORY WHERE GUID = (select MAX(GUID) from VWDD_LOGIN_USER_HISTORY where USER_ID = {0} AND VERSION_CLIENT <> '' AND UPPER(MODULE) = UPPER('{1}'))", USER_GUID, "Record-Organizer")
sql = String.Format("SELECT CASE VERSION_CLIENT WHEN '' THEN '{2}' ELSE VERSION_CLIENT END AS VERSION_CLIENT FROM VWDD_LOGIN_USER_HISTORY WHERE GUID = (select MAX(GUID) from VWDD_LOGIN_USER_HISTORY where USER_ID = {0} AND VERSION_CLIENT <> '' AND UPPER(MODULE) = UPPER('{1}'))", USER_GUID, "Record-Organizer", VERSION_SERVER)
VERSION_USER = clsDatabase.Execute_Scalar(sql)
If IsNothing(VERSION_USER) Then
VERSION_USER = "1.0.0.0"
@@ -99,17 +101,49 @@ Public Class ClassInit
End Try
End Function
Public Sub InitInstallPath()
Dim RecExe_found As Boolean = False
Public Function InitInstallPath()
Try
Dim readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Digital Data\Record Organizer", "Path", Nothing)
If Not IsNothing(readValue) Then
MY_INSTALL_PATH = readValue
Return True
Else
MY_INSTALL_PATH = readValue = ""
MY_INSTALL_PATH = ""
For Each s In Directory.GetLogicalDrives()
If RecExe_found = False Then
DirSearch(s)
End If
Next
If RecExe_found = False Then
MsgBox("Could not find the path for RecordOrganizer - Please check your installation!", MsgBoxStyle.Critical)
Return False
End If
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in InitInstallPath: " & ex.Message, True)
Return False
End Try
End Function
Sub DirSearch(ByVal sDir As String)
Dim d As String
Dim f As String
Try
For Each d In Directory.GetDirectories(sDir)
If RecExe_found = False Then
For Each f In Directory.GetFiles(d, "DD-Record-Organizer.exe")
RecExe_found = True
MY_INSTALL_PATH = Path.GetDirectoryName(f)
Exit Sub
Next
End If
If RecExe_found = False Then
DirSearch(d)
End If
Next
Catch excpt As System.Exception
ClassLogger.Add("Unexpected Error in DirSearch: " & excpt.Message, True)
End Try
End Sub
Public Shared Function InsertEssential_Log(REFERENCE_KEY As Integer, REFERENCE_STRING As String, COMMENT As String)