Add progress loading from db

This commit is contained in:
JackCarterSmith 2017-05-30 20:24:15 +02:00
parent e9f22639d0
commit e5051a4a33
4 changed files with 148 additions and 83 deletions

View File

@ -2,6 +2,17 @@
Public Shared newID As Integer
Private Sub AddMachine_2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'If HWCheck.Checked And OSCheck.Checked And DrvCheck.Checked And ActivateCheck.Checked Then SoftCheck.Enabled = True Else SoftCheck.Enabled = False
'If HWCheck.Checked And OSCheck.Checked And DrvCheck.Checked Then
'ActivateCheck.Enabled = True
'OS.Enabled = True
'Else
'ActivateCheck.Enabled = False
'OS.Enabled = False
'End If
'If HWCheck.Checked And OSCheck.Checked Then DrvCheck.Enabled = True Else DrvCheck.Enabled = False
'If HWCheck.Checked Then OSCheck.Enabled = True Else OSCheck.Enabled = False
Dim addMachine_IdForm As AddMachine_ID
addMachine_IdForm = New AddMachine_ID()
addMachine_IdForm.Show()

View File

@ -35,7 +35,6 @@ Partial Class Main
Me.TrashButton = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.NameBox = New System.Windows.Forms.TextBox()
Me.Label5 = New System.Windows.Forms.Label()
@ -47,7 +46,6 @@ Partial Class Main
Me.IDBox = New System.Windows.Forms.MaskedTextBox()
Me.GivenByBox = New System.Windows.Forms.TextBox()
Me.Label8 = New System.Windows.Forms.Label()
Me.TypeComBox = New System.Windows.Forms.TextBox()
Me.EtatBox = New System.Windows.Forms.TextBox()
Me.HWCheck = New System.Windows.Forms.CheckBox()
Me.OSCheck = New System.Windows.Forms.CheckBox()
@ -57,10 +55,10 @@ Partial Class Main
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.Mem = New System.Windows.Forms.TextBox()
Me.MemBox = New System.Windows.Forms.TextBox()
Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.OS = New System.Windows.Forms.TextBox()
Me.Arch = New System.Windows.Forms.TextBox()
Me.OSBox = New System.Windows.Forms.TextBox()
Me.ArchBox = New System.Windows.Forms.TextBox()
Me.EditButton = New System.Windows.Forms.Button()
Me.MenuStrip1.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
@ -171,23 +169,14 @@ Partial Class Main
Me.Label2.TabIndex = 2
Me.Label2.Text = "Nom :"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(7, 47)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(37, 13)
Me.Label3.TabIndex = 3
Me.Label3.Text = "Type :"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(7, 80)
Me.Label4.Location = New System.Drawing.Point(58, 80)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(79, 13)
Me.Label4.Size = New System.Drawing.Size(45, 13)
Me.Label4.TabIndex = 4
Me.Label4.Text = "Commentaires :"
Me.Label4.Text = "Détails :"
'
'NameBox
'
@ -201,7 +190,7 @@ Partial Class Main
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(262, 47)
Me.Label5.Location = New System.Drawing.Point(7, 50)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(32, 13)
Me.Label5.TabIndex = 6
@ -209,12 +198,12 @@ Partial Class Main
'
'DetailsBox
'
Me.DetailsBox.Location = New System.Drawing.Point(92, 77)
Me.DetailsBox.Location = New System.Drawing.Point(109, 77)
Me.DetailsBox.Multiline = True
Me.DetailsBox.Name = "DetailsBox"
Me.DetailsBox.ReadOnly = True
Me.DetailsBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.DetailsBox.Size = New System.Drawing.Size(400, 84)
Me.DetailsBox.Size = New System.Drawing.Size(383, 84)
Me.DetailsBox.TabIndex = 9
Me.DetailsBox.TabStop = False
'
@ -224,15 +213,15 @@ Partial Class Main
Me.EmpruntCheckBox.Enabled = False
Me.EmpruntCheckBox.Location = New System.Drawing.Point(5, 168)
Me.EmpruntCheckBox.Name = "EmpruntCheckBox"
Me.EmpruntCheckBox.Size = New System.Drawing.Size(101, 17)
Me.EmpruntCheckBox.Size = New System.Drawing.Size(98, 17)
Me.EmpruntCheckBox.TabIndex = 10
Me.EmpruntCheckBox.TabStop = False
Me.EmpruntCheckBox.Text = "Emprunter par :"
Me.EmpruntCheckBox.Text = "Emprunté par :"
Me.EmpruntCheckBox.UseVisualStyleBackColor = True
'
'EmprunterName
'
Me.EmprunterName.Location = New System.Drawing.Point(106, 166)
Me.EmprunterName.Location = New System.Drawing.Point(109, 166)
Me.EmprunterName.Name = "EmprunterName"
Me.EmprunterName.ReadOnly = True
Me.EmprunterName.Size = New System.Drawing.Size(150, 20)
@ -243,7 +232,7 @@ Partial Class Main
'
Me.SerieCheckBox.AutoSize = True
Me.SerieCheckBox.Enabled = False
Me.SerieCheckBox.Location = New System.Drawing.Point(433, 46)
Me.SerieCheckBox.Location = New System.Drawing.Point(433, 49)
Me.SerieCheckBox.Name = "SerieCheckBox"
Me.SerieCheckBox.Size = New System.Drawing.Size(59, 17)
Me.SerieCheckBox.TabIndex = 12
@ -256,7 +245,6 @@ Partial Class Main
Me.GroupBox2.Controls.Add(Me.IDBox)
Me.GroupBox2.Controls.Add(Me.GivenByBox)
Me.GroupBox2.Controls.Add(Me.Label8)
Me.GroupBox2.Controls.Add(Me.TypeComBox)
Me.GroupBox2.Controls.Add(Me.EtatBox)
Me.GroupBox2.Controls.Add(Me.SerieCheckBox)
Me.GroupBox2.Controls.Add(Me.EmprunterName)
@ -265,7 +253,6 @@ Partial Class Main
Me.GroupBox2.Controls.Add(Me.Label5)
Me.GroupBox2.Controls.Add(Me.NameBox)
Me.GroupBox2.Controls.Add(Me.Label4)
Me.GroupBox2.Controls.Add(Me.Label3)
Me.GroupBox2.Controls.Add(Me.Label2)
Me.GroupBox2.Controls.Add(Me.Label1)
Me.GroupBox2.Location = New System.Drawing.Point(355, 28)
@ -287,34 +274,25 @@ Partial Class Main
'
'GivenByBox
'
Me.GivenByBox.Location = New System.Drawing.Point(339, 166)
Me.GivenByBox.Location = New System.Drawing.Point(251, 47)
Me.GivenByBox.Name = "GivenByBox"
Me.GivenByBox.ReadOnly = True
Me.GivenByBox.Size = New System.Drawing.Size(153, 20)
Me.GivenByBox.Size = New System.Drawing.Size(176, 20)
Me.GivenByBox.TabIndex = 16
Me.GivenByBox.TabStop = False
'
'Label8
'
Me.Label8.AutoSize = True
Me.Label8.Location = New System.Drawing.Point(262, 169)
Me.Label8.Location = New System.Drawing.Point(174, 50)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(71, 13)
Me.Label8.TabIndex = 15
Me.Label8.Text = "Provenance :"
'
'TypeComBox
'
Me.TypeComBox.Location = New System.Drawing.Point(45, 44)
Me.TypeComBox.Name = "TypeComBox"
Me.TypeComBox.ReadOnly = True
Me.TypeComBox.Size = New System.Drawing.Size(211, 20)
Me.TypeComBox.TabIndex = 14
Me.TypeComBox.TabStop = False
'
'EtatBox
'
Me.EtatBox.Location = New System.Drawing.Point(296, 44)
Me.EtatBox.Location = New System.Drawing.Point(37, 47)
Me.EtatBox.Name = "EtatBox"
Me.EtatBox.ReadOnly = True
Me.EtatBox.Size = New System.Drawing.Size(131, 20)
@ -401,20 +379,20 @@ Partial Class Main
Me.Label7.TabIndex = 9
Me.Label7.Text = "RAM :"
'
'Mem
'MemBox
'
Me.Mem.Location = New System.Drawing.Point(291, 17)
Me.Mem.Name = "Mem"
Me.Mem.ReadOnly = True
Me.Mem.Size = New System.Drawing.Size(57, 20)
Me.Mem.TabIndex = 10
Me.Mem.TabStop = False
Me.MemBox.Location = New System.Drawing.Point(291, 17)
Me.MemBox.Name = "MemBox"
Me.MemBox.ReadOnly = True
Me.MemBox.Size = New System.Drawing.Size(57, 20)
Me.MemBox.TabIndex = 10
Me.MemBox.TabStop = False
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.OS)
Me.GroupBox3.Controls.Add(Me.Arch)
Me.GroupBox3.Controls.Add(Me.Mem)
Me.GroupBox3.Controls.Add(Me.OSBox)
Me.GroupBox3.Controls.Add(Me.ArchBox)
Me.GroupBox3.Controls.Add(Me.MemBox)
Me.GroupBox3.Controls.Add(Me.Label7)
Me.GroupBox3.Controls.Add(Me.Label6)
Me.GroupBox3.Controls.Add(Me.ProgressBar1)
@ -430,21 +408,21 @@ Partial Class Main
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "Avancement"
'
'OS
'OSBox
'
Me.OS.Location = New System.Drawing.Point(57, 41)
Me.OS.Name = "OS"
Me.OS.ReadOnly = True
Me.OS.Size = New System.Drawing.Size(59, 20)
Me.OS.TabIndex = 13
Me.OSBox.Location = New System.Drawing.Point(57, 41)
Me.OSBox.Name = "OSBox"
Me.OSBox.ReadOnly = True
Me.OSBox.Size = New System.Drawing.Size(59, 20)
Me.OSBox.TabIndex = 13
'
'Arch
'ArchBox
'
Me.Arch.Location = New System.Drawing.Point(188, 18)
Me.Arch.Name = "Arch"
Me.Arch.ReadOnly = True
Me.Arch.Size = New System.Drawing.Size(54, 20)
Me.Arch.TabIndex = 12
Me.ArchBox.Location = New System.Drawing.Point(188, 18)
Me.ArchBox.Name = "ArchBox"
Me.ArchBox.ReadOnly = True
Me.ArchBox.Size = New System.Drawing.Size(54, 20)
Me.ArchBox.TabIndex = 12
'
'EditButton
'
@ -500,7 +478,6 @@ Partial Class Main
Friend WithEvents AboutToolMenuItem As ToolStripMenuItem
Friend WithEvents Label1 As Label
Friend WithEvents Label2 As Label
Friend WithEvents Label3 As Label
Friend WithEvents Label4 As Label
Friend WithEvents NameBox As TextBox
Friend WithEvents Label5 As Label
@ -517,12 +494,11 @@ Partial Class Main
Friend WithEvents ProgressBar1 As ProgressBar
Friend WithEvents Label6 As Label
Friend WithEvents Label7 As Label
Friend WithEvents Mem As TextBox
Friend WithEvents MemBox As TextBox
Friend WithEvents GroupBox3 As GroupBox
Friend WithEvents TypeComBox As TextBox
Friend WithEvents EtatBox As TextBox
Friend WithEvents OS As TextBox
Friend WithEvents Arch As TextBox
Friend WithEvents OSBox As TextBox
Friend WithEvents ArchBox As TextBox
Friend WithEvents GivenByBox As TextBox
Friend WithEvents Label8 As Label
Friend WithEvents EditButton As Button

View File

@ -5,17 +5,6 @@ Public Class Main
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CheckIfFirstRun()
ListAllInv()
If HWCheck.Checked And OSCheck.Checked And DrvCheck.Checked And ActivateCheck.Checked Then SoftCheck.Enabled = True Else SoftCheck.Enabled = False
If HWCheck.Checked And OSCheck.Checked And DrvCheck.Checked Then
ActivateCheck.Enabled = True
OS.Enabled = True
Else
ActivateCheck.Enabled = False
OS.Enabled = False
End If
If HWCheck.Checked And OSCheck.Checked Then DrvCheck.Enabled = True Else DrvCheck.Enabled = False
If HWCheck.Checked Then OSCheck.Enabled = True Else OSCheck.Enabled = False
End Sub
Private Sub CheckIfFirstRun()
@ -48,7 +37,7 @@ Public Class Main
`activate_complete` NUMERIC NOT NULL DEFAULT 0,
`soft_complete` NUMERIC NOT NULL DEFAULT 0,
`arch` INTEGER NOT NULL DEFAULT 1,
`ram` TEXT NOT NULL DEFAULT '1G',
`ram` INTEGER NOT NULL DEFAULT 1,
`os` INTEGER NOT NULL DEFAULT 1
);
CREATE TABLE `credits` (
@ -111,6 +100,7 @@ Public Class Main
dtr = cmd.ExecuteReader()
While dtr.Read()
IDBox.Text = dtr.GetString(0)
manualID_selected = True
NameBox.Text = dtr.GetString(1)
InvSearchBar.Text = dtr.GetString(1)
If dtr.GetInt32(2) = 0 Then
@ -139,10 +129,6 @@ Public Class Main
End Try
End Sub
Private Sub IDBox_Click(sender As Object, e As EventArgs)
IDBox.Text = ""
End Sub
Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles AboutToolMenuItem.Click
Dim aboutForm As About
aboutForm = New About()
@ -156,4 +142,96 @@ Public Class Main
addMachineForm.Show()
addMachineForm = Nothing
End Sub
Private Sub IDBox_TextChanged(sender As Object, e As EventArgs) Handles IDBox.TextChanged
If IDBox.Text.Length() = 10 Then
Dim dtr As SQLiteDataReader
Try
Using con As New SQLiteConnection("URI=file:db.sqlite")
con.Open()
Using cmd As New SQLiteCommand(con)
cmd.CommandText = "SELECT * FROM computers_desc WHERE id=" & IDBox.Text & ";"
dtr = cmd.ExecuteReader()
Dim id_found As Boolean = False
While dtr.Read()
id_found = True
manualID_selected = True
StatusLabel.Text = "ID trouvé !"
NameBox.Text = dtr.GetString(1)
InvSearchBar.Text = dtr.GetString(1)
If dtr.GetInt32(2) = 0 Then
EtatBox.Text = "R.I.P"
ElseIf dtr.GetInt32(2) = 1 Then
EtatBox.Text = "Peu faire l'affaire"
ElseIf dtr.GetInt32(2) = 2 Then
EtatBox.Text = "En état"
ElseIf dtr.GetInt32(2) = 3 Then
EtatBox.Text = "Neuf"
End If
If dtr.GetInt32(3) = 1 Then SerieCheckBox.Checked = True
DetailsBox.Text = dtr.GetString(4)
If dtr.GetInt32(5) = 1 Then EmpruntCheckBox.Checked = True
EmprunterName.Text = dtr.GetString(6)
GivenByBox.Text = dtr.GetString(7)
End While
If Not id_found Then StatusLabel.Text = "ID introuvable !"
End Using
con.Close()
End Using
Catch ex As Exception
StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
MsgBox(ex.Message)
End Try
End If
End Sub
Private Sub IDBox_MouseClick(sender As Object, e As MouseEventArgs) Handles IDBox.MouseClick
If manualID_selected Then IDBox.Clear() : manualID_selected = False
End Sub
Private Sub RequestComputerProgress(machineID As String)
Dim dtr As SQLiteDataReader
Try
Using con As New SQLiteConnection("URI=file:db.sqlite")
con.Open()
Using cmd As New SQLiteCommand(con)
cmd.CommandText = "SELECT * FROM computers_progress WHERE id=" & machineID & ";"
dtr = cmd.ExecuteReader()
While dtr.Read()
HWCheck.Checked = dtr.GetBoolean(1)
OSCheck.Checked = dtr.GetBoolean(2)
DrvCheck.Checked = dtr.GetBoolean(3)
ActivateCheck.Checked = dtr.GetBoolean(4)
SoftCheck.Checked = dtr.GetBoolean(5)
Select Case dtr.GetInt32(6)
Case 1
ArchBox.Text = "32bits"
Case 2
ArchBox.Text = "64bits"
End Select
Select Case dtr.GetInt32(7)
Case 1
MemBox.Text = "<1G"
Case 2
MemBox.Text = "1G"
Case 3
MemBox.Text = "2G"
Case 4
MemBox.Text = "3G"
Case 5
MemBox.Text = "4G"
Case 6
MemBox.Text = ">4G"
End Select
End While
End Using
con.Close()
End Using
Catch ex As Exception
StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
MsgBox(ex.Message)
End Try
End Sub
End Class

View File

@ -1 +1 @@
isen-repair_inv_manager
# ISEN Repair Inventory Manager