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
-31
@@ -4,37 +4,130 @@
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
DataContext="{StaticResource MainMenuVM}">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border BorderBrush="Black"
|
||||
<Border BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
Height="75"
|
||||
Grid.Row="0">
|
||||
<TextBlock Height="50"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3">
|
||||
<TextBlock Height="50"
|
||||
Text="Main Menù"
|
||||
FontSize="30"
|
||||
TextAlignment="Center"/>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--<Button Content="Nuovo cliente"
|
||||
<Grid Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Visibility="{Binding ExpiringLic_Visibility}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
Height="35"
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
VerticalAlignment="Top">
|
||||
<TextBlock Height="50"
|
||||
Text="Licenze Essetre in scadenza:"
|
||||
FontSize="20"
|
||||
TextAlignment="Center"/>
|
||||
</Border>
|
||||
|
||||
<!--<ListBox ItemsSource="{Binding SearchResult}"
|
||||
Grid.Row="1"
|
||||
Height="150"/>-->
|
||||
|
||||
<DataGrid Name="LicenceDataGrid"
|
||||
ItemsSource="{Binding SearchResult}"
|
||||
SelectedItem="{Binding SelSearchResult}"
|
||||
AutoGenerateColumns="False"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
RowHeight="20"
|
||||
Height="150"
|
||||
ColumnHeaderHeight="25">
|
||||
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn Header="ProductName"
|
||||
Binding="{Binding ProductName, Mode=OneWay}"
|
||||
Width="SizeToHeader"/>
|
||||
<DataGridTextColumn Header="ProductVersion"
|
||||
Binding="{Binding ProductVersion, Mode=OneWay}"
|
||||
Width="SizeToHeader"/>
|
||||
<!--<DataGridTextColumn Header="ProductLevel"
|
||||
Binding="{Binding ProductLevel, Mode=OneWay}"
|
||||
Width="SizeToHeader"/>
|
||||
<DataGridTextColumn Header="Option 1"
|
||||
Binding="{Binding Option1, Mode=OneWay}"
|
||||
Width="SizeToHeader"/>
|
||||
<DataGridTextColumn Header="Option 2"
|
||||
Binding="{Binding Option2, Mode=OneWay}"
|
||||
Width="SizeToHeader"/>-->
|
||||
<!--<DataGridTextColumn Header="LockID"
|
||||
Binding="{Binding Number, Mode=OneWay}"
|
||||
Width="1*"/>
|
||||
<DataGridTextColumn Header="File"
|
||||
Binding="{Binding File, Mode=OneWay}"
|
||||
Width="1*"/>-->
|
||||
<DataGridTextColumn Header="License Date"
|
||||
Binding="{Binding LicenseDate, Mode=OneWay, StringFormat=\{0:dd/MM/yyyy\}}"
|
||||
Width="SizeToHeader"/>
|
||||
<!--<DataGridTextColumn Header="License File Content"
|
||||
Binding="{Binding LicFile, Mode=OneWay}"
|
||||
Width="1*"/>-->
|
||||
<DataGridTextColumn Header="Note"
|
||||
Binding="{Binding Note, Mode=OneWay}"
|
||||
Width="1*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<Button Content="{Binding UpdateOverwriteMsg}"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="2"
|
||||
Command="{Binding UpdateOverwrite_Command}"
|
||||
Style="{StaticResource OptionPanel_TextButton}"/>
|
||||
<!--<Button Content="{Binding UpdateNewMsg}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Command="{Binding UpdateNew_Command}"
|
||||
Style="{StaticResource OptionPanel_TextButton}"/>-->
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--<Button Content="Nuovo cliente"
|
||||
Command="{Binding NewClient_Command}"
|
||||
Height="60"
|
||||
Width="170"
|
||||
@@ -70,42 +163,42 @@
|
||||
Width="170"
|
||||
Grid.Column="0"
|
||||
Grid.Row="5"/>-->
|
||||
<Button Content="Licenze"
|
||||
<Button Content="Licenze"
|
||||
Command="{Binding SearchLicence_Command}"
|
||||
Height="60"
|
||||
Width="170"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"/>
|
||||
<Button Content="Chiavi"
|
||||
<Button Content="Chiavi"
|
||||
Command="{Binding SearchKey_Command}"
|
||||
Height="60"
|
||||
Width="170"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"/>
|
||||
<Button Content="Prodotti"
|
||||
<Button Content="Prodotti"
|
||||
Command="{Binding SearchProduct_Command}"
|
||||
Height="60"
|
||||
Width="170"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"/>
|
||||
<Button Content="Versioni"
|
||||
<Button Content="Versioni"
|
||||
Command="{Binding SearchVersion_Command}"
|
||||
Height="60"
|
||||
Width="170"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"/>
|
||||
<Button Content="Rivenditori"
|
||||
<Button Content="Rivenditori"
|
||||
Command="{Binding SearchReseller_Command}"
|
||||
Height="60"
|
||||
Width="170"
|
||||
Grid.Column="1"
|
||||
Grid.Row="4"/>
|
||||
<Button Content="Clienti"
|
||||
<Button Content="Clienti"
|
||||
Command="{Binding SearchClient_Command}"
|
||||
Height="60"
|
||||
Width="170"
|
||||
Grid.Column="1"
|
||||
Grid.Row="5"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
+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
|
||||
|
||||
@@ -111,7 +111,7 @@ Public Class MainWindowVM
|
||||
m_SelProjectMode = value
|
||||
Select Case m_SelProjectMode
|
||||
Case ProjectModeOpt.MAINMENU
|
||||
|
||||
Map.refMainMenuVM.InitMainMenuPage()
|
||||
Case ProjectModeOpt.NEWCLIENT
|
||||
Try
|
||||
Map.refNewClientPageVM.InitNewClientPage()
|
||||
|
||||
@@ -59,5 +59,5 @@ Imports System.Windows
|
||||
' usando l'asterisco '*' come illustrato di seguito:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.3.1.1")>
|
||||
<Assembly: AssemblyFileVersion("2.3.1.1")>
|
||||
<Assembly: AssemblyVersion("2.3.3.1")>
|
||||
<Assembly: AssemblyFileVersion("2.3.3.1")>
|
||||
|
||||
@@ -267,6 +267,7 @@
|
||||
Style="{StaticResource Page_Button}"/>
|
||||
<Button Content="{Binding SearchMsg}"
|
||||
Command="{Binding Search_Command}"
|
||||
IsDefault="True"
|
||||
Style="{StaticResource Page_Button}"/>
|
||||
<Button Content="{Binding UpdateOverwriteMsg}"
|
||||
Command="{Binding UpdateOverwrite_Command}"
|
||||
|
||||
@@ -50,10 +50,14 @@ Public Class SearchLicencePageVM
|
||||
End Property
|
||||
|
||||
Private m_ProductList As List(Of Product)
|
||||
Public ReadOnly Property ProductList As List(Of Product)
|
||||
Public Property ProductList As List(Of Product)
|
||||
Get
|
||||
Return m_ProductList
|
||||
End Get
|
||||
Set(value As List(Of Product))
|
||||
m_ProductList = value
|
||||
NotifyPropertyChanged("ProductList")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SelProduct As Product
|
||||
@@ -823,4 +827,11 @@ Public Class SearchLicence
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub New(LicenceReader As MySqlDataReader, ProductList As List(Of Product))
|
||||
MyBase.New(LicenceReader)
|
||||
If ProductID <> 0 Then
|
||||
m_ProductName = ProductList.Find(Function(x) x.ProductID = ProductID).ProductName
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -924,10 +924,14 @@ Public Class UpdateLicencePageVM
|
||||
|
||||
ManageDb.ExecuteQuery(Query)
|
||||
|
||||
m_ReturnFromUpdate = True
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.SEARCHLICENCE
|
||||
|
||||
If Map.refMainMenuVM.UpdateFromExpLic Then
|
||||
Map.refMainMenuVM.UpdateFromExpLic = False
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.MAINMENU
|
||||
Else
|
||||
m_ReturnFromUpdate = True
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.SEARCHLICENCE
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub EvalWhere(ByRef bFirst As Boolean, ByRef Query As String)
|
||||
@@ -988,9 +992,14 @@ Public Class UpdateLicencePageVM
|
||||
|
||||
Public Sub Cancel(ByVal param As Object)
|
||||
|
||||
m_ReturnFromUpdate = True
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.SEARCHLICENCE
|
||||
If Map.refMainMenuVM.UpdateFromExpLic Then
|
||||
Map.refMainMenuVM.UpdateFromExpLic = False
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.MAINMENU
|
||||
Else
|
||||
m_ReturnFromUpdate = True
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.SEARCHLICENCE
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -351,6 +351,26 @@ Module ManageDb
|
||||
Return LicenceList
|
||||
End Function
|
||||
|
||||
Friend Function ExecuteExpiringLicenceQuery(MySqlQuery As String, ProductList As List(Of Product)) As List(Of SearchLicence)
|
||||
Dim LicenceList As New List(Of SearchLicence)
|
||||
Try
|
||||
Using DbConnection As New MySqlConnection(m_DbPath)
|
||||
DbConnection.Open()
|
||||
Using Command As MySqlCommand = New MySqlCommand(MySqlQuery, DbConnection)
|
||||
Using Reader As MySqlDataReader = Command.ExecuteReader()
|
||||
While Reader.Read()
|
||||
LicenceList.Add(New SearchLicence(Reader, ProductList))
|
||||
End While
|
||||
End Using
|
||||
End Using
|
||||
DbConnection.Close()
|
||||
End Using
|
||||
Catch ex As MySqlException
|
||||
MessageBox.Show(ex.Message)
|
||||
End Try
|
||||
Return LicenceList
|
||||
End Function
|
||||
|
||||
Friend Function ExecuteSearchProductQuery(MySqlQuery As String) As List(Of Product)
|
||||
Dim ProductList As New List(Of Product)
|
||||
Try
|
||||
|
||||
@@ -22,6 +22,7 @@ Module Map
|
||||
Private m_refUpdateVersionPageVM As UpdateVersionPageVM
|
||||
Private m_refUpdateResellerPageVM As UpdateResellerPageVM
|
||||
Private m_refLicenceBoxVM As LicenceBoxVM
|
||||
Private m_refMainMenuVM As MainMenuVM
|
||||
|
||||
#Region "Get"
|
||||
|
||||
@@ -145,6 +146,12 @@ Module Map
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property refMainMenuVM As MainMenuVM
|
||||
Get
|
||||
Return m_refMainMenuVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
#End Region ' Get
|
||||
|
||||
@@ -245,6 +252,11 @@ Module Map
|
||||
Return Not IsNothing(m_refLicenceBoxVM)
|
||||
End Function
|
||||
|
||||
Friend Function SetRefMainMenuVM(MainMenuVM As MainMenuVM) As Boolean
|
||||
m_refMainMenuVM = MainMenuVM
|
||||
Return Not IsNothing(m_refMainMenuVM)
|
||||
End Function
|
||||
|
||||
#End Region ' Set
|
||||
|
||||
#Region "Init"
|
||||
|
||||
Reference in New Issue
Block a user