diff --git a/ISEN-Repair Inventory Manager/AddMachine.Designer.vb b/ISEN-Repair Inventory Manager/AddMachine.Designer.vb
index 871b10b..31b352d 100644
--- a/ISEN-Repair Inventory Manager/AddMachine.Designer.vb
+++ b/ISEN-Repair Inventory Manager/AddMachine.Designer.vb
@@ -27,7 +27,6 @@ Partial Class AddMachine
Me.NewIDBox = New System.Windows.Forms.TextBox()
Me.NewGivenByBox = New System.Windows.Forms.TextBox()
Me.Label8 = New System.Windows.Forms.Label()
- Me.NewEtatBox = New System.Windows.Forms.TextBox()
Me.NewSerieCheckBox = New System.Windows.Forms.CheckBox()
Me.NewDetailsBox = New System.Windows.Forms.TextBox()
Me.Label5 = New System.Windows.Forms.Label()
@@ -38,16 +37,17 @@ Partial Class AddMachine
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.AddCompCancelButton = New System.Windows.Forms.Button()
Me.AddComputerButton = New System.Windows.Forms.Button()
+ Me.NewEtatBox = New System.Windows.Forms.ComboBox()
Me.GroupBox2.SuspendLayout()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox2
'
+ Me.GroupBox2.Controls.Add(Me.NewEtatBox)
Me.GroupBox2.Controls.Add(Me.NewIDBox)
Me.GroupBox2.Controls.Add(Me.NewGivenByBox)
Me.GroupBox2.Controls.Add(Me.Label8)
- Me.GroupBox2.Controls.Add(Me.NewEtatBox)
Me.GroupBox2.Controls.Add(Me.NewSerieCheckBox)
Me.GroupBox2.Controls.Add(Me.NewDetailsBox)
Me.GroupBox2.Controls.Add(Me.Label5)
@@ -87,13 +87,6 @@ Partial Class AddMachine
Me.Label8.TabIndex = 15
Me.Label8.Text = "Provenance :"
'
- 'NewEtatBox
- '
- Me.NewEtatBox.Location = New System.Drawing.Point(37, 47)
- Me.NewEtatBox.Name = "NewEtatBox"
- Me.NewEtatBox.Size = New System.Drawing.Size(131, 20)
- Me.NewEtatBox.TabIndex = 1
- '
'NewSerieCheckBox
'
Me.NewSerieCheckBox.AutoSize = True
@@ -185,6 +178,15 @@ Partial Class AddMachine
Me.AddComputerButton.Text = "Ajouter"
Me.AddComputerButton.UseVisualStyleBackColor = True
'
+ 'NewEtatBox
+ '
+ Me.NewEtatBox.FormattingEnabled = True
+ Me.NewEtatBox.Items.AddRange(New Object() {"R.I.P", "Peut faire l'affaire", "En état", "Neuf"})
+ Me.NewEtatBox.Location = New System.Drawing.Point(45, 47)
+ Me.NewEtatBox.Name = "NewEtatBox"
+ Me.NewEtatBox.Size = New System.Drawing.Size(121, 21)
+ Me.NewEtatBox.TabIndex = 1
+ '
'AddMachine
'
Me.AcceptButton = Me.AddComputerButton
@@ -211,7 +213,6 @@ Partial Class AddMachine
Friend WithEvents GroupBox2 As GroupBox
Friend WithEvents NewGivenByBox As TextBox
Friend WithEvents Label8 As Label
- Friend WithEvents NewEtatBox As TextBox
Friend WithEvents NewSerieCheckBox As CheckBox
Friend WithEvents NewDetailsBox As TextBox
Friend WithEvents Label5 As Label
@@ -223,4 +224,5 @@ Partial Class AddMachine
Friend WithEvents NewIDBox As TextBox
Friend WithEvents AddCompCancelButton As Button
Friend WithEvents AddComputerButton As Button
+ Friend WithEvents NewEtatBox As ComboBox
End Class
diff --git a/ISEN-Repair Inventory Manager/AddMachine.vb b/ISEN-Repair Inventory Manager/AddMachine.vb
index 2e0c7eb..7ea89b6 100644
--- a/ISEN-Repair Inventory Manager/AddMachine.vb
+++ b/ISEN-Repair Inventory Manager/AddMachine.vb
@@ -1,4 +1,6 @@
-Public Class AddMachine
+Imports System.Data.SQLite
+
+Public Class AddMachine
Public Shared newID As String
Private Sub AddMachine_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@@ -9,9 +11,40 @@
NewIDBox.Text = newID
NewNameBox.Focus()
+ NewEtatBox.SelectedIndex = 0
End Sub
+ Private Function CheckToNumeric(control As CheckBox) As String
+ If control.Checked Then Return "1"
+ Return "0"
+ End Function
+
Private Sub AddCompCancelButton_Click(sender As Object, e As EventArgs) Handles AddCompCancelButton.Click
Me.Close()
End Sub
+
+ Private Sub AddComputerButton_Click(sender As Object, e As EventArgs) Handles AddComputerButton.Click
+ Dim addComputer_seq As String = "
+ INSERT INTO computers_desc VALUES ('" & NewIDBox.Text & "','" & NewNameBox.Text & "'," & NewEtatBox.SelectedIndex + 1 & "," & CheckToNumeric(NewSerieCheckBox) & ",'" & NewDetailsBox.Text & "',0,'N/A','" & NewGivenByBox.Text & "');
+ INSERT INTO computers_progress VALUES ('" & NewIDBox.Text & "',0,0,0,0,0,1,1,1);
+ "
+ If NewNameBox.Text = "" Then MsgBox("Vous ne pouvez pas laisser un nom vide !", 48, "Erreur de saisie") : Exit Sub
+ If NewDetailsBox.Text = "" Then NewDetailsBox.Text = "N/A"
+ If NewGivenByBox.Text = "" Then NewGivenByBox.Text = "N/A"
+ Try
+ Main.StatusLabel.Text = "Tentative d'ajout de l'ordinateur à la base de données..."
+ Using con As New SQLiteConnection("URI=file:db.sqlite")
+ con.Open()
+ Dim cmd As New SQLiteCommand(addComputer_seq, con)
+ If cmd.ExecuteNonQuery() <> 2 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
+ con.Close()
+ End Using
+ Main.StatusLabel.Text = "Ordinateur ajouté avec succés dans la base de données."
+ Main.ListAllInv()
+ Me.Close()
+ Catch ex As Exception
+ Main.StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
+ MsgBox(ex.Message)
+ End Try
+ End Sub
End Class
\ No newline at end of file
diff --git a/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj b/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj
index 6226edc..3ad12bf 100644
--- a/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj
+++ b/ISEN-Repair Inventory Manager/ISEN-Repair Inventory Manager.vbproj
@@ -57,6 +57,9 @@
JCS.pfx
+
+ false
+
diff --git a/ISEN-Repair Inventory Manager/Main.vb b/ISEN-Repair Inventory Manager/Main.vb
index 92a168b..a862f63 100644
--- a/ISEN-Repair Inventory Manager/Main.vb
+++ b/ISEN-Repair Inventory Manager/Main.vb
@@ -28,7 +28,7 @@ Public Class Main
`comms` TEXT NOT NULL DEFAULT 'N/A',
`gived` INTEGER NOT NULL DEFAULT 0,
`giveTo` TEXT NOT NULL DEFAULT 'N/A',
- `getBy` NUMERIC NOT NULL DEFAULT 'ISEN'
+ `getBy` TEXT NOT NULL DEFAULT 'ISEN'
);
CREATE TABLE `computers_progress` (
`id` TEXT NOT NULL DEFAULT 0000000000 UNIQUE,
@@ -62,9 +62,10 @@ Public Class Main
End Try
End Sub
- Private Sub ListAllInv()
+ Public Sub ListAllInv()
Dim dtr As SQLiteDataReader
+ InvList.Items.Clear()
InvList.ValueMember = "Equippements"
InvList.DisplayMember = "Nom"
Try
diff --git a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb
index b97f02a..56ed8a6 100644
--- a/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb
+++ b/ISEN-Repair Inventory Manager/My Project/AssemblyInfo.vb
@@ -9,8 +9,8 @@ Imports System.Runtime.InteropServices
' Vérifiez les valeurs des attributs de l'assembly
-
-
+
+
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' en utilisant '*', comme indiqué ci-dessous :
'
-
-
+
+