Added import DB function
This commit is contained in:
parent
ef91f4c447
commit
00b9cc6ac5
32
ISEN-Repair Inventory Manager/Main.Designer.vb
generated
32
ISEN-Repair Inventory Manager/Main.Designer.vb
generated
@ -24,7 +24,9 @@ Partial Class Main
|
||||
Private Sub InitializeComponent()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Main))
|
||||
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
|
||||
Me.QuitterToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.AddComputerToolMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.EnleverPCsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.GénérerDesIDsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.DBToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.ImporterToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
@ -65,8 +67,6 @@ Partial Class Main
|
||||
Me.EditButton = New System.Windows.Forms.Button()
|
||||
Me.OpenBackupFile = New System.Windows.Forms.OpenFileDialog()
|
||||
Me.SaveBackupFile = New System.Windows.Forms.SaveFileDialog()
|
||||
Me.QuitterToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.EnleverPCsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.MenuStrip1.SuspendLayout()
|
||||
Me.StatusStrip1.SuspendLayout()
|
||||
Me.GroupBox1.SuspendLayout()
|
||||
@ -83,12 +83,24 @@ Partial Class Main
|
||||
Me.MenuStrip1.TabIndex = 0
|
||||
Me.MenuStrip1.Text = "MenuStrip1"
|
||||
'
|
||||
'QuitterToolStripMenuItem
|
||||
'
|
||||
Me.QuitterToolStripMenuItem.Name = "QuitterToolStripMenuItem"
|
||||
Me.QuitterToolStripMenuItem.Size = New System.Drawing.Size(56, 20)
|
||||
Me.QuitterToolStripMenuItem.Text = "Quitter"
|
||||
'
|
||||
'AddComputerToolMenuItem
|
||||
'
|
||||
Me.AddComputerToolMenuItem.Name = "AddComputerToolMenuItem"
|
||||
Me.AddComputerToolMenuItem.Size = New System.Drawing.Size(81, 20)
|
||||
Me.AddComputerToolMenuItem.Text = "Ajouter PCs"
|
||||
'
|
||||
'EnleverPCsToolStripMenuItem
|
||||
'
|
||||
Me.EnleverPCsToolStripMenuItem.Name = "EnleverPCsToolStripMenuItem"
|
||||
Me.EnleverPCsToolStripMenuItem.Size = New System.Drawing.Size(80, 20)
|
||||
Me.EnleverPCsToolStripMenuItem.Text = "Enlever PCs"
|
||||
'
|
||||
'GénérerDesIDsToolStripMenuItem
|
||||
'
|
||||
Me.GénérerDesIDsToolStripMenuItem.Name = "GénérerDesIDsToolStripMenuItem"
|
||||
@ -475,7 +487,9 @@ Partial Class Main
|
||||
'
|
||||
'OpenBackupFile
|
||||
'
|
||||
Me.OpenBackupFile.FileName = "OpenFileDialog1"
|
||||
Me.OpenBackupFile.DefaultExt = "sqlite"
|
||||
Me.OpenBackupFile.Filter = "Fichier SQLite|*.sqlite"
|
||||
Me.OpenBackupFile.Title = "Importer la DB"
|
||||
'
|
||||
'SaveBackupFile
|
||||
'
|
||||
@ -483,18 +497,6 @@ Partial Class Main
|
||||
Me.SaveBackupFile.Filter = "Fichier SQLite|*.sqlite"
|
||||
Me.SaveBackupFile.Title = "Exporter la DB"
|
||||
'
|
||||
'QuitterToolStripMenuItem
|
||||
'
|
||||
Me.QuitterToolStripMenuItem.Name = "QuitterToolStripMenuItem"
|
||||
Me.QuitterToolStripMenuItem.Size = New System.Drawing.Size(56, 20)
|
||||
Me.QuitterToolStripMenuItem.Text = "Quitter"
|
||||
'
|
||||
'EnleverPCsToolStripMenuItem
|
||||
'
|
||||
Me.EnleverPCsToolStripMenuItem.Name = "EnleverPCsToolStripMenuItem"
|
||||
Me.EnleverPCsToolStripMenuItem.Size = New System.Drawing.Size(80, 20)
|
||||
Me.EnleverPCsToolStripMenuItem.Text = "Enlever PCs"
|
||||
'
|
||||
'Main
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
|
@ -395,7 +395,7 @@ Public Class Main
|
||||
|
||||
Private Sub ExporterToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExporterToolStripMenuItem.Click
|
||||
SaveBackupFile.InitialDirectory() = GetFolderPath(SpecialFolder.Desktop)
|
||||
SaveBackupFile.FileName() = "invMan_" & DateTime.Now.ToString("yyyy-MM-dd") & ".sqlite"
|
||||
SaveBackupFile.FileName() = "invMan_" & DateTime.Now.ToString("yyyy-MM-dd_HH.mm") & ".sqlite"
|
||||
SaveBackupFile.ShowDialog()
|
||||
End Sub
|
||||
|
||||
@ -403,5 +403,23 @@ Public Class Main
|
||||
Using src As FileStream = File.Open(dbLocFile, FileMode.Open)
|
||||
src.CopyTo(SaveBackupFile.OpenFile)
|
||||
End Using
|
||||
log.Info("DB exporté avec succès")
|
||||
End Sub
|
||||
|
||||
Private Sub ImporterToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ImporterToolStripMenuItem.Click
|
||||
OpenBackupFile.InitialDirectory() = GetFolderPath(SpecialFolder.Desktop)
|
||||
OpenBackupFile.ShowDialog()
|
||||
End Sub
|
||||
|
||||
Private Sub OpenBackupFile_FileOk(sender As Object, e As CancelEventArgs) Handles OpenBackupFile.FileOk
|
||||
If My.Computer.FileSystem.FileExists(dbLocFile) Then
|
||||
If MsgBox("ATTENTION ! Ceci va écraser la base de donnée existante souhaitez-vous continuer ?", 292, "Overwrite") = 7 Then Exit Sub
|
||||
End If
|
||||
|
||||
Using dest As FileStream = File.Open(dbLocFile, FileMode.Create)
|
||||
OpenBackupFile.OpenFile.CopyTo(dest)
|
||||
End Using
|
||||
ListAllInv()
|
||||
log.Info("DB importé avec succès")
|
||||
End Sub
|
||||
End Class
|
||||
|
Reference in New Issue
Block a user