EXG , Datenserver move
This commit is contained in:
@@ -192,51 +192,80 @@ Public Class cDATENSERVER
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Function moveTo_ARCHIVARCHIV()
|
||||
Dim oldDIR = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
|
||||
|
||||
|
||||
Function moveTo_ARCHIVARCHIV() As Boolean
|
||||
Dim oldDIR = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
|
||||
Dim newDIR = DATENVERVER_OPTIONS.getDescPath(rootDirARCHIVARCHIV, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
|
||||
|
||||
Try
|
||||
' My.Computer.FileSystem.RenameDirectory(oldDIR, newname)
|
||||
Dim hasErrors As Boolean = False
|
||||
Dim oldBase = System.IO.Path.GetFullPath(oldDIR).TrimEnd("\"c) & "\"
|
||||
Dim newBase = System.IO.Path.GetFullPath(newDIR).TrimEnd("\"c) & "\"
|
||||
Dim createdDirectories As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase)
|
||||
|
||||
For Each li In DATA_LIST.LIST
|
||||
Dim alterPfad As String = li.coll_pfad
|
||||
|
||||
|
||||
Dim newPfad = li.coll_pfad.Replace(oldDIR, newDIR)
|
||||
'MsgBox(li.coll_pfad)
|
||||
' MsgBox(newPfad)
|
||||
If Not System.IO.Directory.Exists(newDIR) Then System.IO.Directory.CreateDirectory(newDIR)
|
||||
Try
|
||||
If Not li.coll_pfad.ToLower.StartsWith("\\stor01.verag.ost.dmn\datenarchivarchiv") Then
|
||||
If Not li.coll_pfad.Contains("?") Then
|
||||
If System.IO.File.Exists(li.coll_pfad) Then
|
||||
My.Computer.FileSystem.CopyFile(li.coll_pfad, newPfad, True)
|
||||
My.Computer.FileSystem.DeleteFile(li.coll_pfad)
|
||||
li.coll_pfad = newPfad
|
||||
If Not li.UPDATE() Then
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
'Datei Existiert nicht!
|
||||
li.coll_pfad = li.coll_pfad.Replace("\\datenarchiv.verag.ost.dmn\", "\\DELETED\")
|
||||
If Not li.UPDATE() Then
|
||||
Return False
|
||||
End If
|
||||
If String.IsNullOrWhiteSpace(alterPfad) Then Continue For
|
||||
If alterPfad.StartsWith("\\stor01.verag.ost.dmn\datenarchivarchiv\", StringComparison.OrdinalIgnoreCase) Then Continue For
|
||||
If alterPfad.StartsWith("\\DELETED\", StringComparison.OrdinalIgnoreCase) Then Continue For
|
||||
If alterPfad.Contains("?") Then Continue For
|
||||
|
||||
If System.IO.File.Exists(alterPfad) Then
|
||||
Dim fullPath = System.IO.Path.GetFullPath(alterPfad)
|
||||
|
||||
If Not fullPath.StartsWith(oldBase, StringComparison.OrdinalIgnoreCase) Then
|
||||
Throw New Exception("Datei liegt nicht im Quellverzeichnis: " & alterPfad)
|
||||
End If
|
||||
|
||||
Dim newPfad = newBase & fullPath.Substring(oldBase.Length)
|
||||
Dim zielOrdner = System.IO.Path.GetDirectoryName(newPfad)
|
||||
|
||||
If createdDirectories.Add(zielOrdner) Then
|
||||
System.IO.Directory.CreateDirectory(zielOrdner)
|
||||
End If
|
||||
|
||||
System.IO.File.Copy(alterPfad, newPfad, True)
|
||||
|
||||
li.coll_pfad = newPfad
|
||||
|
||||
If Not li.UPDATE() Then
|
||||
li.coll_pfad = alterPfad
|
||||
Throw New Exception("Datenbankupdate fehlgeschlagen: " & alterPfad)
|
||||
End If
|
||||
|
||||
System.IO.File.Delete(alterPfad)
|
||||
Else
|
||||
li.coll_pfad = alterPfad.Replace("\\datenarchiv.verag.ost.dmn\", "\\DELETED\")
|
||||
|
||||
If li.coll_pfad <> alterPfad Then
|
||||
If Not li.UPDATE() Then
|
||||
li.coll_pfad = alterPfad
|
||||
Throw New Exception("Datenbankupdate fehlgeschlagen: " & alterPfad)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex2 As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex2.Message, li.coll_pfad & vbNewLine & newPfad & vbNewLine & vbNewLine & ex2.Message & vbNewLine & ex2.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
hasErrors = True
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex2.Message, alterPfad & vbNewLine & ex2.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Next
|
||||
Return UPDATE()
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, "Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
|
||||
If hasErrors Then Return False
|
||||
|
||||
Return UPDATE()
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
|
||||
Function UPDATE() As Boolean
|
||||
Try
|
||||
'If coll_id < 0 Then 'Wenn noch keine ID vergeben
|
||||
|
||||
@@ -24,7 +24,6 @@ Partial Class frmMessenger
|
||||
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
@@ -39,12 +38,12 @@ Partial Class frmMessenger
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMessenger))
|
||||
Me.SplitContainer = New System.Windows.Forms.SplitContainer()
|
||||
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer()
|
||||
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
|
||||
Me.Panel6 = New System.Windows.Forms.Panel()
|
||||
Me.Label3 = New System.Windows.Forms.Label()
|
||||
Me.lblLKWChat_MsgCntInaktiv = New System.Windows.Forms.Label()
|
||||
Me.cbxInaktiveChats = New System.Windows.Forms.CheckBox()
|
||||
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
|
||||
Me.Panel5 = New System.Windows.Forms.Panel()
|
||||
Me.MyTextBox2 = New VERAG_PROG_ALLGEMEIN.MyTextBox()
|
||||
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
|
||||
@@ -65,7 +64,7 @@ Partial Class frmMessenger
|
||||
Me.btnNeu = New System.Windows.Forms.Button()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
|
||||
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel(Me.components)
|
||||
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel()
|
||||
Me.UsrCntlMessenger_ChatElement1 = New VERAG_PROG_ALLGEMEIN.usrCntlMessenger_ChatElement()
|
||||
Me.Panel3 = New System.Windows.Forms.Panel()
|
||||
Me.btnTeilnehmer = New System.Windows.Forms.Button()
|
||||
@@ -93,9 +92,9 @@ Partial Class frmMessenger
|
||||
Me.btnSendAtt = New System.Windows.Forms.Button()
|
||||
Me.btnSenden = New System.Windows.Forms.Button()
|
||||
Me.rtbChatMessage = New System.Windows.Forms.RichTextBox()
|
||||
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer(Me.components)
|
||||
Me.Timer_REFRESH = New System.Windows.Forms.Timer(Me.components)
|
||||
Me.cntxt = New System.Windows.Forms.ContextMenuStrip(Me.components)
|
||||
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer()
|
||||
Me.Timer_REFRESH = New System.Windows.Forms.Timer()
|
||||
Me.cntxt = New System.Windows.Forms.ContextMenuStrip()
|
||||
Me.ChatDeaktivierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.toolChatReminder = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
|
||||
|
||||
Reference in New Issue
Block a user