Versión 2
This commit is contained in:
58
GestionGrupoSanchoToro/FicherosMaestros/ucModelosGruas.xaml
Normal file
58
GestionGrupoSanchoToro/FicherosMaestros/ucModelosGruas.xaml
Normal file
@@ -0,0 +1,58 @@
|
||||
<tsWPF:tsUserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:tsWPF="clr-namespace:tsWPFCore;assembly=tsWPFCore" xmlns:bdGrupoSanchoToro="clr-namespace:bdGrupoSanchoToro;assembly=bdGrupoSanchoToro" x:Class="ucModelosGruas"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366">
|
||||
<tsWPF:tsUserControl.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/tsWPFCore;component/Plantillas.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</tsWPF:tsUserControl.Resources>
|
||||
<Grid>
|
||||
<dxlc:LayoutControl Orientation="Vertical">
|
||||
<dxlc:LayoutGroup View="GroupBox" Header="Búsqueda Rápida" Orientation="Vertical" x:Name="BusquedaRapida">
|
||||
<dxlc:LayoutGroup Width="600" HorizontalAlignment="Left" >
|
||||
<dxlc:LayoutGroup Orientation="Vertical">
|
||||
<tsWPF:tsLayoutItem Label="Incluir Bajas:" HorizontalContentAlignment="Left" TabIndex="1" >
|
||||
<dxe:CheckEdit x:Name="cbIncluirBajas" TabIndex="2" />
|
||||
</tsWPF:tsLayoutItem>
|
||||
<tsWPF:tsLayoutItem Label="Búsqueda:" FontWeight="Bold" >
|
||||
<dxe:TextEdit x:Name="teBusqueda" TabIndex="1" FontWeight="Normal" />
|
||||
</tsWPF:tsLayoutItem>
|
||||
</dxlc:LayoutGroup>
|
||||
<Button Content="Buscar" Height="25" Width="100" x:Name="btBuscar" Click="BtBuscar_Click" IsDefault="True" TabIndex="1" />
|
||||
</dxlc:LayoutGroup>
|
||||
<dxlc:LayoutItem Label="Campos de búsqueda:">
|
||||
<Border BorderThickness="1" BorderBrush="Black" >
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="tbCamposBusqueda" Text="Codigo, Marca, Modelo"/>
|
||||
<TextBlock Margin="20,0,0,0" Text="(En Blanco Muestra Todos)" FontWeight="Bold" ></TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</dxlc:LayoutItem>
|
||||
</dxlc:LayoutGroup>
|
||||
<tsWPF:tsGridControl x:Name="gc" >
|
||||
<tsWPF:tsGridControl.PropiedadesTS>
|
||||
<tsWPF:PropiedadesTS Modificable="NoModificable"/>
|
||||
</tsWPF:tsGridControl.PropiedadesTS>
|
||||
<dxg:GridControl.Columns>
|
||||
<dxg:GridColumn FieldName="Codigo" Header="Código" Width="100" IsSmart="True" />
|
||||
<dxg:GridColumn FieldName="Marca" Header="Marca" Width="300" IsSmart="True" CellTemplate="{DynamicResource VerDetalleTemplate}"/>
|
||||
<dxg:GridColumn FieldName="Modelo" Header="Modelo" Width="400" IsSmart="True" />
|
||||
</dxg:GridControl.Columns>
|
||||
<dxg:GridControl.View>
|
||||
<tsWPF:tsTableView ShowSearchPanelMode="Always" ShowGroupPanel="True" />
|
||||
</dxg:GridControl.View>
|
||||
</tsWPF:tsGridControl>
|
||||
</dxlc:LayoutControl>
|
||||
</Grid>
|
||||
</tsWPF:tsUserControl>
|
||||
|
||||
173
GestionGrupoSanchoToro/FicherosMaestros/ucModelosGruas.xaml.vb
Normal file
173
GestionGrupoSanchoToro/FicherosMaestros/ucModelosGruas.xaml.vb
Normal file
@@ -0,0 +1,173 @@
|
||||
|
||||
Imports bdGrupoSanchoToro.db
|
||||
Imports System.Data.Entity
|
||||
Imports DevExpress.Xpf.Core
|
||||
Imports tsWPFCore
|
||||
Imports System.Collections
|
||||
Imports DevExpress.Xpf.Bars
|
||||
Imports System.Threading.Tasks
|
||||
Imports System.Linq.Dynamic
|
||||
Imports Microsoft.EntityFrameworkCore
|
||||
Imports System.Linq.Dynamic.Core
|
||||
Imports bdGrupoSanchoToro.db.Utilidades
|
||||
Imports Microsoft.Win32
|
||||
Imports DevExpress.Spreadsheet
|
||||
Imports bdGrupoSanchoToro.db.modelosgruas
|
||||
Imports System.Drawing
|
||||
|
||||
Public Class ucModelosGruas
|
||||
|
||||
|
||||
Private bd As tscGrupoSanchoToro
|
||||
|
||||
Private CamposBusquedaAlfabeticos() As String = {"marcasgruas.Marca", "Modelo", "Codigo"}
|
||||
|
||||
|
||||
Public Sub New()
|
||||
|
||||
' Esta llamada es exigida por el diseñador.
|
||||
InitializeComponent()
|
||||
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
||||
|
||||
End Sub
|
||||
|
||||
'Public Overrides ReadOnly Property CampoIndice As String
|
||||
' Get
|
||||
' Return ""
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Public Overrides Sub Cargado()
|
||||
Me.GridSeleccion = Me.gc
|
||||
Me.HabilitarRefresco = True
|
||||
'ContenedorAplicacion.btGuardar.IsVisible = False
|
||||
'ContenedorAplicacion.siEstado.IsVisible = False
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Overrides Function EstableceDCPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion
|
||||
If Refrescar OrElse Background Then ObtienemodelosgruasAsync(bd, Background)
|
||||
|
||||
|
||||
Return tsUtilidades.EstadosAplicacion.AplicacionSinIndice
|
||||
|
||||
End Function
|
||||
|
||||
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
|
||||
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub EstableceTitulo()
|
||||
Me.docpanel.Caption = "modelosgruas"
|
||||
End Sub
|
||||
|
||||
Public Overrides ReadOnly Property idRegistroAplicacionActual As String
|
||||
Get
|
||||
Return "modelosgruas"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property NombreTablaBase As String
|
||||
Get
|
||||
Return "modelosgruas"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides ReadOnly Property DescripcionRegistro As String
|
||||
Get
|
||||
Return "modelosgruas"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides Function ObtieneBD() As tsUtilidades.ItsContexto
|
||||
bd = tscGrupoSanchoToro.NuevoContexto()
|
||||
Return bd
|
||||
End Function
|
||||
|
||||
|
||||
Public Overrides Function ObtienePermisos() As tsUtilidades.Permisos
|
||||
Return Comun.ObtienePermisos(Me.bd, "AP.ADMINISTRATIVOS", idUsuario)
|
||||
End Function
|
||||
|
||||
Private Sub Nuevo() Handles Me.BotonNuevoPulsado
|
||||
FuncionesDinamicas.AbrirAP(New ucProducto, OtrosParametros)
|
||||
End Sub
|
||||
|
||||
Private Sub ap_Enlazar(Celda As DevExpress.Xpf.Grid.EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
|
||||
|
||||
Dim pr As modelosgruas = gc.CurrentItem
|
||||
'If pr.Tipo = TipoProductoEnum.TRIBUNA Then
|
||||
' FuncionesDinamicas.AbrirAP(New ucProductoTribuna(pr.idProducto), OtrosParametros)
|
||||
'Else
|
||||
FuncionesDinamicas.AbrirAP(New ucProducto(pr.idProducto), OtrosParametros)
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub ap_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, OpcionGuardado As Integer) Handles Me.AntesGuardar
|
||||
|
||||
End Sub
|
||||
Public Function Obtienemodelosgruas(TextoBusqueda As String, IncluirBajas As Boolean) As List(Of modelosgruas)
|
||||
|
||||
Dim iqPr = bd.modelosgruas.AsQueryable
|
||||
If IncluirBajas = False Then iqPr = iqPr.Where(Function(x) x.FechaBaja Is Nothing)
|
||||
Dim rs As List(Of modelosgruas)
|
||||
Do
|
||||
Dim iNumExc As Integer = 0
|
||||
Try
|
||||
If TextoBusqueda.Trim <> "" Then
|
||||
If TextoBusqueda <> "" Then
|
||||
Dim ExpresionBusqueda = tsWPFCore.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, Nothing, Me.CamposBusquedaAlfabeticos, Nothing)
|
||||
iqPr = iqPr.Where(ExpresionBusqueda)
|
||||
End If
|
||||
End If
|
||||
rs = iqPr.OrderBy(Function(x) x.idMarcaNavigation.Marca).ThenBy(Function(x) x.Modelo).ToList
|
||||
Exit Do
|
||||
Catch ex As Exception
|
||||
iNumExc += 1
|
||||
If iNumExc > 3 Then
|
||||
rs = Nothing
|
||||
Exit Do
|
||||
End If
|
||||
End Try
|
||||
Loop
|
||||
Return rs
|
||||
End Function
|
||||
|
||||
Public Async Sub ObtienemodelosgruasAsync(bd As tscGrupoSanchoToro, Background As Boolean)
|
||||
Try
|
||||
Dim rs As New List(Of modelosgruas)
|
||||
Dim Busqueda = tsEFCore8.Extensiones.ObjetoNothingAVacio(Me.teBusqueda.EditValue)
|
||||
Dim IncluirBajas = Me.cbIncluirBajas.IsChecked
|
||||
If Background Then
|
||||
Me.ContenedorAplicacion.IsEnabled = False
|
||||
Await Task.Run(Sub()
|
||||
rs = Obtienemodelosgruas(Busqueda, IncluirBajas)
|
||||
End Sub)
|
||||
Else
|
||||
If DXSplashScreen.IsActive = False Then DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
|
||||
DXSplashScreen.SetState("Buscando modelosgruas ...")
|
||||
rs = Obtienemodelosgruas(Busqueda, IncluirBajas)
|
||||
End If
|
||||
|
||||
gc.ItemsSource = rs
|
||||
DataContext = rs
|
||||
Catch ex As Exception
|
||||
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
||||
DXMessageBox.Show(ex.Message, "Error")
|
||||
Finally
|
||||
Me.ContenedorAplicacion.IsEnabled = True
|
||||
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub BtBuscar_Click(sender As Object, e As RoutedEventArgs)
|
||||
ObtienemodelosgruasAsync(bd, False)
|
||||
End Sub
|
||||
|
||||
Private Sub ucmodelosgruas_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
teBusqueda.SelectAll()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user