70 lines
2.5 KiB
VB.net
70 lines
2.5 KiB
VB.net
Imports bdGrupoSanchoToro.db
|
|
Imports DevExpress.Xpf.Core
|
|
Imports bdGrupoSanchoToro.db.Utilidades
|
|
Imports bdGrupoSanchoToro
|
|
Imports System.Linq.Dynamic.Core
|
|
Imports Microsoft.EntityFrameworkCore
|
|
|
|
Public Class dxwCodigosPostales
|
|
Friend CodigoMunicipio As String
|
|
Friend CodigoPostal As String
|
|
Private _CodigoPostal As String
|
|
Friend _bd As tscGrupoSanchoToro
|
|
|
|
Private Sub btAceptar_Click(sender As Object, e As RoutedEventArgs)
|
|
If gc.CurrentItem IsNot Nothing Then
|
|
Dim cp = DirectCast(gc.CurrentItem, codigospostales)
|
|
CodigoMunicipio = cp.CodigoMunicipio
|
|
CodigoPostal = cp.CodigoPostal
|
|
Me.DialogResult = True
|
|
Me.Close()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btCancelar_Click(sender As Object, e As RoutedEventArgs)
|
|
Me.DialogResult = False
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub dxwCodigosPostales_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
|
Try
|
|
|
|
If _CodigoPostal <> "" Then
|
|
Me.gc.ItemsSource = _bd.codigospostales.Include(Function(x) x.CodigoMunicipioNavigation.CodigoProvinciaNavigation).Where(Function(x) x.CodigoPostal = _CodigoPostal).OrderBy(Function(x) x.CodigoMunicipioNavigation.Nombre).ToList
|
|
Else
|
|
Me.gc.ItemsSource = _bd.codigospostales.Include(Function(x) x.CodigoMunicipioNavigation.CodigoProvinciaNavigation).OrderBy(Function(x) x.CodigoMunicipioNavigation.Nombre).ToList
|
|
End If
|
|
Me.gc.View.SearchControl.Focus()
|
|
Catch ex As Exception
|
|
DXMessageBox.Show(ex.Message, "Error")
|
|
Finally
|
|
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
|
End Try
|
|
End Sub
|
|
|
|
'Public Sub New(bd As m3academiaEntities, Existentes As List(Of Integer?))
|
|
Public Sub New(bd As tscGrupoSanchoToro, CodigoPostal As String)
|
|
|
|
' Llamada necesaria para el diseñador.
|
|
InitializeComponent()
|
|
Comun.EscalaVentana(Me, Me.grid.LayoutTransform)
|
|
_CodigoPostal = CodigoPostal
|
|
_bd = bd
|
|
' _existentes = Existentes
|
|
|
|
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub dxw_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles Me.PreviewKeyDown
|
|
If e.Key = Key.Enter Then
|
|
btAceptar_Click(Nothing, Nothing)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub tv_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs) Handles tv.MouseDoubleClick
|
|
btAceptar_Click(Nothing, Nothing)
|
|
End Sub
|
|
End Class
|