1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Friend Sub ImportDB(ByVal sourceFile As String, ByVal displayWarningMessage As Boolean)
If displayWarningMessage Then
If MsgBox(master.getTrans("Mod_fileManager.ImportDB.msgbox.warningMessage.message"), MsgBoxStyle.YesNo, master.getTrans("Mod_fileManager.ImportDB.msgbox.warningMessage.title")) = MsgBoxResult.No Then
Exit Sub
End If
Else
End If
Dim bakFile As String = workDBDirPath & "Pharmanager.bak"
Try
'creates a backup of the database in the working directory
FileIO.FileSystem.CopyFile(WorkDbFullPath, bakFile, True)
'replaces the working database by the imported one
FileIO.FileSystem.CopyFile(sourceFile, WorkDbFullPath, True)
master.displayMessage(mainform.statusLabel, "common.messages.DBImportSuccess", 0)
master.fillDA()
mainform.initMainForm()
Catch ex As Exception
master.displayMessage(mainform.statusLabel, "common.messages.DBImportError", 1)
master.log(ex, 2)
End Try
End Sub |
Partager