71 lines
2.4 KiB
VB.net
71 lines
2.4 KiB
VB.net
Imports System.Data.Entity
|
|
Imports bdGrupoSanchoToro.db
|
|
Imports DevExpress.Xpf.Core
|
|
Imports bdGrupoSanchoToro.db.Utilidades
|
|
Imports bdGrupoSanchoToro
|
|
|
|
Public Class dxwEntidades
|
|
Friend Entidad As entidades
|
|
Friend _bd As tscGrupoSanchoToro
|
|
Private _EsCliente As Boolean
|
|
Private _EsProveedor As Boolean
|
|
|
|
|
|
Private Sub btAceptar_Click(sender As Object, e As RoutedEventArgs)
|
|
If gc.CurrentItem IsNot Nothing Then
|
|
Dim ent = DirectCast(gc.CurrentItem, entidades)
|
|
Entidad = ent
|
|
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 dxwEntidades_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
|
Try
|
|
|
|
Dim ients = _bd.entidades.Where(Function(x) x.idEmpresa = EmpresaActual.idEmpresa AndAlso x.FechaBaja Is Nothing).Include(Function(x) x.CodigoMunicipioNavigation.CodigoProvinciaNavigation).AsQueryable
|
|
ients = ients.Where(Function(x) (x.EsCliente AndAlso _EsCliente) OrElse (x.EsProveedor AndAlso _EsProveedor))
|
|
Me.gc.ItemsSource = ients.OrderBy(Function(x) x.RazonSocial).ToList
|
|
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, EsCliente As Boolean, EsProveedor As Boolean)
|
|
|
|
' Llamada necesaria para el diseñador.
|
|
InitializeComponent()
|
|
|
|
Comun.EscalaVentana(Me, Me.grid.LayoutTransform)
|
|
|
|
|
|
_EsCliente = EsCliente
|
|
_EsProveedor = EsProveedor
|
|
_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
|