diff --git a/KeyPage/KeyPageV.xaml b/KeyPage/KeyPageV.xaml
index 3713bcd..b4fc062 100644
--- a/KeyPage/KeyPageV.xaml
+++ b/KeyPage/KeyPageV.xaml
@@ -13,7 +13,8 @@
-
+
+
+
+
+
+
+
diff --git a/KeyPage/KeyPageVM.vb b/KeyPage/KeyPageVM.vb
index 6f6337e..e3c67ed 100644
--- a/KeyPage/KeyPageVM.vb
+++ b/KeyPage/KeyPageVM.vb
@@ -151,7 +151,7 @@ Public Class KeyPageVM
End Set
End Property
- Private m_StateList As New List(Of String)({"Consegnata", "InDeposito", "InDepositoEgt", "Guasta", "Interna", "InternaEgt", "---ANY---"}) ' Key.KeyState)({Key.KeyState.Consegnata, Key.KeyState.InDeposito, Key.KeyState.Guasta, Key.KeyState.ANY})
+ Private m_StateList As New List(Of String)({"Consegnata", "InDeposito", "InDepositoEgt", "Guasta", "Interna", "InternaEgt", "InDepositoTrial", "---ANY---"}) ' Key.KeyState)({Key.KeyState.Consegnata, Key.KeyState.InDeposito, Key.KeyState.Guasta, Key.KeyState.ANY})
Public ReadOnly Property StateList As List(Of String) ' Key.KeyState)
Get
Return m_StateList
@@ -175,6 +175,7 @@ Public Class KeyPageVM
If (value.Equals("Guasta")) Then m_SelState = Key.KeyState.Guasta
If (value.Equals("Interna")) Then m_SelState = Key.KeyState.Interna
If (value.Equals("InternaEgt")) Then m_SelState = Key.KeyState.InternaEgt
+ If (value.Equals("InDepositoTrial")) Then m_SelState = Key.KeyState.InDepositoTrial
If (value.Equals("---ANY---")) Then m_SelState = Key.KeyState.ANY
NotifyPropertyChanged("SelState")
End Set
@@ -190,6 +191,17 @@ Public Class KeyPageVM
End Set
End Property
+ Private m_Note As String
+ Public Property Note As String
+ Get
+ Return m_Note
+ End Get
+ Set(value As String)
+ m_Note = value
+ NotifyPropertyChanged("Note")
+ End Set
+ End Property
+
#Region "Messages"
Public ReadOnly Property IsDongleMsg As String
@@ -240,6 +252,12 @@ Public Class KeyPageVM
End Get
End Property
+ Public ReadOnly Property NoteMsg As String
+ Get
+ Return "Note"
+ End Get
+ End Property
+
#End Region ' Messages
#End Region ' FIELDS & PROPERTIES
@@ -265,6 +283,10 @@ Public Class KeyPageVM
' Carico valore di default State (InDeposito)
' m_SelState = Key.KeyState.Guasta
NotifyPropertyChanged("StateList")
+
+ ' Svuoto campi
+ m_Note = String.Empty
+ NotifyPropertyChanged("Note")
End Sub
#End Region ' METHODS
diff --git a/MainWindow/Objects.vb b/MainWindow/Objects.vb
index 53b1d8e..19f5a9f 100644
--- a/MainWindow/Objects.vb
+++ b/MainWindow/Objects.vb
@@ -83,7 +83,8 @@ Public Class Key
Guasta = 3
Interna = 4
InternaEgt = 5
- ANY = 6
+ InDepositoTrial = 6
+ ANY = 7
End Enum
Private m_State As KeyState
@@ -100,13 +101,21 @@ Public Class Key
End Get
End Property
- Sub New(Number As Integer, ClientID As Integer, IsDongle As Integer, LockID As String, State As KeyState, KeyDate As Date)
+ Private m_Note As String
+ Public ReadOnly Property Note As String
+ Get
+ Return m_Note
+ End Get
+ End Property
+
+ Sub New(Number As Integer, ClientID As Integer, IsDongle As Integer, LockID As String, State As KeyState, KeyDate As Date, Note As String)
m_Number = Number
m_ClientID = ClientID
m_IsDongle = IsDongle
m_LockID = LockID
m_State = State
m_KeyDate = KeyDate
+ m_Note = Note
End Sub
Sub New(KeyReader As MySqlDataReader)
@@ -118,6 +127,9 @@ Public Class Key
m_LockID = CType(KeyReader(DB_LOCKID), String)
m_State = DirectCast([Enum].Parse(GetType(KeyState), KeyReader(DB_STATE)), KeyState)
m_KeyDate = CDate(KeyReader(DB_DATE))
+ If Not KeyReader(DB_NOTE).Equals(DBNull.Value) Then
+ m_Note = CType(KeyReader(DB_NOTE), String)
+ End If
End Sub
End Class
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 1fed7a7..be14a78 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -59,5 +59,5 @@ Imports System.Windows
' usando l'asterisco '*' come illustrato di seguito:
'
-
-
+
+
diff --git a/NewKeyPage/NewKeyPageVM.vb b/NewKeyPage/NewKeyPageVM.vb
index b0f0342..d89afcd 100644
--- a/NewKeyPage/NewKeyPageVM.vb
+++ b/NewKeyPage/NewKeyPageVM.vb
@@ -94,6 +94,17 @@ Public Class NewKeyPageVM
End Set
End Property
+ Private m_Note As String
+ Public Overloads Property Note As String
+ Get
+ Return m_Note
+ End Get
+ Set(value As String)
+ m_Note = value
+ NotifyPropertyChanged("Note")
+ End Set
+ End Property
+
' Definizione comandi
Private m_cmdAddKey As Command
Private m_cmdCancel As Command
@@ -159,6 +170,9 @@ Public Class NewKeyPageVM
KeyDate = Date.Now
NotifyPropertyChanged("KeyDate")
+
+ m_Note = String.Empty
+ NotifyPropertyChanged("Note")
End Sub
#End Region ' METHODS
@@ -224,20 +238,22 @@ Public Class NewKeyPageVM
If (GetSelIsDongle() = 0) Then dongleValue = 0
If (GetSelIsDongle() = 1) Then dongleValue = 1
If (Not IsNothing(SelClient)) Then
- Query = "INSERT INTO " & DB_KEY & " (" & DB_NUMBER & ", " & DB_CLIENTID & ", " & DB_ISDONGLE & ", " & DB_LOCKID & ", " & DB_STATE & ", " & DB_DATE & ")" &
+ Query = "INSERT INTO " & DB_KEY & " (" & DB_NUMBER & ", " & DB_CLIENTID & ", " & DB_ISDONGLE & ", " & DB_LOCKID & ", " & DB_STATE & ", " & DB_DATE & ", " & DB_NOTE & ")" &
" VALUES ('" & Number & "', " &
" '" & SelClient.ClientID & "', " &
" '" & dongleValue & "', " &
" '" & m_LockID & "', " &
" '" & SelState.ToString() & "', " &
- " '" & Format(KeyDate, "yyyy-MM-dd") & "')"
+ " '" & Format(KeyDate, "yyyy-MM-dd") & "', " &
+ " '" & m_Note & "')"
Else
- Query = "INSERT INTO " & DB_KEY & " (" & DB_NUMBER & ", " & DB_ISDONGLE & ", " & DB_LOCKID & ", " & DB_STATE & ", " & DB_DATE & ")" &
+ Query = "INSERT INTO " & DB_KEY & " (" & DB_NUMBER & ", " & DB_ISDONGLE & ", " & DB_LOCKID & ", " & DB_STATE & ", " & DB_DATE & ", " & DB_NOTE & ")" &
" VALUES ('" & Number & "', " &
" '" & dongleValue & "', " &
" '" & m_LockID & "', " &
" '" & SelState.ToString() & "', " &
- " '" & Format(KeyDate, "yyyy-MM-dd") & "')"
+ " '" & Format(KeyDate, "yyyy-MM-dd") & "', " &
+ " '" & m_Note & "')"
End If
ManageDb.ExecuteQuery(Query)
diff --git a/SearchKeyPage/SearchKeyPageV.xaml b/SearchKeyPage/SearchKeyPageV.xaml
index 2e1599d..38a4a04 100644
--- a/SearchKeyPage/SearchKeyPageV.xaml
+++ b/SearchKeyPage/SearchKeyPageV.xaml
@@ -53,6 +53,9 @@
+
diff --git a/SearchKeyPage/SearchKeyPageVM.vb b/SearchKeyPage/SearchKeyPageVM.vb
index 781c78d..7dd5088 100644
--- a/SearchKeyPage/SearchKeyPageVM.vb
+++ b/SearchKeyPage/SearchKeyPageVM.vb
@@ -41,7 +41,7 @@ Public Class SearchKeyPageVM
End Get
End Property
- Private m_StateList As New List(Of String)({"Consegnata", "InDeposito", "InDepositoEgt", "Guasta", "Interna", "InternaEgt", "---ANY---"})
+ Private m_StateList As New List(Of String)({"Consegnata", "InDeposito", "InDepositoEgt", "Guasta", "Interna", "InternaEgt", "InDepositoTrial", "---ANY---"})
Public Overloads ReadOnly Property StateList As List(Of String)
Get
Return m_StateList
@@ -71,6 +71,8 @@ Public Class SearchKeyPageVM
m_SelState = Key.KeyState.Interna
ElseIf value.Equals("InternaEgt") Then
m_SelState = Key.KeyState.InternaEgt
+ ElseIf value.Equals("InDepositoTrial") Then
+ m_SelState = Key.KeyState.InDepositoTrial
ElseIf value.Equals("---ANY---") Then
m_SelState = Key.KeyState.ANY
End If
@@ -78,6 +80,17 @@ Public Class SearchKeyPageVM
End Set
End Property
+ Private m_Note As String
+ Public Property Note As String
+ Get
+ Return m_Note
+ End Get
+ Set(value As String)
+ m_Note = value
+ NotifyPropertyChanged("Note")
+ End Set
+ End Property
+
' Definizione comandi
Private m_cmdNewKey As Command
Private m_cmdSearch As Command
@@ -186,6 +199,7 @@ Public Class SearchKeyPageVM
Not IsNothing(SelIsDongle) OrElse
Not IsNothing(SelState) OrElse
Not IsNothing(KeyDate) OrElse
+ Not IsNothing(Note) OrElse
Not String.IsNullOrWhiteSpace(LockID) Then
Query &= "WHERE "
If Not IsNothing(SelIsDongle) And (SelIsDongle = "Hardware" Or SelIsDongle = "Software") Then ' If Not IsNothing(SelIsDongle) Then
@@ -215,6 +229,10 @@ Public Class SearchKeyPageVM
EvalWhere(bFirstWhere, Query)
Query &= DB_DATE & " = '" & Format(KeyDate, "yyyy-MM-dd") & "%' "
End If
+ If Not String.IsNullOrWhiteSpace(Note) Then
+ EvalWhere(bFirstWhere, Query)
+ Query &= DB_NOTE & " LIKE '%" & Note & "%' "
+ End If
Query = Query.TrimEnd(","c, " "c)
Dim suffixToRemove As String = " WHERE"
If Not IsNothing(Query) And Not IsNothing(suffixToRemove) And Query.EndsWith(suffixToRemove) Then
diff --git a/UpdateKeyPage/UpdateKeyPageV.xaml b/UpdateKeyPage/UpdateKeyPageV.xaml
index 4aa21fd..19a76fe 100644
--- a/UpdateKeyPage/UpdateKeyPageV.xaml
+++ b/UpdateKeyPage/UpdateKeyPageV.xaml
@@ -29,6 +29,7 @@
+
+
+
+
+
diff --git a/UpdateKeyPage/UpdateKeyPageVM.vb b/UpdateKeyPage/UpdateKeyPageVM.vb
index c116e98..5046e61 100644
--- a/UpdateKeyPage/UpdateKeyPageVM.vb
+++ b/UpdateKeyPage/UpdateKeyPageVM.vb
@@ -83,6 +83,17 @@ Public Class UpdateKeyPageVM
End Set
End Property
+ Private m_Note As String
+ Public Property Note As String
+ Get
+ Return m_Note
+ End Get
+ Set(value As String)
+ m_Note = value
+ NotifyPropertyChanged("Note")
+ End Set
+ End Property
+
' Definizione comandi
Private m_cmdUpdate As Command
Private m_cmdCancel As Command
@@ -113,6 +124,12 @@ Public Class UpdateKeyPageVM
End Get
End Property
+ Public ReadOnly Property NoteMsg As String
+ Get
+ Return "Note"
+ End Get
+ End Property
+
Public ReadOnly Property UpdateMsg As String
Get
Return "Update"
@@ -162,6 +179,7 @@ Public Class UpdateKeyPageVM
sList.Add(Key.KeyState.Guasta)
sList.Add(Key.KeyState.Interna)
sList.Add(Key.KeyState.InternaEgt)
+ sList.Add(Key.KeyState.InDepositoTrial)
m_StateList = sList
NotifyPropertyChanged("StateList")
@@ -180,6 +198,9 @@ Public Class UpdateKeyPageVM
m_KeyDate = Key.KeyDate
NotifyPropertyChanged("KeyDate")
+
+ m_Note = Key.Note
+ NotifyPropertyChanged("Note")
End Sub
#End Region ' METHODS
@@ -223,6 +244,13 @@ Public Class UpdateKeyPageVM
Dim Query As String = "UPDATE " & DB_KEY & " SET " & DB_DATE & " = '" & Format(m_KeyDate, "yyyy-MM-dd") & "' WHERE " & DB_LOCKID & " = '" & Key.LockID & "' "
Query = Query.TrimEnd(","c, " "c)
+ ManageDb.ExecuteQuery(Query)
+ End If
+ If Not IsNothing(Note) Then
+ ' Aggiorno tabella Key con KeyDate scelto
+ Dim Query As String = "UPDATE " & DB_KEY & " SET " & DB_NOTE & " = '" & m_Note & "' WHERE " & DB_LOCKID & " = '" & Key.LockID & "' "
+ Query = Query.TrimEnd(","c, " "c)
+
ManageDb.ExecuteQuery(Query)
End If
Else
diff --git a/Utility/ManageDb.vb b/Utility/ManageDb.vb
index a398ab6..aacb7a1 100644
--- a/Utility/ManageDb.vb
+++ b/Utility/ManageDb.vb
@@ -132,7 +132,7 @@ Module ManageDb
Using Command As MySqlCommand = New MySqlCommand(MySqlQuery, DbConnection)
Using Reader As MySqlDataReader = Command.ExecuteReader()
While Reader.Read()
- If (Not Reader(DB_NOTE).Equals(DBNull.Value)) Then
+ If (Not Reader(ResColumnName).Equals(DBNull.Value)) Then
StringList.Add(CType(Reader(ResColumnName), String))
End If
End While