LicenseManager 2.3c1:
- aggiunta DataGrid licenze Essetre in scadenza nell'arco di 5 giorni al MainMenu (nascosta se nessuna è in scadenza) e bottone per aggiornarle - corretto filtro ricerca Licenze per essere eseguito premendo Invio
This commit is contained in:
+124
-1
@@ -1,10 +1,43 @@
|
||||
Imports EgtWPFLib5
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MainMenuVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private Const ESSETRE_ID As Integer = 30
|
||||
Private Const DaysBeforeExpiration As Integer = 5
|
||||
Public UpdateFromExpLic As Boolean = False
|
||||
|
||||
Private m_ExpiringLic_Visibility As Visibility
|
||||
Public Property ExpiringLic_Visibility As Visibility
|
||||
Get
|
||||
Return m_ExpiringLic_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_ExpiringLic_Visibility = value
|
||||
NotifyPropertyChanged("ExpiringLic_Visibility")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SelSearchResult As Licence
|
||||
Public Property SelSearchResult As Licence
|
||||
Get
|
||||
Return m_SelSearchResult
|
||||
End Get
|
||||
Set(value As Licence)
|
||||
m_SelSearchResult = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SearchResult As ObservableCollection(Of SearchLicence)
|
||||
Public ReadOnly Property SearchResult As ObservableCollection(Of SearchLicence)
|
||||
Get
|
||||
Return m_SearchResult
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdNewClient As Command
|
||||
Private m_cmdNewKey As Command
|
||||
@@ -25,9 +58,31 @@ Public Class MainMenuVM
|
||||
Private m_cmdUpdateVersion As Command
|
||||
Private m_cmdUpdateReseller As Command
|
||||
'Private m_cmdAboutBox As Command
|
||||
Private m_cmdUpdateOverwrite As Command
|
||||
Private m_cmdUpdateNew As Command
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property UpdateOverwriteMsg As String
|
||||
Get
|
||||
Return "Update (Overwrite)"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
' Imposto riferimento nella mappa
|
||||
Map.SetRefMainMenuVM(Me)
|
||||
'LoadExpiringLicences()
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewClient"
|
||||
@@ -393,4 +448,72 @@ Public Class MainMenuVM
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Friend Sub InitMainMenuPage()
|
||||
LoadExpiringLicences()
|
||||
End Sub
|
||||
|
||||
#Region "LoadExpiringLicenses"
|
||||
|
||||
Private Sub LoadExpiringLicences()
|
||||
|
||||
' Carico lista ProductName
|
||||
Dim ProductList As List(Of Product)
|
||||
Dim prodQuery As String
|
||||
prodQuery = "SELECT * FROM " & DB_PRODUCT
|
||||
ProductList = ManageDb.ExecuteProductQuery(prodQuery)
|
||||
|
||||
Dim Query As String = "SELECT * FROM " & DB_LICENCE & " INNER JOIN " & DB_PRODUCT &
|
||||
" ON " & DB_LICENCE & "." & DB_PRODUCTID & " = " & DB_PRODUCT & "." & DB_PRODUCTID &
|
||||
" INNER JOIN " & DB_KEY &
|
||||
" ON " & DB_KEY & "." & DB_LOCKID & " = " & DB_LICENCE & "." & DB_LOCKID &
|
||||
" INNER JOIN " & DB_CLIENT &
|
||||
" ON " & DB_KEY & "." & DB_CLIENTID & " = " & DB_CLIENT & "." & DB_CLIENTID &
|
||||
" WHERE " & DB_CLIENT & "." & DB_CLIENTID & " = " & ESSETRE_ID &
|
||||
" AND DATEDIFF(" & DB_LICENCE & "." & DB_DATE & ", '" & Format(DateTime.Now.AddYears(-1), "yyyy-MM-dd") & "') > 0 " &
|
||||
" AND DATEDIFF(" & DB_LICENCE & "." & DB_DATE & ", '" & Format(DateTime.Now.AddYears(-1), "yyyy-MM-dd") & "') < " & DaysBeforeExpiration
|
||||
|
||||
m_SearchResult = New ObservableCollection(Of SearchLicence)(ManageDb.ExecuteExpiringLicenceQuery(Query, ProductList))
|
||||
NotifyPropertyChanged("SearchResult")
|
||||
|
||||
If m_SearchResult.Count > 0 Then
|
||||
ExpiringLic_Visibility = Visibility.Visible
|
||||
Else
|
||||
ExpiringLic_Visibility = Visibility.Collapsed
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' LoadExpiringLicenses
|
||||
|
||||
#Region "UpdateOverwrite"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property UpdateOverwrite_Command As ICommand
|
||||
Get
|
||||
If m_cmdUpdateOverwrite Is Nothing Then
|
||||
m_cmdUpdateOverwrite = New Command(AddressOf UpdateOverwrite)
|
||||
End If
|
||||
Return m_cmdUpdateOverwrite
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub UpdateOverwrite(ByVal param As Object)
|
||||
If Not IsNothing(m_SelSearchResult) Then
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refUpdateLicencePageVM.Licence = m_SelSearchResult
|
||||
UpdateFromExpLic = True
|
||||
Map.refUpdateLicencePageVM.Overwrite = True
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.UPDATELICENCE
|
||||
Else
|
||||
MessageBox.Show("Non è stata selezionata nessuna licenza")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' UpdateOverwrite
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user