From f942cc62c3ea5d7c5888e53a6be8a12f288182a9 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 11 Oct 2017 19:51:13 +0200 Subject: [PATCH 01/10] Fixed migration files --- ISEN-Repair Inventory Manager/IDGenerator.vb | 2 ++ .../ISEN-Repair Inventory Manager.vbproj | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ISEN-Repair Inventory Manager/IDGenerator.vb b/ISEN-Repair Inventory Manager/IDGenerator.vb index 5df1095..ba4ff68 100644 --- a/ISEN-Repair Inventory Manager/IDGenerator.vb +++ b/ISEN-Repair Inventory Manager/IDGenerator.vb @@ -50,6 +50,8 @@ generate: End Sub Private Sub PreviewButton_Click(sender As Object, e As EventArgs) Handles PreviewButton.Click + 'TO DO: concevoir le template pour impression + PrintPreviewDialog1.ShowDialog() End Sub diff --git a/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj b/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj index 24567f4..c186cbb 100644 --- a/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj +++ b/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj @@ -26,7 +26,7 @@ false false true - https://jcs.bfnt.io/inv_manager/ + https://repo.jcs.bfnt.io/inv_manager/ fr ISEN-Repair Inventory Manager JCS%27s Production @@ -35,7 +35,7 @@ true index.htm false - 3 + 6 0.9.5.%2a false true @@ -91,7 +91,7 @@ true - D00CE50649372742555DAC702A1327003B99D37C + 620A13A82ECD693F86DBAEDE2FA8737A6A18D351 ISEN-Repair Inventory Manager_TemporaryKey.pfx From cf9a756dd90098ecb4d79e7a0c8c4089e0774585 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 11 Oct 2017 21:05:13 +0200 Subject: [PATCH 02/10] DB access prototype and fixed deleting issue --- .../ISEN-Repair Inventory Manager.vbproj | 4 ++-- ISEN-Repair Inventory Manager/Main.Designer.vb | 14 +++++++------- .../My Project/AssemblyInfo.vb | 4 ++-- ISEN-Repair Inventory Manager/SplashScreen.vb | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj b/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj index c186cbb..b8767e1 100644 --- a/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj +++ b/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj @@ -35,8 +35,8 @@ true index.htm false - 6 - 0.9.5.%2a + 3 + 0.10.1.3 false true true diff --git a/ISEN-Repair Inventory Manager/Main.Designer.vb b/ISEN-Repair Inventory Manager/Main.Designer.vb index c07f0b4..0b9e3af 100644 --- a/ISEN-Repair Inventory Manager/Main.Designer.vb +++ b/ISEN-Repair Inventory Manager/Main.Designer.vb @@ -26,6 +26,7 @@ Partial Class Main Me.MenuStrip1 = New System.Windows.Forms.MenuStrip() Me.AddComputerToolMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.GénérerDesIDsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.DBAccessToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.AboutToolMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() Me.StatusLabel = New System.Windows.Forms.ToolStripStatusLabel() @@ -60,7 +61,6 @@ Partial Class Main Me.OSBox = New System.Windows.Forms.TextBox() Me.ArchBox = New System.Windows.Forms.TextBox() Me.EditButton = New System.Windows.Forms.Button() - Me.DBAccessToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.MenuStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout() Me.GroupBox1.SuspendLayout() @@ -89,6 +89,12 @@ Partial Class Main Me.GénérerDesIDsToolStripMenuItem.Size = New System.Drawing.Size(100, 20) Me.GénérerDesIDsToolStripMenuItem.Text = "Générer des IDs" ' + 'DBAccessToolStripMenuItem + ' + Me.DBAccessToolStripMenuItem.Name = "DBAccessToolStripMenuItem" + Me.DBAccessToolStripMenuItem.Size = New System.Drawing.Size(73, 20) + Me.DBAccessToolStripMenuItem.Text = "DB Access" + ' 'AboutToolMenuItem ' Me.AboutToolMenuItem.Name = "AboutToolMenuItem" @@ -447,12 +453,6 @@ Partial Class Main Me.EditButton.Text = "Editer le suivi" Me.EditButton.UseVisualStyleBackColor = False ' - 'DBAccessToolStripMenuItem - ' - Me.DBAccessToolStripMenuItem.Name = "DBAccessToolStripMenuItem" - Me.DBAccessToolStripMenuItem.Size = New System.Drawing.Size(73, 20) - Me.DBAccessToolStripMenuItem.Text = "DB Access" - ' 'Main ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb index 9551450..88e5ad8 100644 --- a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb +++ b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' en utilisant '*', comme indiqué ci-dessous : ' - - + + diff --git a/ISEN-Repair Inventory Manager/SplashScreen.vb b/ISEN-Repair Inventory Manager/SplashScreen.vb index ae195b4..6ceaf67 100644 --- a/ISEN-Repair Inventory Manager/SplashScreen.vb +++ b/ISEN-Repair Inventory Manager/SplashScreen.vb @@ -20,7 +20,7 @@ ' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) - Version.Text = String.Format("Version {0}.{1}.{2}", My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.MajorRevision) + Version.Text = String.Format("Version {0}", My.Application.Info.Version) 'Informations de copyright Copyright.Text = My.Application.Info.Copyright From d7ff84d5ef9e28aeefeff1a9e90f1db0c758ac9b Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 11 Oct 2017 21:47:08 +0200 Subject: [PATCH 03/10] Added log entry for all catch error --- ISEN-Repair Inventory Manager/AddMachine.vb | 3 +++ ISEN-Repair Inventory Manager/Main.vb | 26 ++++++++++++++----- .../My Project/AssemblyInfo.vb | 4 +-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ISEN-Repair Inventory Manager/AddMachine.vb b/ISEN-Repair Inventory Manager/AddMachine.vb index bda5c5a..4e7ebab 100644 --- a/ISEN-Repair Inventory Manager/AddMachine.vb +++ b/ISEN-Repair Inventory Manager/AddMachine.vb @@ -42,9 +42,12 @@ Public Class AddMachine Main.log.Info("Computer " & NewIDBox.Text & " added") Main.StatusLabel.Text = "Ordinateur ajouté avec succés dans la base de données." Main.ListAllInv() + Main.log.Info("Added computer " & NewIDBox.Text & " with success !") Me.Close() Catch ex As Exception Main.StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !" + Main.log.Critical("Error has been occur when saving data to DB !") + Main.log.Critical(ex.Message) MsgBox(ex.Message) End Try End Sub diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb index 45d72f1..52a334e 100644 --- a/ISEN-Repair Inventory Manager/Main.vb +++ b/ISEN-Repair Inventory Manager/Main.vb @@ -53,7 +53,9 @@ Public Class Main Catch ex As Exception StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !" - MsgBox(ex.Message) + log.Critical("Error has been occur when connect to DB !") + log.Critical(ex.Message) + MsgBox("Error ! Check log file for details.") End Try Return True @@ -150,9 +152,12 @@ Public Class Main con.Close() End Using StatusLabel.Text = "La base SQLite a été reconstruite avec succès !" + log.Info("Base SQLite reconstructed.") Catch ex As Exception StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !" - MsgBox(ex.Message) + log.Critical("Error has been occur when reconstrut DB !") + log.Critical(ex.Message) + MsgBox("Error ! Check log file for details.") End Try End Sub @@ -184,7 +189,9 @@ Public Class Main StatusLabel.Text = "Récupération avec succés de la base SQLite." Catch ex As Exception StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !" - MsgBox(ex.Message) + log.Critical("Error has been occur when retrieve data from DB !") + log.Critical(ex.Message) + MsgBox("Error ! Check log file for details.") End Try End Sub @@ -257,7 +264,9 @@ Public Class Main End Using Catch ex As Exception StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !" - MsgBox(ex.Message) + log.Critical("Error has been occur when retrieve data from DB !") + log.Critical(ex.Message) + MsgBox("Error ! Check log file for details.") End Try End If End Sub @@ -326,7 +335,9 @@ Public Class Main If HWCheck.Checked And OSCheck.Checked And DrvCheck.Checked And SoftCheck.Checked And ActivateCheck.Checked Then SendOutButton.Enabled = True Else SendOutButton.Enabled = False Catch ex As Exception StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !" - MsgBox(ex.Message) + log.Critical("Error has been occur when retrieve data from DB !") + log.Critical(ex.Message) + MsgBox("Error ! Check log file for details.") End Try End Sub @@ -345,10 +356,13 @@ Public Class Main con.Close() End Using StatusLabel.Text = "Ordinateur supprimé avec succès !" + log.Info("Delete computer " & IDBox.Text & " with success !") ListAllInv() Catch ex As Exception StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !" - MsgBox(ex.Message) + log.Critical("Error has been occur when saving data to DB !") + log.Critical(ex.Message) + MsgBox("Error ! Check log file for details.") End Try End Sub diff --git a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb index 88e5ad8..4ae34b2 100644 --- a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb +++ b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' en utilisant '*', comme indiqué ci-dessous : ' - - + + From 6635225a8ddd16077f9cacdc69d69df08eb9cacb Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 15 Oct 2017 09:31:30 +0200 Subject: [PATCH 04/10] Updated Logger class --- ISEN-Repair Inventory Manager/Logger.vb | 2 +- ISEN-Repair Inventory Manager/Main.vb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ISEN-Repair Inventory Manager/Logger.vb b/ISEN-Repair Inventory Manager/Logger.vb index a3eefa2..5b2148a 100644 --- a/ISEN-Repair Inventory Manager/Logger.vb +++ b/ISEN-Repair Inventory Manager/Logger.vb @@ -7,7 +7,7 @@ Public Class Logger Public Sub Load() If Not My.Computer.FileSystem.DirectoryExists("logs") Then My.Computer.FileSystem.CreateDirectory("logs") - If Not My.Computer.FileSystem.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy"), "--------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Loading software"}) + If Not My.Computer.FileSystem.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"--------------------------------------------------------------", "------------------- LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy") & " -------------------", "--------------------------------------------------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Init software"}) End Sub Public Sub Info(str As String) diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb index 52a334e..3cc4874 100644 --- a/ISEN-Repair Inventory Manager/Main.vb +++ b/ISEN-Repair Inventory Manager/Main.vb @@ -3,7 +3,7 @@ Imports System.Text Imports System.IO Public Class Main - Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) + 'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Dim manualID_selected As Boolean = False Dim idList As New ArrayList @@ -11,6 +11,7 @@ Public Class Main Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load log.Load() + log.Info("Check and load of database") CheckIfFirstRun() ListAllInv() End Sub @@ -19,7 +20,6 @@ Public Class Main ''' Function to check if app is running for the first time ''' Private Sub CheckIfFirstRun() - log.Info("Check and load of database") If Not My.Computer.FileSystem.FileExists("db.sqlite") Then If MsgBox("La base de données SQLite est introuvable ou inaccessible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inaccessible") = 1 Then RegenerateDB() From b1d2bfc88abf5ae05f9a556ddda7dea6c3808b44 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 15 Oct 2017 10:26:07 +0200 Subject: [PATCH 05/10] Changed loc of datafiles into AppData/local/InvManager --- ...{Repair_pc_ids.txt => Repair_pc_ids.1.txt} | 0 BARCODE/Repair_pc_ids.2.txt | 30 +++++++++++++++++++ ISEN-Repair Inventory Manager/AddMachine.vb | 2 +- ISEN-Repair Inventory Manager/Logger.vb | 4 +-- ISEN-Repair Inventory Manager/Main.vb | 20 ++++++++----- .../My Project/AssemblyInfo.vb | 4 +-- 6 files changed, 47 insertions(+), 13 deletions(-) rename BARCODE/{Repair_pc_ids.txt => Repair_pc_ids.1.txt} (100%) create mode 100644 BARCODE/Repair_pc_ids.2.txt diff --git a/BARCODE/Repair_pc_ids.txt b/BARCODE/Repair_pc_ids.1.txt similarity index 100% rename from BARCODE/Repair_pc_ids.txt rename to BARCODE/Repair_pc_ids.1.txt diff --git a/BARCODE/Repair_pc_ids.2.txt b/BARCODE/Repair_pc_ids.2.txt new file mode 100644 index 0000000..e9ab0ce --- /dev/null +++ b/BARCODE/Repair_pc_ids.2.txt @@ -0,0 +1,30 @@ +1463671755 +7020175153 +5404717746 +3296685637 +0736311783 +9076156940 +5837970452 +4352106486 +9547078358 +1798072890 +1389587524 +3541155156 +8190600237 +2774273532 +4811090670 +1317029903 +6191218542 +6626901383 +0898950400 +2743029532 +9237839921 +4168614523 +9812526007 +2588574302 +1200837449 +8481657818 +4044723385 +8222876041 +0008935301 +0061659415 diff --git a/ISEN-Repair Inventory Manager/AddMachine.vb b/ISEN-Repair Inventory Manager/AddMachine.vb index 4e7ebab..0c982ab 100644 --- a/ISEN-Repair Inventory Manager/AddMachine.vb +++ b/ISEN-Repair Inventory Manager/AddMachine.vb @@ -30,7 +30,7 @@ Public Class AddMachine Try Main.StatusLabel.Text = "Tentative d'ajout de l'ordinateur à la base de données..." - Using con As New SQLiteConnection("URI=file:db.sqlite") + Using con As New SQLiteConnection("URI=file:" & Main.dbLocFile) con.Open() Dim cmd As New SQLiteCommand(con) cmd.CommandText = "INSERT INTO computers_desc VALUES ('" & NewIDBox.Text & "','" & NewNameBox.Text & "'," & NewEtatBox.SelectedIndex & "," & CheckToNumeric(NewSerieCheckBox) & ",'" & Replace(NewDetailsBox.Text, "'", "_*_") & "',0,'N/A','" & NewGivenByBox.Text & "');" diff --git a/ISEN-Repair Inventory Manager/Logger.vb b/ISEN-Repair Inventory Manager/Logger.vb index 5b2148a..9ae62a3 100644 --- a/ISEN-Repair Inventory Manager/Logger.vb +++ b/ISEN-Repair Inventory Manager/Logger.vb @@ -3,10 +3,10 @@ Public Class Logger 'DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") - Dim logFileName As String = "logs\" & DateTime.Now.ToString("yyyy-MM-dd") & ".txt" + Dim logFileName As String = Main.localAppData & "logs\" & DateTime.Now.ToString("yyyy-MM-dd") & ".txt" Public Sub Load() - If Not My.Computer.FileSystem.DirectoryExists("logs") Then My.Computer.FileSystem.CreateDirectory("logs") + If Not My.Computer.FileSystem.DirectoryExists(Main.localAppData & "logs") Then My.Computer.FileSystem.CreateDirectory(Main.localAppData & "logs") If Not My.Computer.FileSystem.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"--------------------------------------------------------------", "------------------- LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy") & " -------------------", "--------------------------------------------------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Init software"}) End Sub diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb index 3cc4874..5e5a7ff 100644 --- a/ISEN-Repair Inventory Manager/Main.vb +++ b/ISEN-Repair Inventory Manager/Main.vb @@ -1,6 +1,7 @@ Imports System.Data.SQLite Imports System.Text Imports System.IO +Imports System.Environment Public Class Main 'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) @@ -8,6 +9,8 @@ Public Class Main Dim manualID_selected As Boolean = False Dim idList As New ArrayList Public log As New Logger + Public Shared localAppData As String = GetFolderPath(SpecialFolder.LocalApplicationData) & "\InvManager\" + Public Shared dbLocFile As String = localAppData & "db.sqlite" Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load log.Load() @@ -20,7 +23,8 @@ Public Class Main ''' Function to check if app is running for the first time ''' Private Sub CheckIfFirstRun() - If Not My.Computer.FileSystem.FileExists("db.sqlite") Then + If Not My.Computer.FileSystem.DirectoryExists(localAppData) Then My.Computer.FileSystem.CreateDirectory(localAppData) + If Not My.Computer.FileSystem.FileExists(dbLocFile) Then If MsgBox("La base de données SQLite est introuvable ou inaccessible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inaccessible") = 1 Then RegenerateDB() Else @@ -38,7 +42,7 @@ Public Class Main Dim dtr As SQLiteDataReader Try - Using con As New SQLiteConnection("URI=file:db.sqlite") + Using con As New SQLiteConnection("URI=file:" & dbLocFile) con.Open() Using cmd As New SQLiteCommand(con) cmd.CommandText = "SELECT * FROM computers_desc WHERE id=" & idToCheck & ";" @@ -145,7 +149,7 @@ Public Class Main Try StatusLabel.Text = "Reconstructions de la base SQLite..." - Using con As New SQLiteConnection("URI=file:db.sqlite") + Using con As New SQLiteConnection("URI=file:" & dbLocFile) con.Open() Dim cmd As New SQLiteCommand(genesis_seq, con) cmd.ExecuteNonQuery() @@ -173,7 +177,7 @@ Public Class Main InvList.DisplayMember = "Nom" Try StatusLabel.Text = "Récupération des données depuis la base SQLite..." - Using con As New SQLiteConnection("URI=file:db.sqlite") + Using con As New SQLiteConnection("URI=file:" & dbLocFile) con.Open() Using cmd As New SQLiteCommand(con) cmd.CommandText = "SELECT id,name FROM computers_desc;" @@ -229,7 +233,7 @@ Public Class Main Dim dtr As SQLiteDataReader Try - Using con As New SQLiteConnection("URI=file:db.sqlite") + Using con As New SQLiteConnection("URI=file:" & dbLocFile) con.Open() Using cmd As New SQLiteCommand(con) cmd.CommandText = "SELECT * FROM computers_desc WHERE id='" & IDBox.Text & "';" @@ -279,7 +283,7 @@ Public Class Main Dim dtr As SQLiteDataReader Try - Using con As New SQLiteConnection("URI=file:db.sqlite") + Using con As New SQLiteConnection("URI=file:" & dbLocFile) con.Open() Using cmd As New SQLiteCommand(con) cmd.CommandText = "SELECT * FROM computers_progress WHERE id='" & machineID & "';" @@ -346,7 +350,7 @@ Public Class Main Try StatusLabel.Text = "Supression d'un ordinateur de la base de données..." - Using con As New SQLiteConnection("URI=file:db.sqlite") + Using con As New SQLiteConnection("URI=file:" & dbLocFile) con.Open() Dim cmd As New SQLiteCommand(con) cmd.CommandText = "DELETE FROM computers_desc WHERE id='" & IDBox.Text & "';" @@ -391,7 +395,7 @@ Public Class Main Private Sub DBAccessToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DBAccessToolStripMenuItem.Click Dim p As New ProcessStartInfo p.FileName = "explorer.exe" - p.Arguments = Directory.GetCurrentDirectory + p.Arguments = localAppData p.UseShellExecute = False Process.Start(p) End Sub diff --git a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb index 4ae34b2..b73f933 100644 --- a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb +++ b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' en utilisant '*', comme indiqué ci-dessous : ' - - + + From ef91f4c447faf047c5bd94823951950d3b0a4623 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 15 Oct 2017 11:20:15 +0200 Subject: [PATCH 06/10] Added export DB function --- .../Main.Designer.vb | 66 ++++++++++++++++--- ISEN-Repair Inventory Manager/Main.resx | 6 ++ ISEN-Repair Inventory Manager/Main.vb | 17 +++-- 3 files changed, 74 insertions(+), 15 deletions(-) diff --git a/ISEN-Repair Inventory Manager/Main.Designer.vb b/ISEN-Repair Inventory Manager/Main.Designer.vb index 0b9e3af..cd66ecf 100644 --- a/ISEN-Repair Inventory Manager/Main.Designer.vb +++ b/ISEN-Repair Inventory Manager/Main.Designer.vb @@ -26,7 +26,9 @@ Partial Class Main Me.MenuStrip1 = New System.Windows.Forms.MenuStrip() Me.AddComputerToolMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.GénérerDesIDsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.DBAccessToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.DBToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.ImporterToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.ExporterToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.AboutToolMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() Me.StatusLabel = New System.Windows.Forms.ToolStripStatusLabel() @@ -61,6 +63,10 @@ Partial Class Main Me.OSBox = New System.Windows.Forms.TextBox() Me.ArchBox = New System.Windows.Forms.TextBox() 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() @@ -70,7 +76,7 @@ Partial Class Main ' 'MenuStrip1 ' - Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AddComputerToolMenuItem, Me.GénérerDesIDsToolStripMenuItem, Me.DBAccessToolStripMenuItem, Me.AboutToolMenuItem}) + Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.QuitterToolStripMenuItem, Me.AddComputerToolMenuItem, Me.EnleverPCsToolStripMenuItem, Me.GénérerDesIDsToolStripMenuItem, Me.DBToolStripMenuItem, Me.AboutToolMenuItem}) Me.MenuStrip1.Location = New System.Drawing.Point(0, 0) Me.MenuStrip1.Name = "MenuStrip1" Me.MenuStrip1.Size = New System.Drawing.Size(874, 24) @@ -80,8 +86,8 @@ Partial Class Main 'AddComputerToolMenuItem ' Me.AddComputerToolMenuItem.Name = "AddComputerToolMenuItem" - Me.AddComputerToolMenuItem.Size = New System.Drawing.Size(93, 20) - Me.AddComputerToolMenuItem.Text = "Ajouter un PC" + Me.AddComputerToolMenuItem.Size = New System.Drawing.Size(81, 20) + Me.AddComputerToolMenuItem.Text = "Ajouter PCs" ' 'GénérerDesIDsToolStripMenuItem ' @@ -89,11 +95,25 @@ Partial Class Main Me.GénérerDesIDsToolStripMenuItem.Size = New System.Drawing.Size(100, 20) Me.GénérerDesIDsToolStripMenuItem.Text = "Générer des IDs" ' - 'DBAccessToolStripMenuItem + 'DBToolStripMenuItem ' - Me.DBAccessToolStripMenuItem.Name = "DBAccessToolStripMenuItem" - Me.DBAccessToolStripMenuItem.Size = New System.Drawing.Size(73, 20) - Me.DBAccessToolStripMenuItem.Text = "DB Access" + Me.DBToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ImporterToolStripMenuItem, Me.ExporterToolStripMenuItem}) + Me.DBToolStripMenuItem.Name = "DBToolStripMenuItem" + Me.DBToolStripMenuItem.Size = New System.Drawing.Size(34, 20) + Me.DBToolStripMenuItem.Text = "DB" + Me.DBToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.BottomCenter + ' + 'ImporterToolStripMenuItem + ' + Me.ImporterToolStripMenuItem.Name = "ImporterToolStripMenuItem" + Me.ImporterToolStripMenuItem.Size = New System.Drawing.Size(120, 22) + Me.ImporterToolStripMenuItem.Text = "Importer" + ' + 'ExporterToolStripMenuItem + ' + Me.ExporterToolStripMenuItem.Name = "ExporterToolStripMenuItem" + Me.ExporterToolStripMenuItem.Size = New System.Drawing.Size(120, 22) + Me.ExporterToolStripMenuItem.Text = "Exporter" ' 'AboutToolMenuItem ' @@ -453,6 +473,28 @@ Partial Class Main Me.EditButton.Text = "Editer le suivi" Me.EditButton.UseVisualStyleBackColor = False ' + 'OpenBackupFile + ' + Me.OpenBackupFile.FileName = "OpenFileDialog1" + ' + 'SaveBackupFile + ' + Me.SaveBackupFile.DefaultExt = "sqlite" + 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!) @@ -525,5 +567,11 @@ Partial Class Main Friend WithEvents IDBox As MaskedTextBox Private WithEvents AddComputerToolMenuItem As ToolStripMenuItem Friend WithEvents GénérerDesIDsToolStripMenuItem As ToolStripMenuItem - Friend WithEvents DBAccessToolStripMenuItem As ToolStripMenuItem + Friend WithEvents DBToolStripMenuItem As ToolStripMenuItem + Friend WithEvents OpenBackupFile As OpenFileDialog + Friend WithEvents SaveBackupFile As SaveFileDialog + Friend WithEvents ImporterToolStripMenuItem As ToolStripMenuItem + Friend WithEvents ExporterToolStripMenuItem As ToolStripMenuItem + Friend WithEvents QuitterToolStripMenuItem As ToolStripMenuItem + Friend WithEvents EnleverPCsToolStripMenuItem As ToolStripMenuItem End Class diff --git a/ISEN-Repair Inventory Manager/Main.resx b/ISEN-Repair Inventory Manager/Main.resx index 0c4bbcd..de66c5d 100644 --- a/ISEN-Repair Inventory Manager/Main.resx +++ b/ISEN-Repair Inventory Manager/Main.resx @@ -123,6 +123,12 @@ 132, 17 + + 249, 17 + + + 389, 17 + True diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb index 5e5a7ff..7017853 100644 --- a/ISEN-Repair Inventory Manager/Main.vb +++ b/ISEN-Repair Inventory Manager/Main.vb @@ -2,6 +2,7 @@ Imports System.Text Imports System.IO Imports System.Environment +Imports System.ComponentModel Public Class Main 'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) @@ -392,11 +393,15 @@ Public Class Main IDBox.Text = tempStor End Sub - Private Sub DBAccessToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DBAccessToolStripMenuItem.Click - Dim p As New ProcessStartInfo - p.FileName = "explorer.exe" - p.Arguments = localAppData - p.UseShellExecute = False - Process.Start(p) + 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.ShowDialog() + End Sub + + Private Sub SaveBackupFile_FileOk(sender As Object, e As CancelEventArgs) Handles SaveBackupFile.FileOk + Using src As FileStream = File.Open(dbLocFile, FileMode.Open) + src.CopyTo(SaveBackupFile.OpenFile) + End Using End Sub End Class From 00b9cc6ac533190e4640346de3b6bdfcbd098526 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 15 Oct 2017 12:13:01 +0200 Subject: [PATCH 07/10] Added import DB function --- .../Main.Designer.vb | 32 ++++++++++--------- ISEN-Repair Inventory Manager/Main.vb | 20 +++++++++++- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/ISEN-Repair Inventory Manager/Main.Designer.vb b/ISEN-Repair Inventory Manager/Main.Designer.vb index cd66ecf..99b2842 100644 --- a/ISEN-Repair Inventory Manager/Main.Designer.vb +++ b/ISEN-Repair Inventory Manager/Main.Designer.vb @@ -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!) diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb index 7017853..1a48376 100644 --- a/ISEN-Repair Inventory Manager/Main.vb +++ b/ISEN-Repair Inventory Manager/Main.vb @@ -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 From afaadf6d53c4c6b37540ab7354fade4c7d7dabf8 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 15 Oct 2017 12:22:54 +0200 Subject: [PATCH 08/10] Added backup function to quit button --- ISEN-Repair Inventory Manager/Main.vb | 9 +++++++++ ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb index 1a48376..3302a78 100644 --- a/ISEN-Repair Inventory Manager/Main.vb +++ b/ISEN-Repair Inventory Manager/Main.vb @@ -422,4 +422,13 @@ Public Class Main ListAllInv() log.Info("DB importé avec succès") End Sub + + Private Sub QuitterToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles QuitterToolStripMenuItem.Click + If MsgBox("Souhaitez-vous faire une backup de la DB ?", 292, "Backup") = 7 Then End + + If Not My.Computer.FileSystem.DirectoryExists(localAppData & "backups") Then My.Computer.FileSystem.CreateDirectory(localAppData & "backups") + File.Copy(dbLocFile, localAppData & "backups\" & DateTime.Now.ToString("yyyy-MM-dd_HH.mm") & ".sqlite") + log.Info("Backup de la DB") + End + End Sub End Class diff --git a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb index b73f933..fe903aa 100644 --- a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb +++ b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' en utilisant '*', comme indiqué ci-dessous : ' - - + + From 2b29b785e0be2a0b2f6c5558865a4a2ba197ea51 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 15 Oct 2017 12:23:13 +0200 Subject: [PATCH 09/10] Updated version display on splash and about screen --- ISEN-Repair Inventory Manager/About.vb | 2 +- ISEN-Repair Inventory Manager/SplashScreen.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ISEN-Repair Inventory Manager/About.vb b/ISEN-Repair Inventory Manager/About.vb index 0fcfe28..a783039 100644 --- a/ISEN-Repair Inventory Manager/About.vb +++ b/ISEN-Repair Inventory Manager/About.vb @@ -13,7 +13,7 @@ ' TODO: personnalisez les informations d'assembly de l'application dans le volet "Application" de la ' boîte de dialogue Propriétés du projet (sous le menu "Projet"). Me.LabelProductName.Text = My.Application.Info.ProductName - Me.LabelVersion.Text = String.Format("Version {0}.{1}", My.Application.Info.Version.Major, My.Application.Info.Version.Minor) + Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Info.Version) Me.LabelCopyright.Text = My.Application.Info.Copyright Me.LabelCompanyName.Text = My.Application.Info.CompanyName Me.TextBoxDescription.Text = My.Application.Info.Description diff --git a/ISEN-Repair Inventory Manager/SplashScreen.vb b/ISEN-Repair Inventory Manager/SplashScreen.vb index 6ceaf67..13f379f 100644 --- a/ISEN-Repair Inventory Manager/SplashScreen.vb +++ b/ISEN-Repair Inventory Manager/SplashScreen.vb @@ -20,7 +20,7 @@ ' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) - Version.Text = String.Format("Version {0}", My.Application.Info.Version) + Version.Text = String.Format("Version {0}.{1}", My.Application.Info.Version.Major, My.Application.Info.Version.Minor) 'Informations de copyright Copyright.Text = My.Application.Info.Copyright From d7febf3199a496e763a2f1fba418af069b6c6ccd Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 15 Oct 2017 12:27:56 +0200 Subject: [PATCH 10/10] Fixed wrong name for backup --- ISEN-Repair Inventory Manager/Main.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb index 3302a78..296d4a1 100644 --- a/ISEN-Repair Inventory Manager/Main.vb +++ b/ISEN-Repair Inventory Manager/Main.vb @@ -427,7 +427,7 @@ Public Class Main If MsgBox("Souhaitez-vous faire une backup de la DB ?", 292, "Backup") = 7 Then End If Not My.Computer.FileSystem.DirectoryExists(localAppData & "backups") Then My.Computer.FileSystem.CreateDirectory(localAppData & "backups") - File.Copy(dbLocFile, localAppData & "backups\" & DateTime.Now.ToString("yyyy-MM-dd_HH.mm") & ".sqlite") + File.Copy(dbLocFile, localAppData & "backups\db_" & DateTime.Now.ToString("yyyy-MM-dd_HH.mm") & ".bck") log.Info("Backup de la DB") End End Sub