MS-KW39 Änderungen UpdateClass und VersionChecker
This commit is contained in:
parent
5d659602db
commit
e8c06c46a7
@ -314,33 +314,40 @@ Public Class ClassControlBuilder
|
|||||||
If TableResult.Rows.Count = 0 Then
|
If TableResult.Rows.Count = 0 Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
If CURRENT_RECORD_ID = 0 Or CONTROL_ID = 0 Then
|
||||||
If IsNothing(value) Then 'Kein Value also abhängige Controls auf "Leer" setzen
|
|
||||||
For Each row As DataRow In TableResult.Rows
|
|
||||||
|
|
||||||
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
|
|
||||||
Dim dependingControlId As Integer = row.Item("GUID")
|
|
||||||
Dim panel As Panel = DirectCast(control.Parent, Panel)
|
|
||||||
' Über die Id das Control finden
|
|
||||||
Dim dependingControl As Control = panel.Controls.OfType(Of Control)().Where(Function(c As Control)
|
|
||||||
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
|
|
||||||
End Function).SingleOrDefault()
|
|
||||||
Dim type = dependingControl.GetType().Name
|
|
||||||
Select Case type
|
|
||||||
Case "CustomComboBox"
|
|
||||||
DirectCast(dependingControl, CustomComboBox).DataSource = Nothing
|
|
||||||
Case "CheckedListBoxControl"
|
|
||||||
DirectCast(dependingControl, DevExpress.XtraEditors.CheckedListBoxControl).DataSource = Nothing
|
|
||||||
Case "Label"
|
|
||||||
DirectCast(dependingControl, Label).Text = ""
|
|
||||||
Case "TextBox"
|
|
||||||
DirectCast(dependingControl, TextBox).Text = ""
|
|
||||||
Case "GridControl"
|
|
||||||
DirectCast(dependingControl, DevExpress.XtraGrid.GridControl).DataSource = Nothing
|
|
||||||
End Select
|
|
||||||
|
|
||||||
Next
|
|
||||||
Exit Sub
|
Exit Sub
|
||||||
|
End If
|
||||||
|
If IsNothing(value) Then 'Kein Value also abhängige Controls auf "Leer" setzen
|
||||||
|
Try
|
||||||
|
For Each row As DataRow In TableResult.Rows
|
||||||
|
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
|
||||||
|
Dim dependingControlId As Integer = row.Item("GUID")
|
||||||
|
Dim panel As Panel = DirectCast(control.Parent, Panel)
|
||||||
|
' Über die Id das Control finden
|
||||||
|
Dim dependingControl As Control = panel.Controls.OfType(Of Control)().Where(Function(c As Control)
|
||||||
|
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
|
||||||
|
End Function).SingleOrDefault()
|
||||||
|
Dim type = dependingControl.GetType().Name
|
||||||
|
Select Case type
|
||||||
|
Case "CustomComboBox"
|
||||||
|
DirectCast(dependingControl, CustomComboBox).DataSource = Nothing
|
||||||
|
Case "CheckedListBoxControl"
|
||||||
|
DirectCast(dependingControl, DevExpress.XtraEditors.CheckedListBoxControl).DataSource = Nothing
|
||||||
|
Case "Label"
|
||||||
|
DirectCast(dependingControl, Label).Text = ""
|
||||||
|
Case "TextBox"
|
||||||
|
DirectCast(dependingControl, TextBox).Text = ""
|
||||||
|
Case "GridControl"
|
||||||
|
DirectCast(dependingControl, DevExpress.XtraGrid.GridControl).DataSource = Nothing
|
||||||
|
End Select
|
||||||
|
|
||||||
|
Next
|
||||||
|
Exit Sub
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox("Unexpected error in DependingControls (For Each row As DataRow In TableResult.Rows)- " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical)
|
||||||
|
Exit Sub
|
||||||
|
End Try
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
For Each row As DataRow In TableResult.Rows
|
For Each row As DataRow In TableResult.Rows
|
||||||
@ -356,20 +363,7 @@ Public Class ClassControlBuilder
|
|||||||
If match.Success Then
|
If match.Success Then
|
||||||
Dim sqlguid = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", CONTROL_ID, CURRENT_RECORD_ID)
|
Dim sqlguid = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", CONTROL_ID, CURRENT_RECORD_ID)
|
||||||
Dim ctrlvalID = ClassDatabase.Execute_Scalar(sqlguid, True)
|
Dim ctrlvalID = ClassDatabase.Execute_Scalar(sqlguid, True)
|
||||||
'Select Case row.Item("FORMAT_TYPE")
|
|
||||||
' Case "Currency"
|
|
||||||
' value = Decimal.Parse(value, Globalization.NumberStyles.Currency).ToString
|
|
||||||
' Case "Decimal"
|
|
||||||
' value = Decimal.Parse(value, Globalization.NumberStyles.Integer)
|
|
||||||
'End Select
|
|
||||||
'Select Case row.Item("CONTROL_TYPE_ID")
|
|
||||||
' Case 4 'DatePicker
|
|
||||||
' Try
|
|
||||||
' value = CStr(CDate(value)) 'Format(value, "dd-MM-yyyy"))
|
|
||||||
' Catch ex As Exception
|
|
||||||
' ClassLogger.Add("Unexpected Error in converting Value '" & value & "' to date - Control-ID: " & CONTROL_ID.ToString & "- Error: " & ex.Message)
|
|
||||||
' End Try
|
|
||||||
'End Select
|
|
||||||
' Diese Abfrage verhindert, dass Werte, die aus z.B. CheckedListBoxen kommen,
|
' Diese Abfrage verhindert, dass Werte, die aus z.B. CheckedListBoxen kommen,
|
||||||
' nicht überschrieben werden. Diese Werte werden bereits mit UpdateMultipleValues gespeichert
|
' nicht überschrieben werden. Diese Werte werden bereits mit UpdateMultipleValues gespeichert
|
||||||
If (Not value.Contains(";")) Then
|
If (Not value.Contains(";")) Then
|
||||||
|
|||||||
@ -586,9 +586,11 @@ Public Class ClassControlCommandsUI
|
|||||||
If Not _addValue = "" Then
|
If Not _addValue = "" Then
|
||||||
Dim converted_value = Check_and_Format_Value(ControlId, RecordId, _addValue)
|
Dim converted_value = Check_and_Format_Value(ControlId, RecordId, _addValue)
|
||||||
If Not IsNothing(converted_value) Then
|
If Not IsNothing(converted_value) Then
|
||||||
Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE,ADDED_WHO) VALUES({0}, {1}, '{2}','{3}')", ControlId, RecordId, converted_value, USER_USERNAME)
|
ClassControlCommandsUI.InsertControlValue(ControlId, RecordId, converted_value, CURRENT_ENTITY_ID)
|
||||||
ClassDatabase.Execute_non_Query(ins)
|
|
||||||
ClassProxy.PRPROXY_CONTROL_VALUE_UPD_INS(CURRENT_ENTITY_ID, ControlId, RecordId, converted_value)
|
'Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE,ADDED_WHO) VALUES({0}, {1}, '{2}','{3}')", ControlId, RecordId, converted_value, USER_USERNAME)
|
||||||
|
'ClassDatabase.Execute_non_Query(ins)
|
||||||
|
'ClassProxy.PRPROXY_CONTROL_VALUE_UPD_INS(CURRENT_ENTITY_ID, ControlId, RecordId, converted_value)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|||||||
@ -21,6 +21,8 @@ Public Class ClassUpdate
|
|||||||
Public Shared UPDATE_ERROR As Boolean = False
|
Public Shared UPDATE_ERROR As Boolean = False
|
||||||
|
|
||||||
Private Shared RecExe_found As Boolean = False
|
Private Shared RecExe_found As Boolean = False
|
||||||
|
Private Shared DT_USER_DATA As DataTable
|
||||||
|
Private Shared USER_INFO1, USER_INFO2, USER_INFO3 As String
|
||||||
Public Shared Function Init()
|
Public Shared Function Init()
|
||||||
Try
|
Try
|
||||||
If InitInstallPath() = False Then
|
If InitInstallPath() = False Then
|
||||||
@ -33,7 +35,7 @@ Public Class ClassUpdate
|
|||||||
MIN_REQUIRED_VERSION = KONFIG_DT.Rows(0).Item("MIN_REQUIRED_VERSION")
|
MIN_REQUIRED_VERSION = KONFIG_DT.Rows(0).Item("MIN_REQUIRED_VERSION")
|
||||||
End If
|
End If
|
||||||
sql = String.Format("Select * FROM TBDD_VERSION_UPDATE WHERE GUID = (Select MAX(GUID) FROM TBDD_VERSION_UPDATE WHERE UPPER(MODULE_NAME) = UPPER('{0}'))", "Record-Organizer")
|
sql = String.Format("Select * FROM TBDD_VERSION_UPDATE WHERE GUID = (Select MAX(GUID) FROM TBDD_VERSION_UPDATE WHERE UPPER(MODULE_NAME) = UPPER('{0}'))", "Record-Organizer")
|
||||||
DT_UPDATE = clsDatabase.Return_Datatable(sql, False)
|
DT_UPDATE = clsDatabase.Return_Datatable(sql)
|
||||||
If Not IsNothing(DT_UPDATE) Then
|
If Not IsNothing(DT_UPDATE) Then
|
||||||
If DT_UPDATE.Rows.Count = 1 Then
|
If DT_UPDATE.Rows.Count = 1 Then
|
||||||
UPDATE_ID = DT_UPDATE.Rows(0).Item("GUID")
|
UPDATE_ID = DT_UPDATE.Rows(0).Item("GUID")
|
||||||
@ -43,6 +45,7 @@ Public Class ClassUpdate
|
|||||||
ALL_USERS = DT_UPDATE.Rows(0).Item("ALL_USERS")
|
ALL_USERS = DT_UPDATE.Rows(0).Item("ALL_USERS")
|
||||||
sql = String.Format("SELECT * FROM TBDD_VERSION_ITEMS WHERE UPDATE_ID = {0} AND [INFO1] IS NOT NULL ORDER BY GUID", UPDATE_ID)
|
sql = String.Format("SELECT * FROM TBDD_VERSION_ITEMS WHERE UPDATE_ID = {0} AND [INFO1] IS NOT NULL ORDER BY GUID", UPDATE_ID)
|
||||||
DT_UPDATE_ITEMS = clsDatabase.Return_Datatable(sql)
|
DT_UPDATE_ITEMS = clsDatabase.Return_Datatable(sql)
|
||||||
|
ClassLogger.Add(String.Format("{0} items need to be updated!", DT_UPDATE_ITEMS.Rows.Count.ToString), False)
|
||||||
Else
|
Else
|
||||||
ClassLogger.Add(">> No Updates Configured!", False)
|
ClassLogger.Add(">> No Updates Configured!", False)
|
||||||
End If
|
End If
|
||||||
@ -116,17 +119,12 @@ Public Class ClassUpdate
|
|||||||
Else
|
Else
|
||||||
USER_GUID = USER_DT.Rows(0).Item("GUID")
|
USER_GUID = USER_DT.Rows(0).Item("GUID")
|
||||||
USER_LANGUAGE = USER_DT.Rows(0).Item("LANGUAGE")
|
USER_LANGUAGE = USER_DT.Rows(0).Item("LANGUAGE")
|
||||||
sql = String.Format("SELECT UPDATE_PATH FROM TBDD_VERSION_USER_UPDATE_PATH WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer")
|
sql = String.Format("SELECT UPDATE_PATH,TEMPPATH,INFO1,INFO2,INFO3 FROM TBDD_VERSION_USER_UPDATE_PATH WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer")
|
||||||
Dim USER_UPDATE_PATH = clsDatabase.Execute_Scalar(sql)
|
DT_USER_DATA = clsDatabase.Return_Datatable(sql)
|
||||||
If Not IsNothing(USER_UPDATE_PATH) Then
|
MyServer_UpdatePath = DT_USER_DATA.Rows(0).Item("UPDATE_PATH")
|
||||||
If USER_UPDATE_PATH <> String.Empty Then
|
|
||||||
MyServer_UpdatePath = USER_UPDATE_PATH
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
MyServer_UpdatePath = String.Empty
|
|
||||||
End If
|
|
||||||
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)
|
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)
|
VERSION_USER = clsDatabase.Execute_Scalar(sql)
|
||||||
If IsNothing(VERSION_USER) Then
|
If IsNothing(VERSION_USER) Then
|
||||||
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)
|
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)
|
VERSION_USER = clsDatabase.Execute_Scalar(sql)
|
||||||
@ -145,89 +143,188 @@ Public Class ClassUpdate
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
Public Shared Sub RUN_UPDATE()
|
Public Shared Sub RUN_UPDATE()
|
||||||
|
Dim UPD_VC As Boolean = False
|
||||||
|
Dim UPD_RM As Boolean = False
|
||||||
|
Dim KEEP_TEMPPATH As Boolean = False
|
||||||
|
If DT_USER_DATA.Rows.Count <> 1 Then
|
||||||
|
Exit Sub
|
||||||
|
Else
|
||||||
|
USER_INFO1 = DT_USER_DATA.Rows(0).Item("INFO1")
|
||||||
|
USER_INFO2 = DT_USER_DATA.Rows(0).Item("INFO2")
|
||||||
|
USER_INFO3 = DT_USER_DATA.Rows(0).Item("INFO3")
|
||||||
|
|
||||||
If (VERSION_USER = VERSION_SERVER) Or VERSION_SERVER = 1000 Or VERSION_USER = 1000 Then
|
If DT_USER_DATA.Rows(0).Item("TEMPPATH") <> "" Then
|
||||||
|
FOLDER_TEMP = DT_USER_DATA.Rows(0).Item("TEMPPATH")
|
||||||
|
Else
|
||||||
|
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
|
||||||
|
If Upd_item.Item("ITEM_INFO") = "VERSION_CHECKER.exe" Then
|
||||||
|
If Not USER_INFO1.Contains(Upd_item.Item("INFO2")) Then
|
||||||
|
UPD_VC = True
|
||||||
|
|
||||||
|
End If
|
||||||
|
ElseIf Upd_item.Item("ITEM_INFO") = "RecordOrganizer_RightManager.exe" Then
|
||||||
|
If Not USER_INFO1.Contains(Upd_item.Item("INFO2")) Then
|
||||||
|
UPD_RM = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
If Not IsDBNull(Upd_item.Item("INFO3")) Then
|
||||||
|
FOLDER_TEMP = Upd_item.Item("INFO3")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
If UPD_VC = True Or UPD_RM = True Then
|
||||||
|
UPDATE_NECESSARY = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UPDATE_NECESSARY = False Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
UPDATE_NECESSARY = True
|
'If FORCE_UPDATE = False Then
|
||||||
If FORCE_UPDATE = False Then
|
|
||||||
|
|
||||||
If VERSIONS_FOR_FORCE_UPDATE.Contains(VERSION_USER) Then
|
' If VERSIONS_FOR_FORCE_UPDATE.Contains(VERSION_USER) Then
|
||||||
ClassLogger.Add(String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER), False)
|
' ClassLogger.Add(String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER), False)
|
||||||
ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER))
|
' ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER))
|
||||||
FORCE_UPDATE = True
|
' FORCE_UPDATE = True
|
||||||
End If
|
' End If
|
||||||
|
'End If
|
||||||
|
'If FORCE_UPDATE = False Then
|
||||||
|
|
||||||
|
' If ALL_USERS = False Then
|
||||||
|
' sql = String.Format("SELECT COUNT(GUID) FROM TBDD_VERSION_USER_UPDATE WHERE USER_ID = {0} AND UPDATE_ID = {1}", USER_GUID, UPDATE_ID)
|
||||||
|
' If clsDatabase.Execute_Scalar(sql) = 0 Then
|
||||||
|
' ClassLogger.Add(String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID), False)
|
||||||
|
' ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID))
|
||||||
|
' Exit Sub
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
|
||||||
|
Dim msg = "Auf dem Server liegt ein Update für ein ADDI-AddOn bereit!" & vbNewLine & "Wollen Sie das Update nun durchführen? Die Dauer ist abhängig von Ihrer Netzwerkverbindung!"
|
||||||
|
If USER_LANGUAGE <> "de-DE" Then
|
||||||
|
msg = "There is a new release available for an ADDI-AddOn!" & vbNewLine & "Would You like to install the update now? This might take some time minute(s)!"
|
||||||
End If
|
End If
|
||||||
If FORCE_UPDATE = False Then
|
Dim result As MsgBoxResult
|
||||||
|
|
||||||
If ALL_USERS = False Then
|
|
||||||
Dim sql = String.Format("SELECT COUNT(GUID) FROM TBDD_VERSION_USER_UPDATE WHERE USER_ID = {0} AND UPDATE_ID = {1}", USER_GUID, UPDATE_ID)
|
|
||||||
If clsDatabase.Execute_Scalar(sql) = 0 Then
|
|
||||||
ClassLogger.Add(String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID), False)
|
|
||||||
ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID))
|
|
||||||
Exit Sub
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim msg = "Auf dem Server liegt ein Update für ein ADDI-AddOn bereit!" & vbNewLine & "Wollen Sie das Update nun durchführen? Die Dauer ist abhängig von Ihrer Netzwerkverbindung!"
|
|
||||||
If USER_LANGUAGE <> "de-DE" Then
|
|
||||||
msg = "There is a new release available for an ADDI-AddOn!" & vbNewLine & "Would You like to install the update now? This might take some time (minute(s))!"
|
|
||||||
End If
|
|
||||||
Dim result As MsgBoxResult
|
|
||||||
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||||
If result = MsgBoxResult.No Then
|
If result = MsgBoxResult.No Then
|
||||||
UPDATE_CANCELLED = True
|
UPDATE_CANCELLED = True
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
If MyServer_UpdatePath <> String.Empty Then
|
If FOLDER_TEMP <> String.Empty Then
|
||||||
If Directory.Exists(MyServer_UpdatePath) Then
|
If Directory.Exists(FOLDER_TEMP) Then
|
||||||
GetTempFolderGuid()
|
' GetTempFolderGuid()
|
||||||
If FOLDER_TEMP <> String.Empty Then
|
' If FOLDER_TEMP <> String.Empty Then
|
||||||
|
|
||||||
' Make a reference to a directory.
|
Dim error_while_copying = False
|
||||||
Dim di As New DirectoryInfo(MyServer_UpdatePath)
|
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
|
||||||
' Get a reference to each file in that directory.
|
ClassLogger.Add(String.Format("...working on item {0}: ", Upd_item.Item("ITEM_INFO")), False)
|
||||||
Dim fiArr As FileInfo() = di.GetFiles()
|
|
||||||
' Display the names of the files.
|
|
||||||
'Dim fri As FileInfo
|
|
||||||
Dim error_while_copying = False
|
|
||||||
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
|
|
||||||
If error_while_copying = True Then
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Dim updatefile2copy = Path.Combine(MyServer_UpdatePath, Upd_item.Item("ITEM_INFO"))
|
|
||||||
|
|
||||||
Dim tempfilename = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
|
|
||||||
|
|
||||||
If File.Exists(updatefile2copy) Then
|
|
||||||
Try
|
|
||||||
System.IO.File.Copy(updatefile2copy, tempfilename)
|
|
||||||
Catch ex As Exception
|
|
||||||
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, updatefile2copy, tempfilename))
|
|
||||||
error_while_copying = True
|
|
||||||
UPDATE_ERROR = True
|
|
||||||
End Try
|
|
||||||
Else
|
|
||||||
ClassLogger.Add(String.Format("UpdateFile {0} is not existing or accessible", updatefile2copy))
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
|
|
||||||
If error_while_copying = False Then
|
|
||||||
Replace_Files()
|
|
||||||
|
|
||||||
|
If Upd_item.Item("ITEM_INFO") = "VERSION_CHECKER.exe" Then
|
||||||
|
KEEP_TEMPPATH = Upd_item.Item("BIT3")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
If error_while_copying = True Then
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Dim tempfilename = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
|
||||||
|
If File.Exists(tempfilename) Then
|
||||||
|
Try
|
||||||
|
Dim error_while_replacing = False
|
||||||
|
|
||||||
|
Dim BackUpOfFileToReplace As String = MY_INSTALL_PATH & "\" & Upd_item.Item("INFO1") & Upd_item.Item("ITEM_INFO") & ".bac"
|
||||||
|
BackUpOfFileToReplace = BackUpOfFileToReplace.Replace("//", "/")
|
||||||
|
|
||||||
|
Dim sourcefile = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
|
||||||
|
Dim targetfile
|
||||||
|
If IsDBNull(Upd_item.Item("INFO1")) Then
|
||||||
|
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
||||||
|
Else
|
||||||
|
If Upd_item.Item("INFO1") <> String.Empty Then
|
||||||
|
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
|
||||||
|
Else
|
||||||
|
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
targetfile = targetfile.ToString.Replace("//", "/")
|
||||||
|
ClassLogger.Add(String.Format("...replacing targetfile '{0}': ", targetfile), False)
|
||||||
|
Try
|
||||||
|
' Replace the file.
|
||||||
|
If File.Exists(targetfile) Then
|
||||||
|
If File_Rename(targetfile, BackUpOfFileToReplace) = True Then
|
||||||
|
If File.Exists(BackUpOfFileToReplace) Then
|
||||||
|
If KEEP_TEMPPATH Then
|
||||||
|
If CopyFile(sourcefile, targetfile) = True Then
|
||||||
|
File_Delete(BackUpOfFileToReplace)
|
||||||
|
ClassLogger.Add(String.Format("...targetfile '{0}' was copied! ", targetfile), False)
|
||||||
|
Dim updinfo
|
||||||
|
If USER_INFO1 <> "" Then
|
||||||
|
updinfo = USER_INFO1 & ";" & Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
|
||||||
|
Else
|
||||||
|
updinfo = Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
|
||||||
|
End If
|
||||||
|
Dim _Sql = String.Format("Update TBDD_VERSION_USER_UPDATE_PATH SET INFO1 = '{2}' WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer", updinfo)
|
||||||
|
clsDatabase.Execute_non_Query(_Sql)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If MoveFile(sourcefile, targetfile) = True Then
|
||||||
|
File_Delete(BackUpOfFileToReplace)
|
||||||
|
ClassLogger.Add(String.Format("...targetfile '{0}' was replaced! ", targetfile), False)
|
||||||
|
Dim updinfo
|
||||||
|
If USER_INFO1 <> "" Then
|
||||||
|
updinfo = USER_INFO1 & ";" & Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
|
||||||
|
Else
|
||||||
|
updinfo = Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
|
||||||
|
End If
|
||||||
|
Dim _Sql = String.Format("Update TBDD_VERSION_USER_UPDATE_PATH SET INFO1 = '{2}' WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer", updinfo)
|
||||||
|
clsDatabase.Execute_non_Query(_Sql)
|
||||||
|
Else
|
||||||
|
ClassLogger.Add(String.Format("MoveFile was not successfull! BackupFile will be activated!"))
|
||||||
|
'Verschieben hat nicht geklappt also die Backupdatei wieder umbenennen!
|
||||||
|
File_Rename(BackUpOfFileToReplace, targetfile)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, sourcefile, targetfile))
|
||||||
|
error_while_replacing = True
|
||||||
|
UPDATE_ERROR = True
|
||||||
|
End Try
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
ClassLogger.Add(String.Format("Unexpected Error in Replace_Files: {0}", ex.Message))
|
||||||
|
UPDATE_ERROR = True
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
Dim upd = String.Format("Update TBDD_VERSION_USER_UPDATE_PATH SET TEMPPATH = '' WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer")
|
||||||
|
clsDatabase.Execute_non_Query(upd)
|
||||||
|
Try
|
||||||
|
If KEEP_TEMPPATH = False Then
|
||||||
'Delete the tempfolder and all data
|
'Delete the tempfolder and all data
|
||||||
System.IO.Directory.Delete(FOLDER_TEMP, True)
|
System.IO.Directory.Delete(FOLDER_TEMP, True)
|
||||||
Catch ex As Exception
|
Else
|
||||||
|
ClassLogger.Add(String.Format("TEMP FOLDER SHALL BE KEPT..."), False)
|
||||||
|
End If
|
||||||
|
|
||||||
End Try
|
Catch ex As Exception
|
||||||
Else
|
|
||||||
ClassLogger.Add(String.Format("The temporaryFolder could not be created!"))
|
End Try
|
||||||
End If
|
'Else
|
||||||
|
' ClassLogger.Add(String.Format("The temporaryFolder could not be created!"))
|
||||||
|
'End If
|
||||||
Else
|
Else
|
||||||
ClassLogger.Add(String.Format("The Updatepath '{0}'is not accessible or does not exist", MyServer_UpdatePath))
|
ClassLogger.Add(String.Format("The Updatepath '{0}'is not accessible or does not exist", MyServer_UpdatePath))
|
||||||
End If
|
End If
|
||||||
@ -248,64 +345,6 @@ Public Class ClassUpdate
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
Private Shared Sub Replace_Files()
|
|
||||||
Try
|
|
||||||
|
|
||||||
'Jede Datei im tempfolder wird replaced
|
|
||||||
Dim di As New DirectoryInfo(FOLDER_TEMP)
|
|
||||||
' Get a reference to each file in that directory.
|
|
||||||
Dim fiArr As FileInfo() = di.GetFiles()
|
|
||||||
' Display the names of the files.
|
|
||||||
' Dim fri As FileInfo
|
|
||||||
Dim error_while_replacing = False
|
|
||||||
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
|
|
||||||
Dim BackUpOfFileToReplace As String = MY_INSTALL_PATH & "\" & Upd_item.Item("INFO1") & Upd_item.Item("ITEM_INFO") & ".bac"
|
|
||||||
BackUpOfFileToReplace = BackUpOfFileToReplace.Replace("//", "/")
|
|
||||||
|
|
||||||
Dim sourcefile = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
|
|
||||||
Dim targetfile
|
|
||||||
If IsDBNull(Upd_item.Item("INFO1")) Then
|
|
||||||
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
|
||||||
Else
|
|
||||||
If Upd_item.Item("INFO1") <> String.Empty Then
|
|
||||||
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
|
|
||||||
Else
|
|
||||||
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
targetfile = targetfile.ToString.Replace("//", "/")
|
|
||||||
Try
|
|
||||||
' Replace the file.
|
|
||||||
If File.Exists(targetfile) Then
|
|
||||||
If File_Rename(targetfile, BackUpOfFileToReplace) = True Then
|
|
||||||
If File.Exists(BackUpOfFileToReplace) Then
|
|
||||||
If MoveFile(sourcefile, targetfile) = True Then
|
|
||||||
File_Delete(BackUpOfFileToReplace)
|
|
||||||
Else
|
|
||||||
'Verschieben hat nicht geklappt also die Backupdatei wieder umbenennen!
|
|
||||||
File_Rename(BackUpOfFileToReplace, targetfile)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
MoveFile(sourcefile, targetfile)
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Catch ex As Exception
|
|
||||||
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, sourcefile, targetfile))
|
|
||||||
error_while_replacing = True
|
|
||||||
UPDATE_ERROR = True
|
|
||||||
End Try
|
|
||||||
|
|
||||||
Next
|
|
||||||
|
|
||||||
Catch ex As Exception
|
|
||||||
ClassLogger.Add(String.Format("Unexpected Error in Replace_Files: {0}", ex.Message))
|
|
||||||
UPDATE_ERROR = True
|
|
||||||
End Try
|
|
||||||
End Sub
|
|
||||||
Private Shared Function File_Rename(targetfile As String, Renamefilestring As String)
|
Private Shared Function File_Rename(targetfile As String, Renamefilestring As String)
|
||||||
Try
|
Try
|
||||||
Renamefilestring = Renamefilestring.Replace("\\", "\")
|
Renamefilestring = Renamefilestring.Replace("\\", "\")
|
||||||
@ -343,4 +382,14 @@ Public Class ClassUpdate
|
|||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
Private Shared Function CopyFile(sourcefile As String, destfile As String)
|
||||||
|
Try
|
||||||
|
File.Copy(sourcefile, destfile, True)
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
ClassLogger.Add(String.Format("Unexpected Error in CopyFile: sourcefile '{0}', destfile '{1}' - ERROR: {2}", sourcefile, destfile, ex.Message))
|
||||||
|
UPDATE_ERROR = True
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -13,8 +13,8 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyTitle("Digital Data - ADDI")>
|
<Assembly: AssemblyTitle("Digital Data - ADDI")>
|
||||||
<Assembly: AssemblyDescription("")>
|
<Assembly: AssemblyDescription("")>
|
||||||
<Assembly: AssemblyCompany("Digital Data")>
|
<Assembly: AssemblyCompany("Digital Data")>
|
||||||
<Assembly: AssemblyProduct("ADDI - Akte der Dinge")>
|
<Assembly: AssemblyProduct("ADDI - Akte der Dinge")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2015")>
|
<Assembly: AssemblyCopyright("Copyright © 2017")>
|
||||||
<Assembly: AssemblyTrademark("")>
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|||||||
@ -570,6 +570,16 @@ Public Class frmMain
|
|||||||
If result = MsgBoxResult.Yes Then
|
If result = MsgBoxResult.Yes Then
|
||||||
Process.Start(ClassLogger.DateiSpeicherort)
|
Process.Start(ClassLogger.DateiSpeicherort)
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
If ClassUpdate.UPDATE_NECESSARY Then
|
||||||
|
Dim msg = "Das Addon-Update war erfolgreich!"
|
||||||
|
If USER_LANGUAGE <> "de-DE" Then
|
||||||
|
msg = "The Addon-Update was successful!"
|
||||||
|
End If
|
||||||
|
MsgBox(msg, MsgBoxStyle.Information)
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|||||||
@ -32,4 +32,4 @@ Imports System.Runtime.InteropServices
|
|||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.2.0.0")>
|
<Assembly: AssemblyVersion("1.2.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
|
|||||||
@ -65,7 +65,7 @@ Public Class frmVersionCheck
|
|||||||
FORCE_UPDATE = True
|
FORCE_UPDATE = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
ClassLogger.Add("Using VersionChecker-Version: " & Application.ProductVersion.ToString, False)
|
ClassLogger.Add(" Using VersionChecker-Version: " & Application.ProductVersion.ToString, False)
|
||||||
If FORCE_UPDATE = False Then
|
If FORCE_UPDATE = False Then
|
||||||
myRow = 68
|
myRow = 68
|
||||||
If ALL_USERS = False Then
|
If ALL_USERS = False Then
|
||||||
@ -94,7 +94,7 @@ Public Class frmVersionCheck
|
|||||||
GetTempFolderGuid()
|
GetTempFolderGuid()
|
||||||
If FOLDER_TEMP <> String.Empty Then
|
If FOLDER_TEMP <> String.Empty Then
|
||||||
myRow = 94
|
myRow = 94
|
||||||
bw.ReportProgress(CalcProgress(5), "Copying files to tempfolder")
|
bw.ReportProgress(CalcProgress(5), "...Copying files to tempfolder")
|
||||||
' Make a reference to a directory.
|
' Make a reference to a directory.
|
||||||
Dim di As New DirectoryInfo(MyServer_UpdatePath)
|
Dim di As New DirectoryInfo(MyServer_UpdatePath)
|
||||||
' Get a reference to each file in that directory.
|
' Get a reference to each file in that directory.
|
||||||
@ -103,6 +103,7 @@ Public Class frmVersionCheck
|
|||||||
'Dim fri As FileInfo
|
'Dim fri As FileInfo
|
||||||
Dim error_while_copying = False
|
Dim error_while_copying = False
|
||||||
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
|
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
|
||||||
|
ClassLogger.Add(String.Format("...working on item '{0}': ", Upd_item.Item("ITEM_INFO")), False)
|
||||||
If error_while_copying = True Then
|
If error_while_copying = True Then
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@ -113,6 +114,7 @@ Public Class frmVersionCheck
|
|||||||
If File.Exists(updatefile2copy) Then
|
If File.Exists(updatefile2copy) Then
|
||||||
Try
|
Try
|
||||||
System.IO.File.Copy(updatefile2copy, tempfilename)
|
System.IO.File.Copy(updatefile2copy, tempfilename)
|
||||||
|
ClassLogger.Add(String.Format("...item '{0}' was successfully copied", updatefile2copy), False)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, updatefile2copy, tempfilename))
|
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, updatefile2copy, tempfilename))
|
||||||
error_while_copying = True
|
error_while_copying = True
|
||||||
@ -128,8 +130,21 @@ Public Class frmVersionCheck
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
Dim upd = String.Format("UPDATE TBDD_VERSION_USER_UPDATE_PATH SET TEMPPATH = '{0}' WHERE USER_ID = {1} AND UPPER(MODULE_NAME) = UPPER('{2}')", FOLDER_TEMP, USER_GUID, "Record-Organizer")
|
||||||
|
clsDatabase.Execute_Scalar(upd)
|
||||||
|
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
|
||||||
|
If IsDBNull(Upd_item.Item("INFO")) Then
|
||||||
|
Dim tempfilename = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
|
||||||
|
Try
|
||||||
|
System.IO.File.Delete(tempfilename)
|
||||||
|
Catch ex As Exception
|
||||||
|
ClassLogger.Add(String.Format("Unexpected Error in deleting tempfile '{0}': " & ex.Message, tempfilename))
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
Next
|
||||||
'Delete the tempfolder and all data
|
'Delete the tempfolder and all data
|
||||||
System.IO.Directory.Delete(FOLDER_TEMP, True)
|
' System.IO.Directory.Delete(FOLDER_TEMP, True)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
@ -155,7 +170,6 @@ Public Class frmVersionCheck
|
|||||||
End Sub
|
End Sub
|
||||||
Sub Replace_Files()
|
Sub Replace_Files()
|
||||||
Try
|
Try
|
||||||
|
|
||||||
'Jede Datei im tempfolder wird replaced
|
'Jede Datei im tempfolder wird replaced
|
||||||
Dim di As New DirectoryInfo(FOLDER_TEMP)
|
Dim di As New DirectoryInfo(FOLDER_TEMP)
|
||||||
' Get a reference to each file in that directory.
|
' Get a reference to each file in that directory.
|
||||||
@ -169,19 +183,21 @@ Public Class frmVersionCheck
|
|||||||
Dim sourcefile = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
|
Dim sourcefile = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
|
||||||
sourcefile = sourcefile.ToString.Replace("\\", "\")
|
sourcefile = sourcefile.ToString.Replace("\\", "\")
|
||||||
Dim targetfile
|
Dim targetfile
|
||||||
|
ClassLogger.Add(String.Format("...working (replacing) on item '{0}': ", Upd_item.Item("ITEM_INFO")), False)
|
||||||
If IsDBNull(Upd_item.Item("INFO1")) Then
|
If IsDBNull(Upd_item.Item("INFO1")) Then
|
||||||
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
||||||
Else
|
Else
|
||||||
If Upd_item.Item("INFO1") <> String.Empty Then
|
If Upd_item.Item("INFO1") = String.Empty Then
|
||||||
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
|
Continue For
|
||||||
Else
|
Else
|
||||||
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
|
||||||
|
' targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
targetfile = targetfile.ToString.Replace("\\", "\")
|
targetfile = targetfile.ToString.Replace("\\", "\")
|
||||||
Try
|
Try
|
||||||
' Replace the file.
|
'Replace the file.
|
||||||
If File.Exists(targetfile) Then
|
If File.Exists(targetfile) Then
|
||||||
If File_Rename(targetfile, BackUpOfFileToReplace) = True Then
|
If File_Rename(targetfile, BackUpOfFileToReplace) = True Then
|
||||||
If File.Exists(BackUpOfFileToReplace) Then
|
If File.Exists(BackUpOfFileToReplace) Then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user