Updated logo and generating db function

This commit is contained in:
JackCarterSmith 2017-05-30 12:05:09 +02:00
parent 1bd73cef1d
commit e9f22639d0
4 changed files with 1720 additions and 613 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -24,11 +24,8 @@ Partial Class Main
Private Sub InitializeComponent() Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Main)) Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Main))
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip() Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
Me.FichierToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.AddComputerToolMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.AjouterUnPCToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.AboutToolMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.QuitterToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.StatusLabel = New System.Windows.Forms.ToolStripStatusLabel() Me.StatusLabel = New System.Windows.Forms.ToolStripStatusLabel()
Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.GroupBox1 = New System.Windows.Forms.GroupBox()
@ -47,7 +44,8 @@ Partial Class Main
Me.EmprunterName = New System.Windows.Forms.TextBox() Me.EmprunterName = New System.Windows.Forms.TextBox()
Me.SerieCheckBox = New System.Windows.Forms.CheckBox() Me.SerieCheckBox = New System.Windows.Forms.CheckBox()
Me.GroupBox2 = New System.Windows.Forms.GroupBox() Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.TextBox4 = New System.Windows.Forms.TextBox() Me.IDBox = New System.Windows.Forms.MaskedTextBox()
Me.GivenByBox = New System.Windows.Forms.TextBox()
Me.Label8 = New System.Windows.Forms.Label() Me.Label8 = New System.Windows.Forms.Label()
Me.TypeComBox = New System.Windows.Forms.TextBox() Me.TypeComBox = New System.Windows.Forms.TextBox()
Me.EtatBox = New System.Windows.Forms.TextBox() Me.EtatBox = New System.Windows.Forms.TextBox()
@ -64,7 +62,6 @@ Partial Class Main
Me.OS = New System.Windows.Forms.TextBox() Me.OS = New System.Windows.Forms.TextBox()
Me.Arch = New System.Windows.Forms.TextBox() Me.Arch = New System.Windows.Forms.TextBox()
Me.EditButton = New System.Windows.Forms.Button() Me.EditButton = New System.Windows.Forms.Button()
Me.IDBox = New System.Windows.Forms.MaskedTextBox()
Me.MenuStrip1.SuspendLayout() Me.MenuStrip1.SuspendLayout()
Me.StatusStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout()
Me.GroupBox1.SuspendLayout() Me.GroupBox1.SuspendLayout()
@ -74,42 +71,24 @@ Partial Class Main
' '
'MenuStrip1 'MenuStrip1
' '
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FichierToolStripMenuItem, Me.ToolStripMenuItem1}) Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AddComputerToolMenuItem, Me.AboutToolMenuItem})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0) Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1" Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(875, 24) Me.MenuStrip1.Size = New System.Drawing.Size(875, 24)
Me.MenuStrip1.TabIndex = 0 Me.MenuStrip1.TabIndex = 0
Me.MenuStrip1.Text = "MenuStrip1" Me.MenuStrip1.Text = "MenuStrip1"
' '
'FichierToolStripMenuItem 'AddComputerToolMenuItem
' '
Me.FichierToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AjouterUnPCToolStripMenuItem, Me.ToolStripSeparator1, Me.QuitterToolStripMenuItem}) Me.AddComputerToolMenuItem.Name = "AddComputerToolMenuItem"
Me.FichierToolStripMenuItem.Name = "FichierToolStripMenuItem" Me.AddComputerToolMenuItem.Size = New System.Drawing.Size(93, 20)
Me.FichierToolStripMenuItem.Size = New System.Drawing.Size(54, 20) Me.AddComputerToolMenuItem.Text = "Ajouter un PC"
Me.FichierToolStripMenuItem.Text = "Fichier"
' '
'AjouterUnPCToolStripMenuItem 'AboutToolMenuItem
' '
Me.AjouterUnPCToolStripMenuItem.Name = "AjouterUnPCToolStripMenuItem" Me.AboutToolMenuItem.Name = "AboutToolMenuItem"
Me.AjouterUnPCToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.AboutToolMenuItem.Size = New System.Drawing.Size(24, 20)
Me.AjouterUnPCToolStripMenuItem.Text = "Ajouter un PC" Me.AboutToolMenuItem.Text = "?"
'
'ToolStripSeparator1
'
Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
Me.ToolStripSeparator1.Size = New System.Drawing.Size(149, 6)
'
'QuitterToolStripMenuItem
'
Me.QuitterToolStripMenuItem.Name = "QuitterToolStripMenuItem"
Me.QuitterToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
Me.QuitterToolStripMenuItem.Text = "Quitter"
'
'ToolStripMenuItem1
'
Me.ToolStripMenuItem1.Name = "ToolStripMenuItem1"
Me.ToolStripMenuItem1.Size = New System.Drawing.Size(24, 20)
Me.ToolStripMenuItem1.Text = "?"
' '
'StatusStrip1 'StatusStrip1
' '
@ -275,7 +254,7 @@ Partial Class Main
'GroupBox2 'GroupBox2
' '
Me.GroupBox2.Controls.Add(Me.IDBox) Me.GroupBox2.Controls.Add(Me.IDBox)
Me.GroupBox2.Controls.Add(Me.TextBox4) Me.GroupBox2.Controls.Add(Me.GivenByBox)
Me.GroupBox2.Controls.Add(Me.Label8) Me.GroupBox2.Controls.Add(Me.Label8)
Me.GroupBox2.Controls.Add(Me.TypeComBox) Me.GroupBox2.Controls.Add(Me.TypeComBox)
Me.GroupBox2.Controls.Add(Me.EtatBox) Me.GroupBox2.Controls.Add(Me.EtatBox)
@ -296,14 +275,24 @@ Partial Class Main
Me.GroupBox2.TabStop = False Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Information et détails" Me.GroupBox2.Text = "Information et détails"
' '
'TextBox4 'IDBox
' '
Me.TextBox4.Location = New System.Drawing.Point(339, 166) Me.IDBox.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite
Me.TextBox4.Name = "TextBox4" Me.IDBox.Location = New System.Drawing.Point(37, 16)
Me.TextBox4.ReadOnly = True Me.IDBox.Mask = "9999999999"
Me.TextBox4.Size = New System.Drawing.Size(153, 20) Me.IDBox.Name = "IDBox"
Me.TextBox4.TabIndex = 16 Me.IDBox.Size = New System.Drawing.Size(79, 20)
Me.TextBox4.TabStop = False Me.IDBox.TabIndex = 0
Me.IDBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'GivenByBox
'
Me.GivenByBox.Location = New System.Drawing.Point(339, 166)
Me.GivenByBox.Name = "GivenByBox"
Me.GivenByBox.ReadOnly = True
Me.GivenByBox.Size = New System.Drawing.Size(153, 20)
Me.GivenByBox.TabIndex = 16
Me.GivenByBox.TabStop = False
' '
'Label8 'Label8
' '
@ -467,16 +456,6 @@ Partial Class Main
Me.EditButton.Text = "Modifier" Me.EditButton.Text = "Modifier"
Me.EditButton.UseVisualStyleBackColor = True Me.EditButton.UseVisualStyleBackColor = True
' '
'IDBox
'
Me.IDBox.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite
Me.IDBox.Location = New System.Drawing.Point(37, 16)
Me.IDBox.Mask = "9999999999"
Me.IDBox.Name = "IDBox"
Me.IDBox.Size = New System.Drawing.Size(79, 20)
Me.IDBox.TabIndex = 0
Me.IDBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Main 'Main
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@ -511,8 +490,6 @@ Partial Class Main
End Sub End Sub
Friend WithEvents MenuStrip1 As MenuStrip Friend WithEvents MenuStrip1 As MenuStrip
Friend WithEvents FichierToolStripMenuItem As ToolStripMenuItem
Friend WithEvents QuitterToolStripMenuItem As ToolStripMenuItem
Friend WithEvents StatusStrip1 As StatusStrip Friend WithEvents StatusStrip1 As StatusStrip
Friend WithEvents StatusLabel As ToolStripStatusLabel Friend WithEvents StatusLabel As ToolStripStatusLabel
Friend WithEvents GroupBox1 As GroupBox Friend WithEvents GroupBox1 As GroupBox
@ -520,7 +497,7 @@ Partial Class Main
Friend WithEvents InvList As ListBox Friend WithEvents InvList As ListBox
Friend WithEvents SendOutButton As Button Friend WithEvents SendOutButton As Button
Friend WithEvents TrashButton As Button Friend WithEvents TrashButton As Button
Friend WithEvents ToolStripMenuItem1 As ToolStripMenuItem Friend WithEvents AboutToolMenuItem As ToolStripMenuItem
Friend WithEvents Label1 As Label Friend WithEvents Label1 As Label
Friend WithEvents Label2 As Label Friend WithEvents Label2 As Label
Friend WithEvents Label3 As Label Friend WithEvents Label3 As Label
@ -546,10 +523,9 @@ Partial Class Main
Friend WithEvents EtatBox As TextBox Friend WithEvents EtatBox As TextBox
Friend WithEvents OS As TextBox Friend WithEvents OS As TextBox
Friend WithEvents Arch As TextBox Friend WithEvents Arch As TextBox
Friend WithEvents TextBox4 As TextBox Friend WithEvents GivenByBox As TextBox
Friend WithEvents Label8 As Label Friend WithEvents Label8 As Label
Friend WithEvents EditButton As Button Friend WithEvents EditButton As Button
Friend WithEvents AjouterUnPCToolStripMenuItem As ToolStripMenuItem
Friend WithEvents ToolStripSeparator1 As ToolStripSeparator
Friend WithEvents IDBox As MaskedTextBox Friend WithEvents IDBox As MaskedTextBox
Private WithEvents AddComputerToolMenuItem As ToolStripMenuItem
End Class End Class

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
Imports System.Data.SQLite Imports System.Data.SQLite
Public Class Main Public Class Main
Dim manualID_selected As Boolean = False
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CheckIfFirstRun() CheckIfFirstRun()
ListAllInv() ListAllInv()
@ -21,7 +23,7 @@ Public Class Main
If MsgBox("La base de données SQLite est introuvable ou inaccesible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inacessible") = 1 Then If MsgBox("La base de données SQLite est introuvable ou inaccesible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inacessible") = 1 Then
RegenerateDB() RegenerateDB()
Else Else
Me.Close() End
End If End If
End If End If
End Sub End Sub
@ -29,13 +31,13 @@ Public Class Main
Private Sub RegenerateDB() Private Sub RegenerateDB()
Dim genesis_seq As String = " Dim genesis_seq As String = "
CREATE TABLE `computers_desc` ( CREATE TABLE `computers_desc` (
`id` INTEGER NOT NULL DEFAULT 0000000000 UNIQUE, `id` TEXT NOT NULL DEFAULT 0000000000 UNIQUE,
`name` TEXT NOT NULL DEFAULT 'ComputerOfDoom', `name` TEXT NOT NULL DEFAULT 'ComputerOfDoom',
`etat` INTEGER NOT NULL DEFAULT 0, `etat` INTEGER NOT NULL DEFAULT 0,
`serial` NUMERIC NOT NULL DEFAULT 0, `serial` NUMERIC NOT NULL DEFAULT 0,
`comms` TEXT, `comms` TEXT NOT NULL DEFAULT 'N/A',
`gived` INTEGER NOT NULL DEFAULT 0, `gived` INTEGER NOT NULL DEFAULT 0,
`giveTo` TEXT, `giveTo` TEXT NOT NULL DEFAULT 'N/A',
`getBy` NUMERIC NOT NULL DEFAULT 'ISEN' `getBy` NUMERIC NOT NULL DEFAULT 'ISEN'
); );
CREATE TABLE `computers_progress` ( CREATE TABLE `computers_progress` (
@ -60,6 +62,7 @@ Public Class Main
Using con As New SQLiteConnection("URI=file:db.sqlite") Using con As New SQLiteConnection("URI=file:db.sqlite")
con.Open() con.Open()
Dim cmd As New SQLiteCommand(genesis_seq, con) Dim cmd As New SQLiteCommand(genesis_seq, con)
cmd.ExecuteNonQuery()
con.Close() con.Close()
End Using End Using
StatusLabel.Text = "La base SQLite a été reconstruite avec succès !" StatusLabel.Text = "La base SQLite a été reconstruite avec succès !"
@ -96,61 +99,61 @@ Public Class Main
End Sub End Sub
Private Sub InvList_SelectedIndexChanged(sender As Object, e As EventArgs) Handles InvList.SelectedIndexChanged Private Sub InvList_SelectedIndexChanged(sender As Object, e As EventArgs) Handles InvList.SelectedIndexChanged
Try Dim dtr As SQLiteDataReader
DisplayInvList(InvList.SelectedValue)
Catch ex As Exception
End Try
End Sub
Public Sub DisplayInvList(entriesId As String)
Dim connectStr As String = "Data Source=db.sqlite"
Dim SQLiteCommand As String = "SELECT * FROM Inventory WHERE EntriesID=" & entriesId
Dim dt As DataTable = Nothing
Dim ds As New DataSet
Dim entriesRow As DataRow = Nothing Dim entriesRow As DataRow = Nothing
Try Try
Using con As New SQLiteConnection(connectStr) StatusLabel.Text = "Récupération des données depuis la base SQLite..."
Using cmd As New SQLiteCommand(SQLiteCommand, con) Using con As New SQLiteConnection("URI=file:db.sqlite")
con.Open() con.Open()
Using da As New SQLiteDataAdapter(cmd) Using cmd As New SQLiteCommand(con)
da.Fill(ds) cmd.CommandText = "SELECT * FROM computers_desc WHERE _rowid_=" & InvList.SelectedIndex + 1 & ";"
dt = ds.Tables(0) dtr = cmd.ExecuteReader()
End Using While dtr.Read()
IDBox.Text = dtr.GetString(0)
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
End Using End Using
con.Close()
End Using End Using
entriesRow = dt.Rows(0) StatusLabel.Text = "Récupération avec succés de la base SQLite."
If entriesRow IsNot Nothing Then
IDBox.Text = entriesRow("entriesID")
End If
Catch ex As Exception Catch ex As Exception
StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
MsgBox(ex.Message) MsgBox(ex.Message)
End Try End Try
End Sub End Sub
Private Sub QuitterToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles QuitterToolStripMenuItem.Click Private Sub IDBox_Click(sender As Object, e As EventArgs)
End IDBox.Text = ""
End Sub End Sub
Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem1.Click Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles AboutToolMenuItem.Click
Dim aboutForm As About Dim aboutForm As About
aboutForm = New About() aboutForm = New About()
aboutForm.Show() aboutForm.Show()
aboutForm = Nothing aboutForm = Nothing
End Sub End Sub
Private Sub AjouterUnPCToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AjouterUnPCToolStripMenuItem.Click Private Sub AddComputerToolMenuItem_Click(sender As Object, e As EventArgs) Handles AddComputerToolMenuItem.Click
Dim addMachineForm As AddMachine Dim addMachineForm As AddMachine
addMachineForm = New AddMachine() addMachineForm = New AddMachine()
addMachineForm.Show() addMachineForm.Show()
addMachineForm = Nothing addMachineForm = Nothing
End Sub End Sub
Private Sub IDBox_Click(sender As Object, e As EventArgs)
IDBox.SelectAll()
End Sub
End Class End Class