LicenseManager 2.1b2:
- Aggiunto KeyID in KeyTable nel DB - ClientID può essere NULL in KeyTable nel DB - NewKeyPage: impostato Generated Number/LockID in base a IsDongle - Aggiunto Stato Key 'InDepositoEgt' - Sistemate comboBox e textBox delle KeyPages e di UpdateLicencePage - Avviso Number già esistente nella creazione Key
This commit is contained in:
+174
-155
@@ -1,113 +1,113 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class UpdateKeyPageVM
|
||||
Inherits VMBase
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private m_Key As Key
|
||||
Public Property Key As Key
|
||||
Get
|
||||
Return m_Key
|
||||
End Get
|
||||
Set(value As Key)
|
||||
m_Key = value
|
||||
End Set
|
||||
End Property
|
||||
Private m_Key As Key
|
||||
Public Property Key As Key
|
||||
Get
|
||||
Return m_Key
|
||||
End Get
|
||||
Set(value As Key)
|
||||
m_Key = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_NameList As List(Of Client)
|
||||
Public ReadOnly Property NameList As List(Of Client)
|
||||
Get
|
||||
Return m_NameList
|
||||
End Get
|
||||
End Property
|
||||
Private m_NameList As List(Of Client)
|
||||
Public ReadOnly Property NameList As List(Of Client)
|
||||
Get
|
||||
Return m_NameList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelName As Client
|
||||
Public Property SelName As Client
|
||||
Get
|
||||
Return m_SelName
|
||||
End Get
|
||||
Set(value As Client)
|
||||
m_SelName = value
|
||||
NotifyPropertyChanged("SelName")
|
||||
End Set
|
||||
End Property
|
||||
Private m_SelName As Client
|
||||
Public Property SelName As Client
|
||||
Get
|
||||
Return m_SelName
|
||||
End Get
|
||||
Set(value As Client)
|
||||
m_SelName = value
|
||||
NotifyPropertyChanged("SelName")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ClientID As Integer
|
||||
Public Property ClientID As Integer
|
||||
Get
|
||||
Return m_ClientID
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_ClientID = value
|
||||
NotifyPropertyChanged("ClientID")
|
||||
End Set
|
||||
End Property
|
||||
Private m_ClientID As Integer
|
||||
Public Property ClientID As Integer
|
||||
Get
|
||||
Return m_ClientID
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_ClientID = value
|
||||
NotifyPropertyChanged("ClientID")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_StateList As List(Of Key.KeyState)
|
||||
Public ReadOnly Property StateList As List(Of Key.KeyState)
|
||||
Get
|
||||
Return m_StateList
|
||||
End Get
|
||||
End Property
|
||||
Private m_StateList As List(Of Key.KeyState)
|
||||
Public ReadOnly Property StateList As List(Of Key.KeyState)
|
||||
Get
|
||||
Return m_StateList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelState As Key.KeyState
|
||||
Public Property SelState As Key.KeyState
|
||||
Get
|
||||
Return m_SelState
|
||||
End Get
|
||||
Set(value As Key.KeyState)
|
||||
m_SelState = value
|
||||
NotifyPropertyChanged("SelState")
|
||||
End Set
|
||||
End Property
|
||||
Private m_SelState As Key.KeyState
|
||||
Public Property SelState As Key.KeyState
|
||||
Get
|
||||
Return m_SelState
|
||||
End Get
|
||||
Set(value As Key.KeyState)
|
||||
m_SelState = value
|
||||
NotifyPropertyChanged("SelState")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_State As Key.KeyState
|
||||
Public Property State As Key.KeyState
|
||||
Get
|
||||
Return m_State
|
||||
End Get
|
||||
Set(value As Key.KeyState)
|
||||
m_State = value
|
||||
NotifyPropertyChanged("State")
|
||||
End Set
|
||||
End Property
|
||||
Private m_State As Key.KeyState
|
||||
Public Property State As Key.KeyState
|
||||
Get
|
||||
Return m_State
|
||||
End Get
|
||||
Set(value As Key.KeyState)
|
||||
m_State = value
|
||||
NotifyPropertyChanged("State")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdUpdate As Command
|
||||
Private m_cmdCancel As Command
|
||||
' Definizione comandi
|
||||
Private m_cmdUpdate As Command
|
||||
Private m_cmdCancel As Command
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property UpdateKeyMsg As String
|
||||
Get
|
||||
Return "Update key"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property UpdateKeyMsg As String
|
||||
Get
|
||||
Return "Update key"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property NameMsg As String
|
||||
Get
|
||||
Return "Name client"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property NameMsg As String
|
||||
Get
|
||||
Return "Name client"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property StateMsg As String
|
||||
Get
|
||||
Return "State"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property StateMsg As String
|
||||
Get
|
||||
Return "State"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property UpdateMsg As String
|
||||
Get
|
||||
Return "Update"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property UpdateMsg As String
|
||||
Get
|
||||
Return "Update"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CancelMsg As String
|
||||
Get
|
||||
Return "Cancel"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CancelMsg As String
|
||||
Get
|
||||
Return "Cancel"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
@@ -115,29 +115,47 @@ Public Class UpdateKeyPageVM
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
' Imposto riferimento nella mappa
|
||||
Map.SetRefUpdateKeyPageVM(Me)
|
||||
End Sub
|
||||
Sub New()
|
||||
' Imposto riferimento nella mappa
|
||||
Map.SetRefUpdateKeyPageVM(Me)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Friend Sub InitUpdateKeyPage()
|
||||
' Carico lista Name
|
||||
Dim Query As String = "SELECT * FROM " & DB_CLIENT
|
||||
m_NameList = ManageDb.ExecuteClientQuery(Query)
|
||||
NotifyPropertyChanged("NameList")
|
||||
' Carico lista State
|
||||
Dim sList As New List(Of Key.KeyState)
|
||||
sList.Add(Key.KeyState.Consegnata)
|
||||
sList.Add(Key.KeyState.InDeposito)
|
||||
sList.Add(Key.KeyState.Guasta)
|
||||
m_StateList = sList
|
||||
NotifyPropertyChanged("StateList")
|
||||
Friend Sub InitUpdateKeyPage()
|
||||
' Carico lista Name
|
||||
Dim Query As String = "SELECT * FROM " & DB_CLIENT
|
||||
m_NameList = ManageDb.ExecuteClientQuery(Query)
|
||||
NotifyPropertyChanged("NameList")
|
||||
|
||||
End Sub
|
||||
Dim nQuery As String = "SELECT * FROM " & DB_CLIENT & " WHERE " & DB_CLIENTID & " = '" & Key.ClientID & "'"
|
||||
m_SelName = m_NameList.FirstOrDefault(Function(namel) namel.Name.Equals(ManageDb.ExecuteClientQuery(nQuery)(0).Name)) 'ManageDb.ExecuteClientQuery(nQuery)(0)
|
||||
NotifyPropertyChanged("SelName")
|
||||
|
||||
' Carico lista State
|
||||
Dim sList As New List(Of Key.KeyState)
|
||||
sList.Add(Key.KeyState.Consegnata)
|
||||
sList.Add(Key.KeyState.InDeposito)
|
||||
sList.Add(Key.KeyState.InDepositoEgt)
|
||||
sList.Add(Key.KeyState.Guasta)
|
||||
m_StateList = sList
|
||||
NotifyPropertyChanged("StateList")
|
||||
|
||||
'Dim sQuery As String = "SELECT * FROM " & DB_KEY & " WHERE " & DB_LOCKID & " = '" & Key.LockID & "'"
|
||||
'm_SelState = m_StateList.ElementAt(2) ' m_StateList.FirstOrDefault(Function(statel) statel.Equals(ManageDb.ExecuteKeyQuery(sQuery)(0).State))
|
||||
|
||||
|
||||
'Dim item As Key.KeyState = m_StateList(2)
|
||||
'm_StateList.RemoveAt(2)
|
||||
''If (newIndex > oldIndex) Then newIndex--;
|
||||
''' the actual index could have shifted due to the removal
|
||||
'm_StateList.Insert(0, item)
|
||||
|
||||
m_SelState = m_StateList(Key.State)
|
||||
NotifyPropertyChanged("SelState")
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
@@ -145,65 +163,66 @@ Public Class UpdateKeyPageVM
|
||||
|
||||
#Region "Update"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property UpdateKey_Command As ICommand
|
||||
Get
|
||||
If m_cmdUpdate Is Nothing Then
|
||||
m_cmdUpdate = New Command(AddressOf Update)
|
||||
End If
|
||||
Return m_cmdUpdate
|
||||
End Get
|
||||
End Property
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property UpdateKey_Command As ICommand
|
||||
Get
|
||||
If m_cmdUpdate Is Nothing Then
|
||||
m_cmdUpdate = New Command(AddressOf Update)
|
||||
End If
|
||||
Return m_cmdUpdate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Update(ByVal param As Object)
|
||||
If Not IsNothing(Key) Then
|
||||
If Not IsNothing(SelName) Then
|
||||
'Cerco IDClient associato a Name
|
||||
Dim Query As String = "SELECT " & DB_CLIENTID & " FROM " & DB_CLIENT & " WHERE " & DB_NAME & " = '" & SelName.Name & "'"
|
||||
ClientID = ManageDb.ExecuteIntegerQuery(Query, DB_CLIENTID)(0)
|
||||
' Aggiorno tabella Key col Client scelto
|
||||
Query = "UPDATE " & DB_KEY & " SET " & DB_CLIENTID & " = '" & m_ClientID & "' WHERE " & DB_LOCKID & " = '" & Key.LockID & "' "
|
||||
Query = Query.TrimEnd(","c, " "c)
|
||||
Public Sub Update(ByVal param As Object)
|
||||
If Not IsNothing(Key) Then
|
||||
If Not IsNothing(SelName) Then
|
||||
''Cerco IDClient associato a Name
|
||||
'Dim Query As String = "SELECT " & DB_CLIENTID & " FROM " & DB_CLIENT & " WHERE " & DB_NAME & " = '" & SelName.Name & "'"
|
||||
'ClientID = ManageDb.ExecuteIntegerQuery(Query, DB_CLIENTID)(0)
|
||||
ClientID = SelName.ClientID
|
||||
' Aggiorno tabella Key col Client scelto
|
||||
Dim Query As String = "UPDATE " & DB_KEY & " SET " & DB_CLIENTID & " = '" & m_ClientID & "' WHERE " & DB_LOCKID & " = '" & Key.LockID & "' "
|
||||
Query = Query.TrimEnd(","c, " "c)
|
||||
|
||||
ManageDb.ExecuteQuery(Query)
|
||||
End If
|
||||
If Not IsNothing(SelState) Then
|
||||
' Aggiorno tabella Key con lo State scelto
|
||||
Dim Query As String = "UPDATE " & DB_KEY & " SET " & DB_STATE & " = '" & m_SelState.ToString() & "' WHERE " & DB_LOCKID & " = '" & Key.LockID & "' "
|
||||
Query = Query.TrimEnd(","c, " "c)
|
||||
ManageDb.ExecuteQuery(Query)
|
||||
End If
|
||||
If Not IsNothing(SelState) Then
|
||||
' Aggiorno tabella Key con lo State scelto
|
||||
Dim Query As String = "UPDATE " & DB_KEY & " SET " & DB_STATE & " = '" & m_SelState.ToString() & "' WHERE " & DB_LOCKID & " = '" & Key.LockID & "' "
|
||||
Query = Query.TrimEnd(","c, " "c)
|
||||
|
||||
ManageDb.ExecuteQuery(Query)
|
||||
End If
|
||||
Else
|
||||
MessageBox.Show("Non è stata selezionata nessuna chiave")
|
||||
End If
|
||||
ManageDb.ExecuteQuery(Query)
|
||||
End If
|
||||
Else
|
||||
MessageBox.Show("Non è stata selezionata nessuna chiave")
|
||||
End If
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.MAINMENU
|
||||
' Else
|
||||
' MessageBox.Show("Completare il campo presente")
|
||||
'End If
|
||||
End Sub
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.MAINMENU
|
||||
' Else
|
||||
' MessageBox.Show("Completare il campo presente")
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
#End Region ' Update
|
||||
|
||||
#Region "Cancel"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property Cancel_Command As ICommand
|
||||
Get
|
||||
If m_cmdCancel Is Nothing Then
|
||||
m_cmdCancel = New Command(AddressOf Cancel)
|
||||
End If
|
||||
Return m_cmdCancel
|
||||
End Get
|
||||
End Property
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property Cancel_Command As ICommand
|
||||
Get
|
||||
If m_cmdCancel Is Nothing Then
|
||||
m_cmdCancel = New Command(AddressOf Cancel)
|
||||
End If
|
||||
Return m_cmdCancel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Cancel(ByVal param As Object)
|
||||
Public Sub Cancel(ByVal param As Object)
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.SEARCHKEY
|
||||
End Sub
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.SEARCHKEY
|
||||
End Sub
|
||||
|
||||
#End Region ' Cancel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user