LicenceManager 2.1b1 :
- Primo commit.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<Grid x:Class="UpdateKeyPageV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
DataContext="{StaticResource UpdateKeyPageVM}">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
Height="75"
|
||||
Grid.Row="0">
|
||||
<TextBlock Height="50"
|
||||
Text="{Binding UpdateKeyMsg}"
|
||||
FontSize="30"
|
||||
TextAlignment="Center"/>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding NameMsg}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource ParametersTextBlock}"/>
|
||||
|
||||
<ComboBox ItemsSource="{Binding NameList}"
|
||||
SelectedItem="{Binding SelName}"
|
||||
DisplayMemberPath="Name"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource ParametersComboBox}"/>
|
||||
|
||||
<TextBlock Text="{Binding StateMsg}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource ParametersTextBlock}"/>
|
||||
|
||||
<ComboBox ItemsSource="{Binding StateList}"
|
||||
SelectedItem="{Binding SelState}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource ParametersComboBox}"/>
|
||||
|
||||
<UniformGrid Grid.Row="3"
|
||||
Columns="2"
|
||||
Grid.ColumnSpan="2">
|
||||
<Button Content="{Binding UpdateMsg}"
|
||||
Command="{Binding UpdateKey_Command}"
|
||||
IsDefault="True"
|
||||
Style="{StaticResource Page_Button}"/>
|
||||
<Button Content="{Binding CancelMsg}"
|
||||
Command="{Binding Cancel_Command}"
|
||||
Style="{StaticResource Page_Button}"/>
|
||||
</UniformGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
@@ -0,0 +1,3 @@
|
||||
Class UpdateKeyPageV
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,213 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class UpdateKeyPageVM
|
||||
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_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_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_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
|
||||
|
||||
' 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 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 UpdateMsg As String
|
||||
Get
|
||||
Return "Update"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CancelMsg As String
|
||||
Get
|
||||
Return "Cancel"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
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")
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#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
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
' 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
|
||||
|
||||
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
|
||||
|
||||
#End Region ' Cancel
|
||||
|
||||
#End Region 'COMMANDS
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user