Merge pull request #8 from BFNT/master
Rebase work for logger on print-function branch
This commit is contained in:
commit
71992d438f
@ -39,6 +39,7 @@ Public Class AddMachine
|
|||||||
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
|
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
|
||||||
con.Close()
|
con.Close()
|
||||||
End Using
|
End Using
|
||||||
|
Main.log.Info("Computer " & NewIDBox.Text & " added")
|
||||||
Main.StatusLabel.Text = "Ordinateur ajouté avec succés dans la base de données."
|
Main.StatusLabel.Text = "Ordinateur ajouté avec succés dans la base de données."
|
||||||
Main.ListAllInv()
|
Main.ListAllInv()
|
||||||
Me.Close()
|
Me.Close()
|
||||||
|
20
ISEN-Repair Inventory Manager/EditSpecs.Designer.vb
generated
20
ISEN-Repair Inventory Manager/EditSpecs.Designer.vb
generated
@ -34,7 +34,7 @@ Partial Class EditSpecs
|
|||||||
Me.OSCheck = New System.Windows.Forms.CheckBox()
|
Me.OSCheck = New System.Windows.Forms.CheckBox()
|
||||||
Me.HWCheck = New System.Windows.Forms.CheckBox()
|
Me.HWCheck = New System.Windows.Forms.CheckBox()
|
||||||
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
|
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
|
||||||
Me.NewIDBox = New System.Windows.Forms.TextBox()
|
Me.IDBox = New System.Windows.Forms.TextBox()
|
||||||
Me.GivedByBox = New System.Windows.Forms.TextBox()
|
Me.GivedByBox = New System.Windows.Forms.TextBox()
|
||||||
Me.Label8 = New System.Windows.Forms.Label()
|
Me.Label8 = New System.Windows.Forms.Label()
|
||||||
Me.EtatBox = New System.Windows.Forms.TextBox()
|
Me.EtatBox = New System.Windows.Forms.TextBox()
|
||||||
@ -168,7 +168,7 @@ Partial Class EditSpecs
|
|||||||
'
|
'
|
||||||
'GroupBox2
|
'GroupBox2
|
||||||
'
|
'
|
||||||
Me.GroupBox2.Controls.Add(Me.NewIDBox)
|
Me.GroupBox2.Controls.Add(Me.IDBox)
|
||||||
Me.GroupBox2.Controls.Add(Me.GivedByBox)
|
Me.GroupBox2.Controls.Add(Me.GivedByBox)
|
||||||
Me.GroupBox2.Controls.Add(Me.Label8)
|
Me.GroupBox2.Controls.Add(Me.Label8)
|
||||||
Me.GroupBox2.Controls.Add(Me.EtatBox)
|
Me.GroupBox2.Controls.Add(Me.EtatBox)
|
||||||
@ -188,14 +188,14 @@ Partial Class EditSpecs
|
|||||||
Me.GroupBox2.TabStop = False
|
Me.GroupBox2.TabStop = False
|
||||||
Me.GroupBox2.Text = "Information et détails"
|
Me.GroupBox2.Text = "Information et détails"
|
||||||
'
|
'
|
||||||
'NewIDBox
|
'IDBox
|
||||||
'
|
'
|
||||||
Me.NewIDBox.Location = New System.Drawing.Point(37, 16)
|
Me.IDBox.Location = New System.Drawing.Point(37, 16)
|
||||||
Me.NewIDBox.Name = "NewIDBox"
|
Me.IDBox.Name = "IDBox"
|
||||||
Me.NewIDBox.ReadOnly = True
|
Me.IDBox.ReadOnly = True
|
||||||
Me.NewIDBox.Size = New System.Drawing.Size(79, 20)
|
Me.IDBox.Size = New System.Drawing.Size(79, 20)
|
||||||
Me.NewIDBox.TabIndex = 17
|
Me.IDBox.TabIndex = 17
|
||||||
Me.NewIDBox.TabStop = False
|
Me.IDBox.TabStop = False
|
||||||
'
|
'
|
||||||
'GivedByBox
|
'GivedByBox
|
||||||
'
|
'
|
||||||
@ -361,7 +361,7 @@ Partial Class EditSpecs
|
|||||||
Friend WithEvents Label4 As Label
|
Friend WithEvents Label4 As Label
|
||||||
Friend WithEvents Label2 As Label
|
Friend WithEvents Label2 As Label
|
||||||
Friend WithEvents Label1 As Label
|
Friend WithEvents Label1 As Label
|
||||||
Friend WithEvents NewIDBox As TextBox
|
Friend WithEvents IDBox As TextBox
|
||||||
Friend WithEvents RAMCmbBox As ComboBox
|
Friend WithEvents RAMCmbBox As ComboBox
|
||||||
Friend WithEvents ProcArchCmbBox As ComboBox
|
Friend WithEvents ProcArchCmbBox As ComboBox
|
||||||
Friend WithEvents OSCmbBox As ComboBox
|
Friend WithEvents OSCmbBox As ComboBox
|
||||||
|
@ -8,7 +8,7 @@ Public Class EditSpecs
|
|||||||
InitializeComponent()
|
InitializeComponent()
|
||||||
|
|
||||||
' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
|
' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
|
||||||
NewIDBox.Text = id
|
IDBox.Text = id
|
||||||
NameBox.Text = name
|
NameBox.Text = name
|
||||||
EtatBox.Text = stat
|
EtatBox.Text = stat
|
||||||
GivedByBox.Text = givedBy
|
GivedByBox.Text = givedBy
|
||||||
@ -68,13 +68,14 @@ Public Class EditSpecs
|
|||||||
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(con)
|
Dim cmd As New SQLiteCommand(con)
|
||||||
cmd.CommandText = "UPDATE `computers_desc` SET `giveTo`='" & EmprunterName.Text & "', `gived`=" & BooleanToNumeric(EmpruntCheckBox.Checked) & " WHERE id='" & NewIDBox.Text & "';"
|
cmd.CommandText = "UPDATE `computers_desc` SET `giveTo`='" & EmprunterName.Text & "', `gived`=" & BooleanToNumeric(EmpruntCheckBox.Checked) & " WHERE id='" & IDBox.Text & "';"
|
||||||
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
|
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
|
||||||
cmd.CommandText = "UPDATE `computers_progress` SET `hardware_complete`=" & BooleanToNumeric(HWCheck.Checked) & ", `os_complete`=" & BooleanToNumeric(OSCheck.Checked) & ", `drivers_complete`=" & BooleanToNumeric(DrvCheck.Checked) & ", `activate_complete`=" & BooleanToNumeric(ActivateCheck.Checked) & ", `soft_complete`=" & BooleanToNumeric(SoftCheck.Checked) & ", `arch`=" & (ProcArchCmbBox.SelectedIndex + 1) & ", `ram`=" & (RAMCmbBox.SelectedIndex + 1) & ", `os`=" & (OSCmbBox.SelectedIndex + 1) & " WHERE id='" & NewIDBox.Text & "';"
|
cmd.CommandText = "UPDATE `computers_progress` SET `hardware_complete`=" & BooleanToNumeric(HWCheck.Checked) & ", `os_complete`=" & BooleanToNumeric(OSCheck.Checked) & ", `drivers_complete`=" & BooleanToNumeric(DrvCheck.Checked) & ", `activate_complete`=" & BooleanToNumeric(ActivateCheck.Checked) & ", `soft_complete`=" & BooleanToNumeric(SoftCheck.Checked) & ", `arch`=" & (ProcArchCmbBox.SelectedIndex + 1) & ", `ram`=" & (RAMCmbBox.SelectedIndex + 1) & ", `os`=" & (OSCmbBox.SelectedIndex + 1) & " WHERE id='" & IDBox.Text & "';"
|
||||||
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
|
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
|
||||||
con.Close()
|
con.Close()
|
||||||
End Using
|
End Using
|
||||||
Main.StatusLabel.Text = "Ordinateur enregistré avec succès !"
|
Main.StatusLabel.Text = "Ordinateur enregistré avec succès !"
|
||||||
|
Main.log.Info("Edited computer " & IDBox.Text)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Main.StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
|
Main.StatusLabel.Text = "Une erreur avec la base SQLite s'est produite !"
|
||||||
MsgBox(ex.Message)
|
MsgBox(ex.Message)
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<SuiteName>ISEN-Repair</SuiteName>
|
<SuiteName>ISEN-Repair</SuiteName>
|
||||||
<MinimumRequiredVersion>0.8.1.0</MinimumRequiredVersion>
|
<MinimumRequiredVersion>0.8.1.0</MinimumRequiredVersion>
|
||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>publish.htm</WebPage>
|
<WebPage>index.htm</WebPage>
|
||||||
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
|
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
|
||||||
<ApplicationRevision>2</ApplicationRevision>
|
<ApplicationRevision>2</ApplicationRevision>
|
||||||
<ApplicationVersion>0.9.5.%2a</ApplicationVersion>
|
<ApplicationVersion>0.9.5.%2a</ApplicationVersion>
|
||||||
@ -171,6 +171,7 @@
|
|||||||
<Compile Include="IDGenerator.vb">
|
<Compile Include="IDGenerator.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Logger.vb" />
|
||||||
<Compile Include="Main.vb">
|
<Compile Include="Main.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
42
ISEN-Repair Inventory Manager/Logger.vb
Normal file
42
ISEN-Repair Inventory Manager/Logger.vb
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
Imports System.IO
|
||||||
|
|
||||||
|
Public Class Logger
|
||||||
|
'DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||||
|
|
||||||
|
Dim logFileName As String = "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.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy"), "--------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Loading software"})
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub Info(str As String)
|
||||||
|
Dim objWriter As New StreamWriter(logFileName, True)
|
||||||
|
Try
|
||||||
|
objWriter.WriteLineAsync("[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] " & str)
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.ToString)
|
||||||
|
End Try
|
||||||
|
objWriter.Close()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub Warn(str As String)
|
||||||
|
Dim objWriter As New StreamWriter(logFileName, True)
|
||||||
|
Try
|
||||||
|
objWriter.WriteLineAsync("[" & DateTime.Now.ToString("HH:mm:ss") & "][WARN] " & str)
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.ToString)
|
||||||
|
End Try
|
||||||
|
objWriter.Close()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub Critical(str As String)
|
||||||
|
Dim objWriter As New StreamWriter(logFileName, True)
|
||||||
|
Try
|
||||||
|
objWriter.WriteLineAsync("[" & DateTime.Now.ToString("HH:mm:ss") & "][CRITICAL] " & str)
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.ToString)
|
||||||
|
End Try
|
||||||
|
objWriter.Close()
|
||||||
|
End Sub
|
||||||
|
End Class
|
@ -6,8 +6,10 @@ Public Class Main
|
|||||||
|
|
||||||
Dim manualID_selected As Boolean = False
|
Dim manualID_selected As Boolean = False
|
||||||
Dim idList As New ArrayList
|
Dim idList As New ArrayList
|
||||||
|
Public log As New Logger
|
||||||
|
|
||||||
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
|
||||||
|
log.Load()
|
||||||
CheckIfFirstRun()
|
CheckIfFirstRun()
|
||||||
ListAllInv()
|
ListAllInv()
|
||||||
End Sub
|
End Sub
|
||||||
@ -16,8 +18,9 @@ Public Class Main
|
|||||||
''' Function to check if app is running for the first time
|
''' Function to check if app is running for the first time
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Private Sub CheckIfFirstRun()
|
Private Sub CheckIfFirstRun()
|
||||||
|
log.Info("Check and load of database")
|
||||||
If Not My.Computer.FileSystem.FileExists("db.sqlite") Then
|
If Not My.Computer.FileSystem.FileExists("db.sqlite") 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
|
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()
|
RegenerateDB()
|
||||||
Else
|
Else
|
||||||
End
|
End
|
||||||
@ -108,6 +111,7 @@ Public Class Main
|
|||||||
''' Construct the basic structure of SQLite DB
|
''' Construct the basic structure of SQLite DB
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Private Sub RegenerateDB()
|
Private Sub RegenerateDB()
|
||||||
|
log.Warn("Reconstruct database...")
|
||||||
Dim genesis_seq As String = "
|
Dim genesis_seq As String = "
|
||||||
CREATE TABLE `computers_desc` (
|
CREATE TABLE `computers_desc` (
|
||||||
`id` TEXT NOT NULL DEFAULT 0000000000 UNIQUE,
|
`id` TEXT NOT NULL DEFAULT 0000000000 UNIQUE,
|
||||||
|
36
README.md
36
README.md
@ -1 +1,37 @@
|
|||||||
# ISEN Repair Inventory Manager
|
# ISEN Repair Inventory Manager
|
||||||
|
|
||||||
|
|
||||||
|
## Brief description
|
||||||
|
The ISEN Repair Inventory Manager
|
||||||
|
is a project for the ultimate goal tracking and managing computers
|
||||||
|
restored by the ISEN Repair Club. The specifications are constantly changing according to the needs
|
||||||
|
and the remarks making it even easier to use.
|
||||||
|
|
||||||
|
## How to install ?
|
||||||
|
You have two options for that :
|
||||||
|
- Using the ClickOnce's Microsoft technology for automated install and update
|
||||||
|
(Certified without ads/virus/unwanted content). Because I hate it ^^
|
||||||
|
- Using the zip package in releases section to manually install of the app. In this way the application
|
||||||
|
can be installed on a key including the database (Be careful not to lose it, make backups !!)
|
||||||
|
In the case of updating the two ways seen above, they are carried out without erasing the database.
|
||||||
|
(But we will never repeat it enough: make backups !!!)
|
||||||
|
|
||||||
|
## How to use this sh***t ?
|
||||||
|
Sorry... I'm busy on it :/
|
||||||
|
|
||||||
|
## What is planned ?
|
||||||
|
- Until the end of the 0.9 alpha the software will have to do the minimum of what is asked, ie it will
|
||||||
|
at least be able to record and manage the tracking of each computer individually.
|
||||||
|
- Starting with the 0.9 beta, the software will begin to have improvements after the return of users
|
||||||
|
to improve its ergonomics and use.
|
||||||
|
- Version 1.0 will be released when all aspects of improvements have been properly completed. As the
|
||||||
|
minor versions (1.1, 1.2, 1.3,...), there will be additions of functions for the more parts mentioned
|
||||||
|
in the project V1.0 section.
|
||||||
|
- (Uncertain) For version 2.0, the system will be completely revised to run on a SQL database and also
|
||||||
|
have 'online' support to use its smartphone for all tracking operations.
|
||||||
|
- (Even more uncertain) For future versions, there will still be additions of functions that will be
|
||||||
|
for the most parts cited in the project V2.0 section, with the possibility of adding a web platform allowing
|
||||||
|
customers / schools to make a return On the hardware, inform us in case of breakdown, etc...
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
- The REPAIR team (for support)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
theme: jekyll-theme-architect
|
|
Reference in New Issue
Block a user