LicenceManager 2.1c6:
- Aggiunto il campo "Note" di tipo LONGTEXT ai rivenditori, nel DB e nelle ResellerPage. Può essere Null.
This commit is contained in:
@@ -35,5 +35,6 @@
|
||||
Public Const DB_RESELLERNAME As String = "ResellerName"
|
||||
Public Const DB_DATE As String = "Date"
|
||||
Public Const DB_LICFILE As String = "LicFile"
|
||||
Public Const DB_NOTE As String = "Note"
|
||||
|
||||
End Module
|
||||
|
||||
+14
-1
@@ -352,14 +352,27 @@ Public Class Reseller
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ResellerName As String, ResellerID As Integer)
|
||||
Private m_Note As String
|
||||
Public ReadOnly Property Note As String
|
||||
Get
|
||||
Return m_Note
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ResellerName As String, ResellerID As Integer, Note As String)
|
||||
m_ResellerName = ResellerName
|
||||
m_ResellerID = ResellerID
|
||||
m_Note = Note
|
||||
End Sub
|
||||
|
||||
Sub New(ResellerReader As MySqlDataReader)
|
||||
m_ResellerName = CType(ResellerReader(DB_RESELLERNAME), String)
|
||||
m_ResellerID = CInt(ResellerReader(DB_RESELLERID))
|
||||
If (Not ResellerReader(DB_NOTE).Equals(DBNull.Value)) Then
|
||||
m_Note = CType(ResellerReader(DB_NOTE), String)
|
||||
Else
|
||||
m_Note = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -27,7 +27,8 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding NameMsg}"
|
||||
Grid.Column="0"
|
||||
@@ -39,7 +40,17 @@
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource ParameterTextBox}"/>
|
||||
|
||||
<Button Content="{Binding AddMsg}"
|
||||
<TextBlock Text="{Binding NoteMsg}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource ParametersTextBlock}"/>
|
||||
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding Note}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource ParameterTextBox}"/>
|
||||
|
||||
<Button Content="{Binding AddMsg}"
|
||||
Command="{Binding AddReseller_Command}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
|
||||
@@ -12,9 +12,9 @@ Public Class NewResellerPageVM
|
||||
End Get
|
||||
Set(value As String)
|
||||
If Not String.IsNullOrWhiteSpace(value) Then
|
||||
' Verifico se valore inserito già esistente
|
||||
Dim Query As String = "SELECT COUNT(" & DB_RESELLERNAME & ") AS " & DB_MAXNUMBER & " FROM " & DB_RESELLER & " WHERE " & DB_RESELLERNAME & " = '" & value & "'" ' COLLATE NOCASE"
|
||||
If ExecuteNumberQuery(Query) = 0 Then
|
||||
' Verifico se valore inserito già esistente
|
||||
Dim Query As String = "SELECT COUNT(" & DB_RESELLERNAME & ") AS " & DB_MAXNUMBER & " FROM " & DB_RESELLER & " WHERE " & DB_RESELLERNAME & " = '" & value & "'" ' COLLATE NOCASE"
|
||||
If ExecuteNumberQuery(Query) = 0 Then
|
||||
m_Name = value
|
||||
Else
|
||||
MessageBox.Show("Il Rivenditore inserito esiste già!!")
|
||||
@@ -24,6 +24,17 @@ Public Class NewResellerPageVM
|
||||
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_cmdAddReseller As Command
|
||||
Private m_cmdCancel As Command
|
||||
@@ -43,6 +54,12 @@ Public Class NewResellerPageVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property NoteMsg As String
|
||||
Get
|
||||
Return "Note"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AddMsg As String
|
||||
Get
|
||||
Return "Add"
|
||||
@@ -74,6 +91,9 @@ Public Class NewResellerPageVM
|
||||
' Svuoto campi
|
||||
Name = String.Empty
|
||||
NotifyPropertyChanged("Name")
|
||||
|
||||
Note = String.Empty
|
||||
NotifyPropertyChanged("Note")
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
@@ -94,9 +114,13 @@ Public Class NewResellerPageVM
|
||||
|
||||
Public Sub AddReseller(ByVal param As Object)
|
||||
If Not String.IsNullOrWhiteSpace(Name) Then
|
||||
If String.IsNullOrWhiteSpace(Note) Then
|
||||
Note = ""
|
||||
End If
|
||||
' Aggiungo un rivenditore al Db
|
||||
Dim Query As String = "INSERT INTO " & DB_RESELLER & " (" & DB_RESELLERNAME & ")" &
|
||||
" VALUES ('" & m_Name & "')"
|
||||
Dim Query As String = "INSERT INTO " & DB_RESELLER &
|
||||
" (" & DB_RESELLERNAME & ", " & DB_NOTE & ")" &
|
||||
" VALUES ('" & m_Name & "', '" & m_Note & "')"
|
||||
ManageDb.ExecuteQuery(Query)
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
<DataGridTextColumn Header="Reseller"
|
||||
Binding="{Binding Name, Mode=OneWay}"
|
||||
Width="1*"/>
|
||||
<DataGridTextColumn Header="Note"
|
||||
Binding="{Binding Note, Mode=OneWay}"
|
||||
Width="1*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
@@ -29,6 +29,17 @@ Public Class SearchResellerPageVM
|
||||
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
|
||||
|
||||
Dim m_SearchResult As ObservableCollection(Of SearchReseller)
|
||||
Public ReadOnly Property SearchResult As ObservableCollection(Of SearchReseller)
|
||||
Get
|
||||
@@ -204,11 +215,13 @@ Public Class SearchResellerPageVM
|
||||
|
||||
Public Sub Update(ByVal param As Object)
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
' Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.UPDATERESELLER
|
||||
' Map.refUpdateResellerPageVM.IdToUpdate = m_SelSearchResult.ResellerID
|
||||
Map.refUpdateResellerPageVM.IdToUpdate = m_SelSearchResult.ResellerID
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.UPDATERESELLER
|
||||
If Not IsNothing(m_SelSearchResult) Then
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Map.refUpdateResellerPageVM.IdToUpdate = m_SelSearchResult.ResellerID
|
||||
Map.refMainWindowVM.SelProjectMode = MainWindowVM.ProjectModeOpt.UPDATERESELLER
|
||||
Else
|
||||
MessageBox.Show("Non è stato selezionato nessun rivenditore")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -262,9 +275,21 @@ Public Class SearchReseller
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_Note As String
|
||||
Public ReadOnly Property Note As String
|
||||
Get
|
||||
Return m_Note
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ClientReader As MySqlDataReader)
|
||||
MyBase.New(ClientReader)
|
||||
m_Name = CType(ClientReader(DB_RESELLERNAME), String)
|
||||
If (Not ClientReader(DB_NOTE).Equals(DBNull.Value)) Then
|
||||
m_Note = CType(ClientReader(DB_NOTE), String)
|
||||
Else
|
||||
m_Note = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -40,6 +40,16 @@
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource ParameterTextBox}"/>
|
||||
|
||||
<TextBlock Text="{Binding NoteMsg}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource ParametersTextBlock}"/>
|
||||
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding Note}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource ParameterTextBox}"/>
|
||||
|
||||
<UniformGrid Grid.Row="3"
|
||||
Columns="2"
|
||||
Grid.ColumnSpan="2">
|
||||
|
||||
@@ -26,6 +26,17 @@ Public Class UpdateResellerPageVM
|
||||
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
|
||||
@@ -44,6 +55,12 @@ Public Class UpdateResellerPageVM
|
||||
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"
|
||||
@@ -72,13 +89,15 @@ Public Class UpdateResellerPageVM
|
||||
#Region "METHODS"
|
||||
|
||||
Friend Sub InitUpdateResellerPage()
|
||||
' Svuoto campi
|
||||
' Name = String.Empty
|
||||
Dim Query As String = "SELECT " & DB_RESELLERNAME & " FROM " & DB_RESELLER &
|
||||
' Svuoto campi
|
||||
' Name = String.Empty
|
||||
Dim Query As String = "SELECT * FROM " & DB_RESELLER &
|
||||
" WHERE " & DB_RESELLERID & " LIKE " & IdToUpdate
|
||||
Name = ManageDb.ExecuteStringQuery(Query, DB_RESELLERNAME)(0)
|
||||
NotifyPropertyChanged("Name")
|
||||
End Sub
|
||||
Name = ManageDb.ExecuteStringQuery(Query, DB_RESELLERNAME)(0)
|
||||
NotifyPropertyChanged("Name")
|
||||
Note = ManageDb.ExecuteStringQuery(Query, DB_NOTE)(0)
|
||||
NotifyPropertyChanged("Note")
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
@@ -99,12 +118,19 @@ Public Class UpdateResellerPageVM
|
||||
Public Sub Update(ByVal param As Object)
|
||||
If Not String.IsNullOrWhiteSpace(Name) Then
|
||||
' Cerco nella tabella Reseller
|
||||
Dim bFirstWhere As Boolean = True
|
||||
Dim Query As String = "UPDATE " & DB_RESELLER
|
||||
If Not String.IsNullOrWhiteSpace(Name) Then
|
||||
If Not String.IsNullOrWhiteSpace(Name) OrElse
|
||||
Not String.IsNullOrWhiteSpace(Note) Then
|
||||
Query &= " SET "
|
||||
If Not String.IsNullOrWhiteSpace(Name) Then
|
||||
EvalWhere(bFirstWhere, Query)
|
||||
Query &= DB_RESELLERNAME & " = '" & Name & "' "
|
||||
End If
|
||||
If Not String.IsNullOrWhiteSpace(Note) Then
|
||||
EvalWhere(bFirstWhere, Query)
|
||||
Query &= DB_NOTE & " = '" & Note & "' "
|
||||
End If
|
||||
Query &= "WHERE " & DB_RESELLERID & " = " & IdToUpdate
|
||||
Query = Query.TrimEnd(","c, " "c)
|
||||
End If
|
||||
@@ -117,6 +143,14 @@ Public Class UpdateResellerPageVM
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub EvalWhere(ByRef bFirst As Boolean, ByRef Query As String)
|
||||
If bFirst Then
|
||||
bFirst = False
|
||||
Else
|
||||
Query &= ", "
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' Update
|
||||
|
||||
#Region "Cancel"
|
||||
|
||||
Reference in New Issue
Block a user