Merge branch 'RenzoL'

This commit is contained in:
RenzoL
2022-01-14 15:59:14 +01:00
15 changed files with 218 additions and 141 deletions
+1
View File
@@ -204,6 +204,7 @@
<DependentUpon>LicenceBoxV.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\ManageDb.vb" />
<Compile Include="Utility\ManageFile.vb" />
<Compile Include="Utility\Map.vb" />
<Compile Include="VersionPage\VersionPageV.xaml.vb">
<DependentUpon>VersionPageV.xaml</DependentUpon>
+29 -26
View File
@@ -46,8 +46,8 @@
Grid.ColumnSpan="2"
VerticalAlignment="Top">
<TextBlock Height="50"
Text="Licenze Essetre in scadenza:"
FontSize="20"
Text="Licenze Essetre/Multiax/Omag in scadenza:"
FontSize="15"
TextAlignment="Center"/>
</Border>
@@ -68,35 +68,38 @@
<DataGrid.Columns>
<DataGridTextColumn Header="ProductName"
Binding="{Binding ProductName, Mode=OneWay}"
Width="SizeToHeader"/>
Binding="{Binding ProductName, Mode=OneWay}"
Width="SizeToHeader"/>
<DataGridTextColumn Header="ProductVersion"
Binding="{Binding ProductVersion, Mode=OneWay}"
Width="SizeToHeader"/>
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"/>-->
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*"/>
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*"/>-->
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="ClientName"
Binding="{Binding ClientName, Mode=OneWay}"
Width="SizeToHeader"/>
<DataGridTextColumn Header="Note"
Binding="{Binding Note, Mode=OneWay}"
Width="1*"/>
Binding="{Binding Note, Mode=OneWay}"
Width="1*"/>
</DataGrid.Columns>
</DataGrid>
+10 -2
View File
@@ -6,6 +6,8 @@ Public Class MainMenuVM
#Region "FIELDS & PROPERTIES"
Private Const MULTIAX_ID As Integer = 28
Private Const OMAG_ID As Integer = 29
Private Const ESSETRE_ID As Integer = 30
Private Const DaysBeforeExpiration As Integer = 20
Public UpdateFromExpLic As Boolean = False
@@ -464,17 +466,23 @@ Public Class MainMenuVM
prodQuery = "SELECT * FROM " & DB_PRODUCT
ProductList = ManageDb.ExecuteProductQuery(prodQuery)
' Carico lista ClientName
Dim ClientList As List(Of Client)
Dim clientQuery As String
clientQuery = "SELECT * FROM " & DB_CLIENT
ClientList = ManageDb.ExecuteClientQuery(clientQuery)
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 &
" WHERE " & DB_CLIENT & "." & DB_CLIENTID & " IN (" & MULTIAX_ID & ", " & OMAG_ID & ", " & 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))
m_SearchResult = New ObservableCollection(Of SearchLicence)(ManageDb.ExecuteExpiringLicenceQuery(Query, ProductList, ClientList))
NotifyPropertyChanged("SearchResult")
If m_SearchResult.Count > 0 Then
+2 -2
View File
@@ -59,5 +59,5 @@ Imports System.Windows
' usando l'asterisco '*' come illustrato di seguito:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.3.6.2")>
<Assembly: AssemblyFileVersion("2.3.6.2")>
<Assembly: AssemblyVersion("2.4.1.2")>
<Assembly: AssemblyFileVersion("2.4.1.2")>
+2 -2
View File
@@ -260,7 +260,7 @@ Public Class NewKeyPageVM
" '" & m_LockID & "', " &
" '" & SelState.ToString() & "', " &
" '" & Format(KeyDate, "yyyy-MM-dd") & "', " &
" '" & m_Note & "', " &
" '" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "', " &
" '" & m_Seriale & "')"
Else
Query = "INSERT INTO " & DB_KEY & " (" & DB_NUMBER & ", " & DB_ISDONGLE & ", " & DB_LOCKID & ", " & DB_STATE & ", " & DB_DATE & ", " & DB_NOTE & ", " & DB_SERIALE & ")" &
@@ -269,7 +269,7 @@ Public Class NewKeyPageVM
" '" & m_LockID & "', " &
" '" & SelState.ToString() & "', " &
" '" & Format(KeyDate, "yyyy-MM-dd") & "', " &
" '" & m_Note & "', " &
" '" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "', " &
" '" & m_Seriale & "')"
End If
ManageDb.ExecuteQuery(Query)
+7 -6
View File
@@ -552,6 +552,7 @@ Public Class NewLicencePageVM
' Nome file
Dim fileName As String = Map.refMainWindowVM.MainWindowM.sKeygenDataDir & "\" & sLicName & ".Kge"
fileName = ManageFile.ComputeFileName(fileName, Path.GetFileNameWithoutExtension(fileName))
' Scrivo il file
Dim StringFile As New List(Of String)
StringFile.Add(";")
@@ -625,7 +626,7 @@ Public Class NewLicencePageVM
Dim textLic As String = File.ReadAllText(Path.ChangeExtension(fileName.Replace("\", "\\"), ".lic"))
If String.IsNullOrEmpty(NestKey) Or String.IsNullOrWhiteSpace(NestKey) Then
Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &
Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &
DB_PRODUCTDEADLINE & ", " & DB_OPTION1 & ", " & DB_OPTION2 & ", " &
DB_OPTIONDEADLINE & ", " & DB_LOCKID & ", " & DB_FILE & ", " &
DB_DATE & ", " & DB_LICFILE & ", " & DB_NOTE & ")" &
@@ -640,9 +641,9 @@ Public Class NewLicencePageVM
"'" & fileName.Replace("\", "\\") & "', " &
"'" & Format(LicenseDate, "yyyy-MM-dd") & "', " &
"'" & textLic & "', " &
"'" & m_Note & "')"
Else
Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &
"'" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "')"
Else
Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &
DB_PRODUCTDEADLINE & ", " & DB_OPTION1 & ", " & DB_OPTION2 & ", " &
DB_OPTIONDEADLINE & ", " & DB_LOCKID & ", " & DB_FILE & ", " &
DB_DATE & ", " & DB_LICFILE & ", " & DB_NOTE & ", " &
@@ -658,10 +659,10 @@ Public Class NewLicencePageVM
"'" & fileName.Replace("\", "\\") & "', " &
"'" & Format(LicenseDate, "yyyy-MM-dd") & "', " &
"'" & textLic & "', " &
"'" & m_Note & "', " &
"'" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "', " &
"'" & m_NestKey & "', " &
"Date('" & (String.Format("{0:yyyy-MM-dd}", NestDeadline)) & "')" & ")"
End If
End If
ManageDb.ExecuteQuery(Query)
Catch ex As Exception
+2 -1
View File
@@ -120,7 +120,8 @@ Public Class NewResellerPageVM
' Aggiungo un rivenditore al Db
Dim Query As String = "INSERT INTO " & DB_RESELLER &
" (" & DB_RESELLERNAME & ", " & DB_NOTE & ")" &
" VALUES ('" & m_Name & "', '" & m_Note & "')"
" VALUES ('" & m_Name & "', '" &
m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "')"
ManageDb.ExecuteQuery(Query)
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+1 -1
View File
@@ -243,7 +243,7 @@ Public Class SearchKeyPageVM
End If
If Not String.IsNullOrWhiteSpace(Note) Then
EvalWhere(bFirstWhere, Query)
Query &= DB_NOTE & " LIKE '%" & Note & "%' "
Query &= DB_NOTE & " LIKE '%" & Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "%' "
End If
If Not String.IsNullOrWhiteSpace(Seriale) Then
EvalWhere(bFirstWhere, Query)
+22 -6
View File
@@ -121,16 +121,32 @@
Grid.Column="3"
Grid.Row="0"/>
<TextBlock Text="{Binding LockIDMsg}"
Grid.Column="2"
Grid.Row="1"
<Grid Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding LockIDMsg}"
Grid.Column="0"
Style="{StaticResource ParametersTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding LockID}"
Grid.Column="3"
Grid.Row="1"
<EgtWPFLib5:EgtTextBox Text="{Binding LockID}"
Grid.Column="1"
Style="{StaticResource ParameterTextBox}"/>
<TextBlock Text="{Binding KeyNumberMsg}"
Grid.Column="2"
Style="{StaticResource ParametersTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding KeyNumber}"
Grid.Column="3"
Style="{StaticResource ParameterTextBox}"/>
</Grid>
<TextBlock Text="{Binding FileMsg}"
Grid.Column="2"
Grid.Row="2"
+41 -1
View File
@@ -165,6 +165,17 @@ Public Class SearchLicencePageVM
End Set
End Property
Private m_KeyNumber As String
Public Property KeyNumber As String
Get
Return m_KeyNumber
End Get
Set(value As String)
m_KeyNumber = value
NotifyPropertyChanged("KeyNumber")
End Set
End Property
Private m_SerialNumber As String
Public Property SerialNumber As String
Get
@@ -311,6 +322,12 @@ Public Class SearchLicencePageVM
End Get
End Property
Public ReadOnly Property KeyNumberMsg As String
Get
Return "Key number"
End Get
End Property
Public ReadOnly Property FileMsg As String
Get
Return "File"
@@ -553,6 +570,7 @@ Public Class SearchLicencePageVM
Not nDecOption2 = 0 OrElse
Not IsNothing(OptionDeadline) OrElse
Not String.IsNullOrWhiteSpace(LockID) OrElse
Not String.IsNullOrWhiteSpace(KeyNumber) OrElse
Not IsNothing(LicenseDate) OrElse
Not String.IsNullOrWhiteSpace(File) OrElse
Not String.IsNullOrWhiteSpace(SerialNumber) OrElse
@@ -596,6 +614,10 @@ Public Class SearchLicencePageVM
EvalWhere(bFirstWhere, Query)
Query &= DB_LICENCE & "." & DB_LOCKID & " LIKE '%" & LockID & "%' "
End If
If Not String.IsNullOrWhiteSpace(KeyNumber) Then
EvalWhere(bFirstWhere, Query)
Query &= DB_KEY & "." & DB_NUMBER & " = " & KeyNumber & " "
End If
If Not String.IsNullOrWhiteSpace(File) Then
EvalWhere(bFirstWhere, Query)
Query &= DB_FILE & " LIKE '%" & File & "%' "
@@ -823,6 +845,20 @@ Public Class SearchLicence
End Get
End Property
Private m_ClientID As Integer
Public ReadOnly Property ClientID As Integer
Get
Return m_ClientID
End Get
End Property
Private m_ClientName As String
Public ReadOnly Property ClientName As String
Get
Return m_ClientName
End Get
End Property
Sub New(LicenceReader As MySqlDataReader)
MyBase.New(LicenceReader)
If ProductID <> 0 Then
@@ -830,11 +866,15 @@ Public Class SearchLicence
End If
End Sub
Sub New(LicenceReader As MySqlDataReader, ProductList As List(Of Product))
Sub New(LicenceReader As MySqlDataReader, ProductList As List(Of Product), ClientList As List(Of Client))
MyBase.New(LicenceReader)
If ProductID <> 0 Then
m_ProductName = ProductList.Find(Function(x) x.ProductID = ProductID).ProductName
End If
m_ClientID = CInt(LicenceReader(DB_CLIENTID))
If ClientID <> 0 Then
m_ClientName = ClientList.Find(Function(x) x.ClientID = ClientID).Name
End If
End Sub
End Class
+3 -1
View File
@@ -322,7 +322,9 @@ Public Class UpdateKeyPageVM
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 & "' "
Dim Query As String = "UPDATE " & DB_KEY &
" SET " & DB_NOTE & " = '" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") &
"' WHERE " & DB_LOCKID & " = '" & Key.LockID & "' "
Query = Query.TrimEnd(","c, " "c)
ManageDb.ExecuteQuery(Query)
+54 -90
View File
@@ -79,53 +79,53 @@ Public Class UpdateLicencePageVM
Private m_SelVersion As Version
Public Property SelVersion As Version
Get
Return m_SelVersion
End Get
Set(value As Version)
m_SelVersion = value
If Not IsNothing(m_SelVersion) Then
If m_SelVersion.VersionNumber < 22 Then
'Se la Versione è minore di 22 setto la CmBx a " " e la disabilito
SelSubVersion = m_SubVersionList(12)
SubVersion_IsEnabled = False
Else
'Altrimenti abilito la CmBx e la setto al mese corrente
SubVersion_IsEnabled = True
SelSubVersion = SubVersionList(DateTime.Now.Month - 1)
End If
Get
Return m_SelVersion
End Get
Set(value As Version)
m_SelVersion = value
If Not IsNothing(m_SelVersion) Then
If m_SelVersion.VersionNumber < 22 Then
'Se la Versione è minore di 22 setto la CmBx a " " e la disabilito
SelSubVersion = m_SubVersionList(12)
SubVersion_IsEnabled = False
Else
'Altrimenti abilito la CmBx e la setto al mese corrente
SubVersion_IsEnabled = True
SelSubVersion = SubVersionList(DateTime.Now.Month - 1)
End If
NotifyPropertyChanged("SelVersion")
End Set
End If
NotifyPropertyChanged("SelVersion")
End Set
End Property
Private m_SubVersionList As New List(Of String)({"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", String.Empty})
Public ReadOnly Property SubVersionList As List(Of String)
Get
Return m_SubVersionList
End Get
Get
Return m_SubVersionList
End Get
End Property
Private m_SelSubVersion As String
Public Property SelSubVersion As String
Get
Return m_SelSubVersion
End Get
Set(value As String)
m_SelSubVersion = value
NotifyPropertyChanged("SelSubVersion")
End Set
Get
Return m_SelSubVersion
End Get
Set(value As String)
m_SelSubVersion = value
NotifyPropertyChanged("SelSubVersion")
End Set
End Property
Private m_SubVersion_IsEnabled As Boolean
Public Property SubVersion_IsEnabled As Boolean
Get
Return m_SubVersion_IsEnabled
End Get
Set(value As Boolean)
m_SubVersion_IsEnabled = value
NotifyPropertyChanged("SubVersion_IsEnabled")
End Set
Get
Return m_SubVersion_IsEnabled
End Get
Set(value As Boolean)
m_SubVersion_IsEnabled = value
NotifyPropertyChanged("SubVersion_IsEnabled")
End Set
End Property
Private m_ProductLevelList As New List(Of Integer)({1, 5, 10})
@@ -245,7 +245,7 @@ Public Class UpdateLicencePageVM
FilePath = ReplaceSubstring(FilePath, "Soft", "Key")
End If
m_FileName = ComputeFileNameForUpdateNew(FilePath, Path.GetFileNameWithoutExtension(FilePath))
m_FileName = ManageFile.ComputeFileName(FilePath, Path.GetFileNameWithoutExtension(FilePath))
NotifyPropertyChanged("FileName")
End If
End Set
@@ -315,21 +315,21 @@ Public Class UpdateLicencePageVM
End Property
Public ReadOnly Property ProductVersionMsg As String
Get
Return "Product version"
End Get
Get
Return "Product version"
End Get
End Property
Public ReadOnly Property SubVersionMsg As String
Get
Return "Sub version"
End Get
Get
Return "Sub version"
End Get
End Property
Public ReadOnly Property ProductLevelMsg As String
Get
Return "Product level"
End Get
Get
Return "Product level"
End Get
End Property
Public ReadOnly Property ProductDeadlineMsg As String
@@ -442,15 +442,15 @@ Public Class UpdateLicencePageVM
NotifyPropertyChanged("SelVersion")
' Carico elemento della lista SubVersion selezionato precedentemente
If (VersNumber.Length > 2) Then
m_SelSubVersion = m_SubVersionList.FirstOrDefault(Function(vers) vers.Equals(VersNumber.Substring(2, 2)))
m_SelSubVersion = m_SubVersionList.FirstOrDefault(Function(vers) vers.Equals(VersNumber.Substring(2, 2)))
Else
m_SelSubVersion = m_SubVersionList(12) 'Imposto l'elemento String.Empty
m_SelSubVersion = m_SubVersionList(12) 'Imposto l'elemento String.Empty
End If
NotifyPropertyChanged("SelSubVersion")
If m_SelVersion.VersionNumber < 22 Then
SubVersion_IsEnabled = False
SubVersion_IsEnabled = False
Else
SubVersion_IsEnabled = True
SubVersion_IsEnabled = True
End If
SelProductLevel = Licence.ProductLevel
@@ -771,7 +771,7 @@ Public Class UpdateLicencePageVM
End If
If Not IsNothing(Note) Then
EvalWhere(bFirstWhere, Query)
Query &= DB_NOTE & " = '" & m_Note & "' "
Query &= DB_NOTE & " = '" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "' "
End If
' Alla fine in ogni caso aggiorniamo anche NestKey e NestDeadline
@@ -903,7 +903,7 @@ Public Class UpdateLicencePageVM
Dim textLic As String = File.ReadAllText(Path.ChangeExtension(FilePath.Replace("\", "\\"), ".lic"))
If String.IsNullOrEmpty(NestKey) Or String.IsNullOrWhiteSpace(NestKey) Then
Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &
Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &
DB_PRODUCTDEADLINE & ", " & DB_OPTION1 & ", " & DB_OPTION2 & ", " &
DB_OPTIONDEADLINE & ", " & DB_LOCKID & ", " & DB_FILE & ", " &
DB_DATE & ", " & DB_LICFILE & ", " & DB_NOTE & ")" &
@@ -918,8 +918,8 @@ Public Class UpdateLicencePageVM
"'" & FilePath.Replace("\", "\\") & "', " &
"'" & Format(LicenseDate, "yyyy-MM-dd") & "', " &
"'" & textLic & "', " &
"'" & m_Note & "')"
Else
"'" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "')"
Else
Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &
DB_PRODUCTDEADLINE & ", " & DB_OPTION1 & ", " & DB_OPTION2 & ", " &
DB_OPTIONDEADLINE & ", " & DB_LOCKID & ", " & DB_FILE & ", " &
@@ -932,11 +932,11 @@ Public Class UpdateLicencePageVM
"'" & nDecOption1 & "', " &
"'" & nDecOption2 & "', " &
"Date('" & (String.Format("{0:yyyy-MM-dd}", OptionDeadline)) & "'), " &
"'" & LockID & "', " &
"'" & LockId & "', " &
"'" & FilePath.Replace("\", "\\") & "', " &
"'" & Format(LicenseDate, "yyyy-MM-dd") & "', " &
"'" & textLic & "', " &
"'" & m_Note & "', " &
"'" & m_Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "', " &
"'" & m_NestKey & "', " &
"Date('" & (String.Format("{0:yyyy-MM-dd}", NestDeadline)) & "')" & ")"
End If
@@ -969,42 +969,6 @@ Public Class UpdateLicencePageVM
End If
End Sub
Private Function ComputeFileNameForUpdateNew(FilePath As String, FileNameOnly As String) As String
' Resetto il nome del file (in modo che sia senza '_' e numero) e cerco nel DB se è già presente un file con lo stesso nome
FilePath = Path.GetDirectoryName(FilePath) & "\" & FileNameOnly.Split("_")(0) & ".Kge"
FilePath = FilePath.Replace("\", "\\")
Dim sFileNameQuery = "SELECT * FROM " & DB_LICENCE & " WHERE " & DB_FILE & " = '" & FilePath & "' "
Dim m_UpdateLicDict As Dictionary(Of String, String) = ManageDb.ExecuteStringDictionaryQuery(sFileNameQuery)
If m_UpdateLicDict.ContainsKey(DB_FILE) AndAlso Not String.IsNullOrEmpty(m_UpdateLicDict(DB_FILE)) Then
' Se il nome del file già esiste procedo col loop per il calcolo del numero dopo '_'
FilePath = FilePath.Replace("\\", "\")
Dim fileNumber As Integer = 0
Do
FilePath = FilePath.Replace("\", "\\")
sFileNameQuery = "SELECT * FROM " & DB_LICENCE & " WHERE " & DB_FILE & " = '" & FilePath & "' "
m_UpdateLicDict = ManageDb.ExecuteStringDictionaryQuery(sFileNameQuery)
If m_UpdateLicDict.ContainsKey(DB_FILE) AndAlso Not String.IsNullOrEmpty(m_UpdateLicDict(DB_FILE)) Then
'The file does exist, so increment and try the next one
fileNumber = fileNumber + 1
FilePath = FilePath.Replace("\\", "\")
If fileNumber = 1 Then
FilePath = FilePath.Replace(".Kge", "") & "_1.Kge"
Else
FilePath = FilePath.Replace((fileNumber - 1).ToString & ".Kge", "") & fileNumber.ToString & ".Kge"
End If
Else
'The file does not exist, do something..
If fileNumber = 1 Then
FilePath = FilePath.Split("_")(0) & "_1.Kge"
End If
Exit Do
End If
Loop
End If
FilePath = FilePath.Replace("\\", "\")
Return FilePath
End Function
#End Region ' Search
#Region "Cancel"
+1 -1
View File
@@ -130,7 +130,7 @@ Public Class UpdateResellerPageVM
End If
If Not String.IsNullOrWhiteSpace(Note) Then
EvalWhere(bFirstWhere, Query)
Query &= DB_NOTE & " = '" & Note & "' "
Query &= DB_NOTE & " = '" & Note.Replace("\", "\\").Replace("'", "\'").Replace("""", "\""").Replace("%", "\%") & "' "
End If
Query &= "WHERE " & DB_RESELLERID & " = " & IdToUpdate
Query = Query.TrimEnd(","c, " "c)
+2 -2
View File
@@ -376,7 +376,7 @@ Module ManageDb
Return LicenceList
End Function
Friend Function ExecuteExpiringLicenceQuery(MySqlQuery As String, ProductList As List(Of Product)) As List(Of SearchLicence)
Friend Function ExecuteExpiringLicenceQuery(MySqlQuery As String, ProductList As List(Of Product), ClientList As List(Of Client)) As List(Of SearchLicence)
Dim LicenceList As New List(Of SearchLicence)
Try
Using DbConnection As New MySqlConnection(m_DbPath)
@@ -384,7 +384,7 @@ Module ManageDb
Using Command As MySqlCommand = New MySqlCommand(MySqlQuery, DbConnection)
Using Reader As MySqlDataReader = Command.ExecuteReader()
While Reader.Read()
LicenceList.Add(New SearchLicence(Reader, ProductList))
LicenceList.Add(New SearchLicence(Reader, ProductList, ClientList))
End While
End Using
End Using
+41
View File
@@ -0,0 +1,41 @@
Imports System.IO
Module ManageFile
Public Function ComputeFileName(FilePath As String, FileNameOnly As String) As String
' Resetto il nome del file (in modo che sia senza '_' e numero) e cerco nel DB se è già presente un file con lo stesso nome
FilePath = Path.GetDirectoryName(FilePath) & "\" & FileNameOnly.Split("_")(0) & ".Kge"
FilePath = FilePath.Replace("\", "\\")
Dim sFileNameQuery = "SELECT * FROM " & DB_LICENCE & " WHERE " & DB_FILE & " = '" & FilePath & "' "
Dim m_UpdateLicDict As Dictionary(Of String, String) = ManageDb.ExecuteStringDictionaryQuery(sFileNameQuery)
If m_UpdateLicDict.ContainsKey(DB_FILE) AndAlso Not String.IsNullOrEmpty(m_UpdateLicDict(DB_FILE)) Then
' Se il nome del file già esiste procedo col loop per il calcolo del numero dopo '_'
FilePath = FilePath.Replace("\\", "\")
Dim fileNumber As Integer = 0
Do
FilePath = FilePath.Replace("\", "\\")
sFileNameQuery = "SELECT * FROM " & DB_LICENCE & " WHERE " & DB_FILE & " = '" & FilePath & "' "
m_UpdateLicDict = ManageDb.ExecuteStringDictionaryQuery(sFileNameQuery)
If m_UpdateLicDict.ContainsKey(DB_FILE) AndAlso Not String.IsNullOrEmpty(m_UpdateLicDict(DB_FILE)) Then
'The file does exist, so increment and try the next one
fileNumber = fileNumber + 1
FilePath = FilePath.Replace("\\", "\")
If fileNumber = 1 Then
FilePath = FilePath.Replace(".Kge", "") & "_1.Kge"
Else
FilePath = FilePath.Replace((fileNumber - 1).ToString & ".Kge", "") & fileNumber.ToString & ".Kge"
End If
Else
'The file does not exist, do something..
If fileNumber = 1 Then
FilePath = FilePath.Split("_")(0) & "_1.Kge"
End If
Exit Do
End If
Loop
End If
FilePath = FilePath.Replace("\\", "\")
Return FilePath
End Function
End Module