Agregar archivos de proyecto.
This commit is contained in:
2136
Obsoleto/ApCabLin.vb
Normal file
2136
Obsoleto/ApCabLin.vb
Normal file
File diff suppressed because it is too large
Load Diff
557
Obsoleto/ApLineas.vb
Normal file
557
Obsoleto/ApLineas.vb
Normal file
@@ -0,0 +1,557 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.Xpf.Editors
|
||||
Imports System.Data.Objects
|
||||
Imports System.Data.Objects.DataClasses
|
||||
Imports System.Data.Metadata.Edm
|
||||
Imports System.Data
|
||||
Imports System.Collections.Specialized
|
||||
Imports tsl5
|
||||
Imports DevExpress.Xpf.Core
|
||||
Imports DevExpress.Xpf.Core.Native
|
||||
Imports DevExpress.Xpf.Grid
|
||||
Imports System.Data.EntityClient
|
||||
Imports System.Data.Common
|
||||
Imports DevExpress.Xpf.Docking
|
||||
'Imports System.Data.Entity.Core.Objects
|
||||
'Imports System.Data.Entity.Infrastructure
|
||||
Imports DevExpress.Mvvm
|
||||
Imports DevExpress.Xpf.Editors.Settings
|
||||
Imports DevExpress.Xpf.Printing
|
||||
Imports tsWPF.Controles
|
||||
Imports System.Threading.Tasks
|
||||
|
||||
Public Interface IApLineas
|
||||
'Function ConfiguraApLineas(dcfg As Datos.DatosConfiguracionCliente, dcn As Datos.DatosConexionCliente, dsc As Datos.DatosSesionCliente, OtrosParametros As String) As ApLineas
|
||||
Function ObtieneRejilla() As tsGridControl
|
||||
ReadOnly Property Titulo As String
|
||||
' ReadOnly Property CampoIndice As String
|
||||
ReadOnly Property NombreTablaBase As String
|
||||
Function ObtieneContexto(dcn As tsl5.Datos.DatosConexionCliente) As System.Data.Objects.ObjectContext
|
||||
Function ObtieneCampoIndice() As String
|
||||
Sub EstableceDataContext(ByRef DataContext As Object, Optional Background As Boolean = False)
|
||||
Sub EstableceApLin(ApLin As ApLineas)
|
||||
' Sub Editar(Celda As EditGridCellData, Defecto As Boolean)
|
||||
Sub Nuevo()
|
||||
Function ObtienePermisos() As Permisos
|
||||
|
||||
|
||||
End Interface
|
||||
<TypeConverterAttribute(GetType(System.ComponentModel.ExpandableObjectConverter))>
|
||||
Public Class ApLineas
|
||||
' Public WithEvents dm As DockLayoutManager
|
||||
' Public Shared WithEvents tv As TableView
|
||||
Public dcfg As Datos.DatosConfiguracionCliente
|
||||
Public dcn As Datos.DatosConexionCliente
|
||||
Public dsc As Datos.DatosSesionCliente
|
||||
Public OtrosParametros As String
|
||||
Public Titulo As String
|
||||
Public CampoIndice As String
|
||||
Friend DatosCambiados As Boolean
|
||||
Public uc As UserControl
|
||||
Public Rejilla As tsGridControl
|
||||
Public IApLin As IApLineas
|
||||
Public WithEvents Contexto As System.Data.Objects.ObjectContext
|
||||
Public Property Refrescar As Boolean = True
|
||||
Public PermisosConcedidos As Permisos
|
||||
Public Event Cargado()
|
||||
|
||||
Event Enlazar(Celda As EditGridCellData, Defecto As Boolean)
|
||||
|
||||
Event ImprimirPlantilla(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs, idPlantilla As Integer)
|
||||
|
||||
Event EjecutarAccion(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs, idAccion As Integer)
|
||||
|
||||
Event SeleccionMultipleHabilitadoCambiado(Habilitar As Boolean)
|
||||
|
||||
Event InvertirSeleccion()
|
||||
|
||||
Event ValidarSeleccionar()
|
||||
|
||||
Public Event AntesMensajeEliminar(ByRef Cancelar As Boolean, ByRef EliminacionCorrecta As Boolean)
|
||||
Public Event AntesEliminar(Fila As Object, ByRef Cancelar As Boolean)
|
||||
|
||||
' Public Property ErroresValidacion As ErroresValidacion
|
||||
' Public Recargando As Boolean = False
|
||||
|
||||
Property ContenedorL As ContenedorLineas
|
||||
'Private selectionHelper As New SelectionHelper(Of Guid)()
|
||||
Public ElementosSeleccionados As New SelectionHelper(Of Integer)
|
||||
|
||||
|
||||
Public GrupoDocumentos As DocumentGroup
|
||||
Public DocPanel As DevExpress.Xpf.Docking.DocumentPanel
|
||||
|
||||
Public Property RefrescoSolicitado As Boolean = False
|
||||
Public Property DeshabilitarRefresco As Boolean = False
|
||||
Public Property DeshabilitarRefrescarOtrasPestañas = False
|
||||
Public Delegate Sub Ayuda(Codigo As String)
|
||||
' Public Delegate Function Diseño(bd As ObjectContext, Operacion As OperacionDiseñoEnum, apl As ApLineas, ByRef Descripcion As String, ByRef TodosUsuarios As Boolean, DiseñoRejillas As Byte()) As Byte()
|
||||
Public Delegate Sub ErrorNoControlado(Aplicacion As ApLineas, ex As Exception)
|
||||
Public Delegate Sub DelegadoCargado(Aplicacion As ApLineas)
|
||||
Friend Property DelegadoAyuda As Ayuda
|
||||
Friend Property DelegadoDiseño As ApCabLin.Diseño
|
||||
Friend Property DelegadoErrorNoControlado As ErrorNoControlado
|
||||
Friend Property dlgCargado As DelegadoCargado
|
||||
Friend DiseñoOriginal As Byte()
|
||||
Friend Property AperturaAutomatica As Boolean
|
||||
Private DiseñoCargado As Boolean
|
||||
Public ApCargado As Boolean
|
||||
|
||||
|
||||
|
||||
' Public Event Cargado()
|
||||
'Public Event Editar(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
'Public Event Nuevo(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
|
||||
'Sub LanzaEventoCargado()
|
||||
' RaiseEvent Cargado()
|
||||
'End Sub
|
||||
'Sub LanzaEditar(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
' RaiseEvent Editar(sender, e)
|
||||
'End Sub
|
||||
|
||||
Public Overloads Shared Sub AbrirUcL(uc As IApLineas, DocumentGroup As DocumentGroup, dcfg As Datos.DatosConfiguracionCliente, dcn As Datos.DatosConexionCliente, dsc As Datos.DatosSesionCliente, OtrosParametros As String, Optional EditarEnDobleClick As Boolean = True, Optional FuncionAyuda As Ayuda = Nothing, Optional FuncionDiseño As ApCabLin.Diseño = Nothing, Optional FuncionErrorNoControlado As ErrorNoControlado = Nothing, Optional FuncionCargado As DelegadoCargado = Nothing)
|
||||
AbrirUcL(uc, DocumentGroup, dcfg, dcn, 0, dsc, OtrosParametros, EditarEnDobleClick, FuncionAyuda, FuncionDiseño, FuncionErrorNoControlado, FuncionCargado)
|
||||
End Sub
|
||||
Public Overloads Shared Sub AbrirUcL(uc As IApLineas, DocumentGroup As DocumentGroup, dcfg As Datos.DatosConfiguracionCliente, dcn As Datos.DatosConexionCliente, NumeroBD As Integer, dsc As Datos.DatosSesionCliente, OtrosParametros As String, Optional EditarEnDobleClick As Boolean = True, Optional FuncionAyuda As Ayuda = Nothing, Optional FuncionDiseño As ApCabLin.Diseño = Nothing, Optional FuncionErrorNoControlado As ErrorNoControlado = Nothing, Optional FuncionCargado As DelegadoCargado = Nothing)
|
||||
|
||||
Dim apl As ApLineas
|
||||
Try
|
||||
|
||||
|
||||
Dim bNuevoPanel As Boolean = True
|
||||
|
||||
apl = New tsWPF.ApLineas(uc, uc, dcfg, dcn, dsc, OtrosParametros)
|
||||
Dim usctrl = DirectCast(uc, UserControl)
|
||||
|
||||
Dim docpanel As DevExpress.Xpf.Docking.DocumentPanel
|
||||
|
||||
|
||||
Dim dc = (From p In DocumentGroup.Items Where p.Tag = OtrosParametros)
|
||||
If dc.Count > 0 Then
|
||||
docpanel = dc.First
|
||||
bNuevoPanel = False
|
||||
Else
|
||||
If tsWPF.Configuracion.MostrarBotonCerrarEnPestaña Then DocumentGroup.ClosePageButtonShowMode = ClosePageButtonShowMode.InAllTabPageHeaders
|
||||
If Not DXSplashScreen.IsActive Then
|
||||
DXSplashScreen.Show(Of SplashScreenTecnosis)()
|
||||
DXSplashScreen.SetState("Cargando ...")
|
||||
End If
|
||||
docpanel = New DevExpress.Xpf.Docking.DocumentPanel
|
||||
'docpanel.Tag = apl.uc.GetType.Name
|
||||
docpanel.Tag = OtrosParametros
|
||||
End If
|
||||
|
||||
uc.EstableceApLin(apl)
|
||||
apl.Titulo = apl.IApLin.Titulo
|
||||
apl.GrupoDocumentos = DocumentGroup
|
||||
|
||||
apl.Contexto = uc.ObtieneContexto(dcn)
|
||||
If apl.Contexto IsNot Nothing AndAlso apl.Contexto.Connection.State = ConnectionState.Closed Then apl.AperturaAutomatica = True
|
||||
apl.CampoIndice = uc.ObtieneCampoIndice
|
||||
apl.DocPanel = docpanel
|
||||
apl.PermisosConcedidos = uc.ObtienePermisos
|
||||
If Not apl.PermisosConcedidos.Consultar Then Throw New Exception("No tiene permiso para abrir esta aplicación (" & uc.Titulo & ")")
|
||||
apl.Rejilla = uc.ObtieneRejilla
|
||||
apl.Rejilla.PropiedadesTSGC.PermisosDefecto = apl.PermisosConcedidos
|
||||
Dim tv As TableView = apl.Rejilla.View
|
||||
|
||||
apl.Rejilla.View.ShowSearchPanelCloseButton = False
|
||||
apl.Rejilla = uc.ObtieneRejilla
|
||||
apl.Rejilla.View.AllowEditing = True
|
||||
apl.Rejilla.View.SearchPanelFindMode = FindMode.Always
|
||||
|
||||
apl.Rejilla.View.ShowSearchPanel(True)
|
||||
|
||||
For Each c In apl.Rejilla.Columns
|
||||
'c.AllowEditing = DevExpress.Utils.DefaultBoolean.False
|
||||
If c.CellTemplate Is Nothing Then
|
||||
c.ReadOnly = True
|
||||
Else
|
||||
c.AllowEditing = DevExpress.Utils.DefaultBoolean.False
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Dim es As New CheckEditSettings
|
||||
es.IsThreeState = False
|
||||
|
||||
Dim dt As New DataTemplate
|
||||
dt.VisualTree = New FrameworkElementFactory(GetType(CheckEdit))
|
||||
dt.VisualTree.SetBinding(CheckEdit.IsCheckedProperty, New Binding("Data.tswpf_seleccionar"))
|
||||
dt.VisualTree.SetValue(CheckEdit.HorizontalAlignmentProperty, HorizontalAlignment.Center)
|
||||
|
||||
If Not apl.Rejilla.Columns.Any(Function(x) x.FieldName = "tswpf_seleccionar") Then
|
||||
Dim gcseleccionar As New GridColumn With {
|
||||
.FieldName = "tswpf_seleccionar",
|
||||
.UnboundType = DevExpress.Data.UnboundColumnType.Boolean,
|
||||
.Width = 80,
|
||||
.IsSmart = True,
|
||||
.Visible = False,
|
||||
.VisibleIndex = 0,
|
||||
.EditSettings = es,
|
||||
.AllowEditing = DevExpress.Utils.DefaultBoolean.True,
|
||||
.Header = "Seleccionar",
|
||||
.HorizontalHeaderContentAlignment = HorizontalAlignment.Center,
|
||||
.CellTemplate = dt
|
||||
}
|
||||
apl.Rejilla.Columns.Insert(0, gcseleccionar)
|
||||
End If
|
||||
|
||||
AddHandler apl.Rejilla.CustomUnboundColumnData, AddressOf apl.CustomUnboudColumnData
|
||||
|
||||
If EditarEnDobleClick Then AddHandler apl.Rejilla.MouseDoubleClick, AddressOf apl.RejillaDobleClick
|
||||
Dim ap As New tsWPF.ContenedorLineas(apl, uc)
|
||||
ap.btNuevo.IsEnabled = apl.PermisosConcedidos.Nuevos
|
||||
ap.btEliminar.IsEnabled = False 'apl.PermisosConcedidos.Eliminar and ElementosSeleccionados.GetSelectionCount >0 and apl.ContenedorL.btSeleccionar.IsChecked=True
|
||||
|
||||
|
||||
|
||||
If bNuevoPanel Then
|
||||
apl.DelegadoAyuda = FuncionAyuda
|
||||
apl.DelegadoDiseño = FuncionDiseño
|
||||
apl.DelegadoErrorNoControlado = FuncionErrorNoControlado
|
||||
apl.dlgCargado = FuncionCargado
|
||||
docpanel.Caption = uc.Titulo
|
||||
docpanel.Content = ap
|
||||
docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
|
||||
DocumentGroup.Items.Add(docpanel)
|
||||
If Comun.dm Is Nothing Then Comun.dm = DocumentGroup.GetDockLayoutManager
|
||||
apl.ContenedorL.btAyuda.IsVisible = (Not FuncionAyuda Is Nothing)
|
||||
apl.ContenedorL.MenuDiseño.IsVisible = (Not FuncionDiseño Is Nothing)
|
||||
apl.ContenedorL.MenuExportar.IsEnabled = apl.PermisosConcedidos.Exportar
|
||||
'Try
|
||||
' If apl.DelegadoDiseño IsNot Nothing Then
|
||||
' Try
|
||||
' Dim b As Byte() = Nothing
|
||||
|
||||
' b = apl.DelegadoDiseño.Invoke(apl.Contexto, OperacionDiseñoEnum.ABRIR, apl.uc.GetType.ToString, "", True, Nothing)
|
||||
' If b IsNot Nothing Then
|
||||
' apl.DiseñoOriginal = apl.ContenedorL.ObtieneDiseñoActual
|
||||
' Dim ld As New DiseñoRejillas
|
||||
' ld = tsl5.Utilidades.deserializar(System.Text.Encoding.Unicode.GetString(b), ld.GetType)
|
||||
' Dim i As Integer
|
||||
' Dim lg As List(Of tsGridControl) = Nothing
|
||||
' tsWPF.ObtieneHijosDeTipo(Of tsGridControl)(ap.contenido, lg)
|
||||
' For Each l In lg
|
||||
' i += 1
|
||||
' If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
' Try
|
||||
' If ld.Rejillas.Any(Function(x) x.Nombre = l.Name) Then
|
||||
' Dim dr As DiseñoRejilla = ld.Rejillas.Where(Function(x) x.Nombre = l.Name).First
|
||||
' l.RestoreLayoutFromStream(New System.IO.MemoryStream(dr.Diseño))
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' If apl.DelegadoErrorNoControlado IsNot Nothing Then apl.DelegadoErrorNoControlado.Invoke(apl, ex)
|
||||
' DXMessageBox.Show(ex.Message, "Error btDiseño_Itemclick")
|
||||
' 'Debug.Write("Error DelegadoDiseño Rejilla")
|
||||
' End Try
|
||||
' Next
|
||||
' ' Dim drs = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.serializar(ld))
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' If apl.DelegadoErrorNoControlado IsNot Nothing Then apl.DelegadoErrorNoControlado.Invoke(apl, ex)
|
||||
|
||||
' DXMessageBox.Show(ex.Message, "Error AbrirUclL - Diseño")
|
||||
' 'Debug.Write("Error DelegadoDiseño AbrirUCCL")
|
||||
' End Try
|
||||
' End If
|
||||
'Catch ex As Exception
|
||||
' If apl.DelegadoErrorNoControlado IsNot Nothing Then apl.DelegadoErrorNoControlado.Invoke(apl, ex)
|
||||
' DXMessageBox.Show(ex.Message, "Error AbrirUclL - Diseño")
|
||||
'End Try
|
||||
End If
|
||||
Comun.dm.DockController.Activate(docpanel)
|
||||
Catch ex As Exception
|
||||
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
||||
DXMessageBox.Show(ex.Message, "Atención", MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
If FuncionErrorNoControlado IsNot Nothing Then FuncionErrorNoControlado.Invoke(apl, ex)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
'Sub LanzaEventoCargado()
|
||||
' RaiseEvent Cargado()
|
||||
'End Sub
|
||||
|
||||
'Sub LanzaNuevo(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
' RaiseEvent Nuevo(sender, e)
|
||||
'End Sub
|
||||
|
||||
Private Sub RejillaDobleClick(sender As Object, e As MouseButtonEventArgs)
|
||||
Try
|
||||
RaiseEvent Enlazar(Nothing, True)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub New(IApLIN As IApLineas, UC As UserControl, dcfg As tsl5.Datos.DatosConfiguracionCliente, dcn As tsl5.Datos.DatosConexionCliente, dsc As tsl5.Datos.DatosSesionCliente, OtrosParametros As String)
|
||||
Me.uc = UC
|
||||
Me.IApLin = IApLIN
|
||||
Me.dcfg = dcfg
|
||||
Me.dcn = dcn
|
||||
Me.dsc = dsc
|
||||
Me.OtrosParametros = OtrosParametros
|
||||
' Me.Contexto = IApLIN.ObtieneContexto(dcn)
|
||||
AddHandler UC.PreviewKeyDown, AddressOf ApLin_PreviewKeyDown
|
||||
AddHandler UC.Loaded, AddressOf usctrl_Cargado
|
||||
|
||||
|
||||
'Me.IApLin.ObtieneRejilla.DelegadoComando = New DelegateCommand(Of Object)(AddressOf Seleccionar)
|
||||
End Sub
|
||||
|
||||
Private Sub usctrl_Cargado(sender As Object, e As RoutedEventArgs)
|
||||
Try
|
||||
If Me.DelegadoDiseño IsNot Nothing And Not DiseñoCargado Then
|
||||
Try
|
||||
DiseñoCargado = True
|
||||
Dim b As Byte() = Nothing
|
||||
Me.DiseñoOriginal = Me.ContenedorL.ObtieneDiseñoActual
|
||||
b = Me.DelegadoDiseño.Invoke(Me.Contexto, OperacionDiseñoEnum.ABRIR, Me.uc.GetType.ToString, "", True, Nothing)
|
||||
If b IsNot Nothing Then
|
||||
Dim ld As New DiseñoRejillas
|
||||
ld = tsl5.Utilidades.deserializar(System.Text.Encoding.Unicode.GetString(b), ld.GetType)
|
||||
Dim i As Integer
|
||||
Dim lg As List(Of tsGridControl) = Nothing
|
||||
tsWPF.ObtieneHijosDeTipo(Of tsGridControl)(sender, lg)
|
||||
For Each l In lg
|
||||
i += 1
|
||||
If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
Try
|
||||
If ld.Rejillas.Any(Function(x) x.Nombre = l.Name) Then
|
||||
Dim dr As DiseñoRejilla = ld.Rejillas.Where(Function(x) x.Nombre = l.Name).First
|
||||
l.RestoreLayoutFromStream(New System.IO.MemoryStream(dr.Diseño))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
If Me.DelegadoErrorNoControlado IsNot Nothing Then Me.DelegadoErrorNoControlado.Invoke(Me, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error btDiseño_Itemclick")
|
||||
'Debug.Write("Error DelegadoDiseño Rejilla")
|
||||
End Try
|
||||
Next
|
||||
' Dim drs = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.serializar(ld))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
If Me.DelegadoErrorNoControlado IsNot Nothing Then Me.DelegadoErrorNoControlado.Invoke(Me, ex)
|
||||
|
||||
DXMessageBox.Show(ex.Message, "Error AbrirUclL - Diseño")
|
||||
'Debug.Write("Error DelegadoDiseño AbrirUCCL")
|
||||
End Try
|
||||
End If
|
||||
Catch ex As Exception
|
||||
If Me.DelegadoErrorNoControlado IsNot Nothing Then Me.DelegadoErrorNoControlado.Invoke(Me, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error AbrirUclL - Diseño")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub ApLin_PreviewKeyDown(sender As Object, e As KeyEventArgs)
|
||||
If e.Key = Key.Space Or e.Key = Key.Enter Then
|
||||
Try
|
||||
If Keyboard.FocusedElement.GetType = GetType(DevExpress.Xpf.Grid.RowIndicator) Or Keyboard.FocusedElement.GetType = GetType(DevExpress.Xpf.Editors.InplaceBaseEdit) Then
|
||||
Dim cellData = DirectCast(DirectCast(sender, FrameworkElement).DataContext, EditGridCellData)
|
||||
If cellData.Value IsNot Nothing AndAlso cellData.Value.ToString <> "" Then RaiseEvent Enlazar(cellData, True)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Sub LanzaEliminar(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
' Throw New NotImplementedException
|
||||
'End Sub
|
||||
Sub Guardar()
|
||||
Try
|
||||
If Me.Contexto.GetType.GetInterfaces.Contains(GetType(ItsObjectContext)) Then
|
||||
DirectCast(Me.Contexto, ItsObjectContext).GuardarCambios()
|
||||
Else
|
||||
Me.Contexto.SaveChanges()
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
If DelegadoErrorNoControlado IsNot Nothing Then DelegadoErrorNoControlado.Invoke(Me, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error Guardando")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Sub Eliminar()
|
||||
Try
|
||||
Me.Rejilla.View.CommitEditing()
|
||||
Dim bCancelar As Boolean = False
|
||||
Dim bEliminacionCorrecta As Boolean = False
|
||||
RaiseEvent AntesMensajeEliminar(bCancelar, bEliminacionCorrecta)
|
||||
If Not bCancelar Then
|
||||
If DXMessageBox.Show("¿Está seguro de querer eliminar los " & ElementosSeleccionados.GetSelectionCount.ToString & " registros seleccionados?", "Atención", MessageBoxButton.YesNo) = MessageBoxResult.Yes Then
|
||||
|
||||
'For Each k In ElementosSeleccionados.GetSelectedKeys
|
||||
' Me.IApLin.ObtieneContexto(Me.dcn).ExecuteStoreCommand("DELETE FROM " & Me.IApLin.NombreTablaBase & " WHERE " & Me.CampoIndice & "={0}", k)
|
||||
'Next
|
||||
|
||||
|
||||
For Each elemento In ElementosSeleccionados.GetSelectedrwh
|
||||
' RaiseEvent AntesEliminar(Rejilla.GetRowByListIndex(elemento))
|
||||
bCancelar = False
|
||||
RaiseEvent AntesEliminar(Rejilla.GetRow(elemento), bCancelar)
|
||||
If Not bCancelar Then
|
||||
Contexto.DeleteObject(Rejilla.GetRow(elemento))
|
||||
If Contexto.GetType.GetInterfaces.Contains(GetType(ItsObjectContext)) Then
|
||||
DirectCast(Contexto, ItsObjectContext).GuardarCambios()
|
||||
Else
|
||||
Contexto.SaveChanges()
|
||||
End If
|
||||
|
||||
End If
|
||||
' RaiseEvent DespuesEliminar(elemento)
|
||||
Next
|
||||
ElementosSeleccionados = New SelectionHelper(Of Integer)
|
||||
If AperturaAutomatica Then Me.Contexto.Connection.Open()
|
||||
Try
|
||||
Me.IApLin.EstableceDataContext(Me.uc.DataContext)
|
||||
Catch ex As Exception
|
||||
Try
|
||||
If AperturaAutomatica Then Me.Contexto.Connection.Close()
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End Try
|
||||
End If
|
||||
Else
|
||||
If bEliminacionCorrecta Then
|
||||
ElementosSeleccionados = New SelectionHelper(Of Integer)
|
||||
If AperturaAutomatica Then Me.Contexto.Connection.Open()
|
||||
Try
|
||||
Me.IApLin.EstableceDataContext(Me.uc.DataContext)
|
||||
Catch ex As Exception
|
||||
Try
|
||||
If AperturaAutomatica Then Me.Contexto.Connection.Close()
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
||||
If DelegadoErrorNoControlado IsNot Nothing Then DelegadoErrorNoControlado.Invoke(Me, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error Eliminando")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
'Private Sub dm_DockItemActivated(sender As Object, ea As Base.DockItemActivatedEventArgs) Handles dm.DockItemActivated
|
||||
' If Refrescar Then Call RefrescaUC()
|
||||
'End Sub
|
||||
|
||||
Public Sub Seleccionar(Celda As EditGridCellData)
|
||||
If Celda.Value IsNot Nothing AndAlso Celda.ToString <> "" Then RaiseEvent Enlazar(Celda, False)
|
||||
End Sub
|
||||
Public Sub SeleccionarIncluirNulosOVacios(Celda As EditGridCellData)
|
||||
RaiseEvent Enlazar(Celda, False)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub LanzaEventoCargado()
|
||||
Dim gc As tsGridControl = Me.Rejilla.View.DataControl
|
||||
If gc.PropiedadesTSGC.EnlazarNulosOVacios Then
|
||||
gc.ComandoDelegado = New DelegateCommand(Of Object)(AddressOf SeleccionarIncluirNulosOVacios)
|
||||
Else
|
||||
gc.ComandoDelegado = New DelegateCommand(Of Object)(AddressOf Seleccionar)
|
||||
End If
|
||||
RaiseEvent Cargado()
|
||||
Me.ApCargado = True
|
||||
End Sub
|
||||
|
||||
Sub SeleccionarHabilitadoCambiado(Habilitar As Boolean)
|
||||
Me.ContenedorL.Barsm.IsEnabled = Habilitar
|
||||
Me.Rejilla.Columns("tswpf_seleccionar").Visible = Habilitar
|
||||
Me.Rejilla.Columns("tswpf_seleccionar").VisibleIndex = 0
|
||||
Me.ContenedorL.btEliminar.IsEnabled = Me.PermisosConcedidos.Eliminar And ElementosSeleccionados.GetSelectionCount > 0 And Habilitar
|
||||
Me.ContenedorL.btInvertir.IsEnabled = Habilitar
|
||||
RaiseEvent SeleccionMultipleHabilitadoCambiado(Habilitar)
|
||||
' Me.ContenedorL.btImprimirPlantilla.IsEnabled = Habilitar
|
||||
' Me.ContenedorL.bePlantilla.IsEnabled = Habilitar
|
||||
End Sub
|
||||
|
||||
Private Sub CustomUnboudColumnData(sender As Object, e As GridColumnDataEventArgs)
|
||||
If e.Column.FieldName = "tswpf_seleccionar" Then
|
||||
Dim key As Integer = CType(e.GetListSourceFieldValue(Me.CampoIndice), Integer)
|
||||
If e.IsGetData Then
|
||||
e.Value = ElementosSeleccionados.GetIsSelected(key)
|
||||
End If
|
||||
If e.IsSetData Then
|
||||
' ElementosSeleccionados.SetIsSelected(e.Source.GetRowHandleByListIndex(e.ListSourceRowIndex), key, CBool(e.Value))
|
||||
ElementosSeleccionados.SetIsSelected(e.Source.GetRowHandleByListIndex(e.ListSourceRowIndex), key, CBool(e.Value))
|
||||
Me.ContenedorL.btEliminar.IsEnabled = Me.PermisosConcedidos.Eliminar And ElementosSeleccionados.GetSelectionCount > 0 And Me.ContenedorL.btSeleccionar.IsChecked = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub LanzaImprimirPlantilla(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs, idPlantilla As Integer)
|
||||
Me.Rejilla.View.CommitEditing()
|
||||
RaiseEvent ImprimirPlantilla(sender, e, idPlantilla)
|
||||
End Sub
|
||||
|
||||
Sub LanzaEjecutarAccion(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs, idAccion As Integer)
|
||||
Me.Rejilla.View.CommitEditing()
|
||||
RaiseEvent EjecutarAccion(sender, e, idAccion)
|
||||
End Sub
|
||||
|
||||
Public Sub RefrescaUC(Optional BackGround As Boolean = False, Optional IniciaContexto As Boolean = True)
|
||||
|
||||
If IniciaContexto Then
|
||||
Try
|
||||
Me.Contexto = Me.IApLin.ObtieneContexto(Me.dcn)
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
Finally
|
||||
Try
|
||||
If Me.Contexto IsNot Nothing AndAlso AperturaAutomatica AndAlso Me.Contexto.Connection.State <> ConnectionState.Closed Then Me.Contexto.Connection.Close()
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End Try
|
||||
End If
|
||||
'If Not a.DeshabilitarRefresco Then
|
||||
' Me.ContenedorL.t = Task.Run(New Action(Sub() Me.IApLin.EstableceDataContext(Me.uc.DataContext, BackGround)))
|
||||
' If Not BackGround Then Me.ContenedorL.t.Wait()
|
||||
'End If
|
||||
Try
|
||||
' Dim InicializaFilterPopupMode = (Me.Rejilla.ItemsSource Is Nothing)
|
||||
Me.IApLin.EstableceDataContext(Me.uc.DataContext, BackGround)
|
||||
tsGridControl.EstableceFilterPopupModePredeterminados(Me.Rejilla)
|
||||
If Me.ContenedorL.cbPlantillaAImprimir.ItemsSource Is Nothing OrElse Me.ContenedorL.cbPlantillaAImprimir.ItemsSource.Count = 0 OrElse Me.PermisosConcedidos.Impresion = False Then
|
||||
Me.ContenedorL.bePlantilla.IsVisible = False
|
||||
Me.ContenedorL.btImprimirPlantilla.IsVisible = False
|
||||
End If
|
||||
If Me.ContenedorL.cbAcciones.ItemsSource Is Nothing OrElse Me.ContenedorL.cbAcciones.ItemsSource.Count = 0 Then
|
||||
Me.ContenedorL.beAcciones.IsVisible = False
|
||||
Me.ContenedorL.btAcciones.IsVisible = False
|
||||
End If
|
||||
ElementosSeleccionados = New SelectionHelper(Of Integer)
|
||||
'Refrescar = False
|
||||
If Me.dlgCargado IsNot Nothing Then Me.dlgCargado.Invoke(Me)
|
||||
Catch ex As Exception
|
||||
If DelegadoErrorNoControlado IsNot Nothing Then DelegadoErrorNoControlado.Invoke(Me, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error Refrescando")
|
||||
End Try
|
||||
RefrescoSolicitado = False
|
||||
End Sub
|
||||
|
||||
Sub LanzaEventoInvertirSeleccion()
|
||||
RaiseEvent InvertirSeleccion()
|
||||
End Sub
|
||||
|
||||
'Private Sub LanzaSeleccionarCambiado(sender As Object, e As EditorEventArgs)
|
||||
' RaiseEvent SeleccionMultipleHabilitadoCambiado(True)
|
||||
'End Sub
|
||||
|
||||
'Private Sub LanzaSeleccionarCambiado(sender As Object, e As CellValueChangedEventArgs)
|
||||
' RaiseEvent SeleccionMultipleHabilitadoCambiado(True)
|
||||
'End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub Contexto_SavingChanges(sender As Object, e As EventArgs) Handles Contexto.SavingChanges
|
||||
If Me.DeshabilitarRefrescarOtrasPestañas = False Then Comun.RefrescaAplicaciones(Me.GrupoDocumentos.Parent, Nothing, Me.DocPanel.Tag)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
140
Obsoleto/ContenedorCabLin.xaml
Normal file
140
Obsoleto/ContenedorCabLin.xaml
Normal file
@@ -0,0 +1,140 @@
|
||||
<UserControl x:Class="ContenedorCabLin"
|
||||
x:ClassModifier="Public"
|
||||
x:Name="ContenedorCabLin"
|
||||
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:lc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
|
||||
xmlns:my="clr-namespace:tsWPF"
|
||||
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
|
||||
xmlns:local="clr-namespace:tsWPF"
|
||||
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/core"
|
||||
mc:Ignorable="d" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" d:DesignHeight="497" d:DesignWidth="1280" xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar">
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="dxdo:LayoutPanel" x:Key="estilomensaje">
|
||||
<Setter Property="Appearance">
|
||||
<Setter.Value>
|
||||
<dxdo:Appearance>
|
||||
<dxdo:Appearance.Normal>
|
||||
<dxdo:AppearanceObject Background="LightCoral" Foreground="White" />
|
||||
</dxdo:Appearance.Normal>
|
||||
|
||||
<dxdo:Appearance.Active>
|
||||
<dxdo:AppearanceObject Background="LightCoral" Foreground="White" />
|
||||
</dxdo:Appearance.Active>
|
||||
</dxdo:Appearance>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<dxb:BarManager Name="BarraBotones" x:FieldModifier="public" ShowScreenTips="true" AllowCustomization="False" AllowQuickCustomization="False">
|
||||
<dxb:BarManager.Items>
|
||||
<dxb:BarButtonItem Name="btGuardar" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Save/Save_16x16.png" x:FieldModifier="public" Focusable="true" ForceCursor="True" Hint="Guardar" />
|
||||
<dxb:BarButtonItem Name="btActualizar" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Actions/Refresh_16x16.png" x:FieldModifier="public" Focusable="true" ForceCursor="True" ItemClick="btActualizar_ItemClick" Hint="Cargar datos de nuevo" />
|
||||
<dxb:BarSubItem Name="MenuExportar" Glyph="{dx:DXImageGrayscale Image=ExportFile_16x16.png}" x:FieldModifier="public" Focusable="False" Hint="Exportar/Imprimir">
|
||||
<dxb:BarButtonItem Name="btExportar" Glyph="{dx:DXImageGrayscale Image=ExportToXLSX_16x16.png}" x:FieldModifier="public" Focusable="False" Content="Exportar A Excel" ItemClick="BtExportar_ItemClick"/>
|
||||
<dxb:BarButtonItem Name="btCapturar" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/capture.png" Content="Captura Pantalla" ItemClick="BtCapturar_ItemClick" />
|
||||
</dxb:BarSubItem>
|
||||
<dxb:BarButtonItem Name="btNuevo" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Actions/AddItem_32x32.png" x:FieldModifier="public" Focusable="True" Hint="Nuevo" />
|
||||
<dxb:BarButtonItem Name="btEliminar" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/papelera.png" x:FieldModifier="public" Focusable="False" Hint="Eliminar Registro" />
|
||||
<!--<dxb:BarButtonItem Name="btDiseño" Glyph="{dx:DXImageGrayscale Image=Fixed_Column_Width_32x32.png}" x:FieldModifier="public" Focusable="False" Hint="Ayuda" ItemClick="btDiseño_ItemClick" />-->
|
||||
|
||||
<dxb:BarSubItem Name="MenuDiseño" Glyph="{dx:DXImageGrayscale Image=CustomizeGrid_16x16.png}" x:FieldModifier="public" Focusable="False" Hint="Diseño Columnas">
|
||||
<dxb:BarButtonItem Name="btDiseño" Glyph="{dx:DXImageGrayscale Image=CustomizeGrid_16x16.png}" x:FieldModifier="public" Focusable="False" Content="Guardar Diseño Columnas" ItemClick="btDiseño_ItemClick" />
|
||||
<dxb:BarButtonItem Name="btRestaurarDiseño" Glyph="{dx:DXImageGrayscale Image=Columns_16x16.png}" Content="Restaurar Diseño Columnas" ItemClick="btRestaurarDiseño_ItemClick" />
|
||||
<dxb:BarItemSeparator />
|
||||
<dxb:BarButtonItem Name="btAbrirDiseñoGuardado" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/AbrirGrid.png" Content="Abrir Diseño Guardado" ItemClick="btAbrirDiseñoGuardado_ItemClick" />
|
||||
<dxb:BarButtonItem Name="btGuardarDiseñoComo" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/GuardarGrid.png" Content="Guardar Diseño Como ..." ItemClick="btGuardarDiseñoComo_ItemClick" />
|
||||
</dxb:BarSubItem>
|
||||
<dxb:BarButtonItem Name="btAyuda" Glyph="{dx:DXImageGrayscale Image=Index_16x16.png}" x:FieldModifier="public" Focusable="False" Hint="Ayuda" ItemClick="btAyuda_ItemClick" />
|
||||
<dxb:BarStaticItem Name="siEstado" x:FieldModifier="public" Content="Operación Actual:" />
|
||||
<dxb:BarEditItem Name="bePlantilla" x:FieldModifier="public" Focusable="True" IsEnabled="True" Hint="Modelo a Imprimir" ForceCursor="True"
|
||||
EditWidth="300" EditValueChanged="bePlantilla_EditValueChanged">
|
||||
<dxb:BarEditItem.EditSettings>
|
||||
<dxe:ComboBoxEditSettings x:Name="cbPlantillaAImprimir" x:FieldModifier="Public" ValueMember="idPlantilla" DisplayMember="Descripcion" Focusable="True" ForceCursor="True" >
|
||||
</dxe:ComboBoxEditSettings>
|
||||
</dxb:BarEditItem.EditSettings>
|
||||
</dxb:BarEditItem>
|
||||
<dxb:BarButtonItem Name="btImprimirPlantilla" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Print/Print_16x16.png" x:FieldModifier="public" IsEnabled="True" Focusable="True" ItemClick="btImprimirPlantilla_ItemClick" Hint="Imprimir" ForceCursor="True" />
|
||||
<dxb:BarEditItem Name="beAcciones" x:FieldModifier="public" Focusable="True" IsEnabled="True" Hint="Accion a Ejecutar" EditWidth="390" EditValueChanged="beAcciones_EditValueChanged" ForceCursor="True">
|
||||
<dxb:BarEditItem.EditSettings>
|
||||
<dxe:ComboBoxEditSettings x:Name="cbAcciones" x:FieldModifier="Public" ValueMember="idAccion" DisplayMember="Descripcion" Focusable="True" ForceCursor="True"/>
|
||||
</dxb:BarEditItem.EditSettings>
|
||||
</dxb:BarEditItem>
|
||||
<dxb:BarButtonItem Name="btAcciones" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Arrows/Next_16x16.png" x:FieldModifier="public" IsEnabled="True" Focusable="True" ItemClick="btAcciones_ItemClick" Hint="Ejecutar Acción" ForceCursor="True" />
|
||||
<dxb:BarStaticItem Name="siMensaje" ShowBorder="False" >
|
||||
<dxb:BarStaticItem.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" Name="tbMensaje" FontWeight="ExtraBold" />
|
||||
</DataTemplate>
|
||||
</dxb:BarStaticItem.ContentTemplate>
|
||||
</dxb:BarStaticItem>
|
||||
</dxb:BarManager.Items>
|
||||
<dxb:BarManager.Bars>
|
||||
<dxb:Bar AllowDrop="False" AllowHide="False" x:Name="bar1" x:FieldModifier="public" AllowCustomizationMenu="False" AllowQuickCustomization="False" ShowDragWidget="False" ShowSizeGrip="False" AllowCollapse="False" >
|
||||
<dxb:Bar.DockInfo>
|
||||
<dxb:BarDockInfo ContainerType="Top" />
|
||||
</dxb:Bar.DockInfo>
|
||||
<dxb:BarButtonItemLink BarItemName="btGuardar" x:Name="ilGuardar" x:FieldModifier="Public" />
|
||||
<dxb:BarButtonItemLink BarItemName="btActualizar" x:Name="ilActualizar" x:FieldModifier="Public" />
|
||||
<dxb:BarSubItemLink BarItemName="MenuExportar" x:FieldModifier="Public" x:Name="ilExportar" />
|
||||
<dxb:BarButtonItemLink BarItemName="btNuevo" x:Name="ilNuevo" x:FieldModifier="Public" />
|
||||
<dxb:BarButtonItemLink BarItemName="btEliminar" x:Name="ilEliminar" x:FieldModifier="Public" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<dxb:BarSubItemLink BarItemName="MenuDiseño" x:Name="ilDiseño" x:FieldModifier="Public" />
|
||||
<dxb:BarButtonItemLink BarItemName="btAyuda" x:Name="ilAyuda" x:FieldModifier="Public" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<dxb:BarEditItemLink BarItemName="bePlantilla" x:FieldModifier="Public" x:Name="ilPlantilla" />
|
||||
<dxb:BarButtonItemLink BarItemName="btImprimirPlantilla" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<dxb:BarEditItemLink BarItemName="beAcciones" x:FieldModifier="Public" x:Name="ilAcciones" />
|
||||
<dxb:BarButtonItemLink BarItemName="btAcciones" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<dxb:BarStaticItemLink BarItemName="siEstado" x:FieldModifier="Public" x:Name="ilEstado" />
|
||||
<dxb:BarStaticItemLink BarItemName="siMensaje" x:FieldModifier="Public" x:Name="ilMensaje" />
|
||||
</dxb:Bar>
|
||||
</dxb:BarManager.Bars>
|
||||
<dxdo:DockLayoutManager Name="dockManager" ClosedPanelsBarVisibility="Manual">
|
||||
<dxdo:DockLayoutManager.AutoHideGroups>
|
||||
<dxdo:AutoHideGroup DockType="Bottom">
|
||||
<dxdo:LayoutPanel x:Name="lpMensajes" Caption="Mensajes" AllowDockToDocumentGroup="False" AllowDrag="False" AllowFloat="False" AllowMove="False" Visibility="Collapsed" AllowHide="True" IsHitTestVisible="True" AllowDock="True" AllowClose="False" ItemHeight="160" Style="{StaticResource estilomensaje}">
|
||||
<!--<dxdo:LayoutPanel.Appearance>
|
||||
<dxdo:Appearance>
|
||||
<dxdo:Appearance.Normal>
|
||||
<dxdo:AppearanceObject Background="Red" />
|
||||
</dxdo:Appearance.Normal>
|
||||
</dxdo:Appearance>
|
||||
</dxdo:LayoutPanel.Appearance>-->
|
||||
|
||||
<Grid>
|
||||
<Border BorderThickness="1" Background="Beige" BorderBrush="Black" CornerRadius="10">
|
||||
<Grid>
|
||||
<my:tsGridControl x:Name="gcErrores" ItemsSource="{Binding}" AutoPopulateColumns="True">
|
||||
<my:tsGridControl.Columns>
|
||||
<dxg:GridColumn Name="GridColumn1" FieldName="Column" Header="Errores" SortOrder="Ascending" SortIndex="0" />
|
||||
</my:tsGridControl.Columns>
|
||||
<my:tsGridControl.View>
|
||||
<dxg:TableView Name="TableView1" ShowTotalSummary="True" AllowGrouping="False" ShowGroupPanel="False" ShowIndicator="True" ShowSearchPanelCloseButton="True" ShowHorizontalLines="True" AutoWidth="True" AllowEditing="False" />
|
||||
</my:tsGridControl.View>
|
||||
</my:tsGridControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</dxdo:LayoutPanel>
|
||||
</dxdo:AutoHideGroup>
|
||||
</dxdo:DockLayoutManager.AutoHideGroups>
|
||||
<dxdo:LayoutGroup x:Name="RootGroup" Orientation="Horizontal">
|
||||
<dxdo:LayoutGroup Orientation="Vertical">
|
||||
<dxdo:LayoutPanel AllowFloat="False" AllowHide="False" AllowMove="False" ShowCloseButton="False" Name="lpContenido" ShowCaption="False">
|
||||
<Grid Name="contenido" />
|
||||
</dxdo:LayoutPanel>
|
||||
</dxdo:LayoutGroup>
|
||||
</dxdo:LayoutGroup>
|
||||
</dxdo:DockLayoutManager>
|
||||
|
||||
</dxb:BarManager>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
549
Obsoleto/ContenedorCabLin.xaml.vb
Normal file
549
Obsoleto/ContenedorCabLin.xaml.vb
Normal file
@@ -0,0 +1,549 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.Xpf.Core
|
||||
Imports DevExpress.Xpf.Docking
|
||||
Imports System.Windows.Media.Animation
|
||||
Imports DevExpress.Xpf.Core.Native
|
||||
Imports DevExpress.Xpf.Editors
|
||||
Imports System.IO
|
||||
Imports DevExpress.Xpf.Bars
|
||||
Imports DevExpress.Xpf.Grid
|
||||
Imports Microsoft.Win32
|
||||
Imports tsl5.Extensiones
|
||||
Imports DevExpress.Spreadsheet
|
||||
Imports System.Data.Entity.ModelConfiguration.Conventions
|
||||
|
||||
Public Class ContenedorCabLin
|
||||
' Public bd As System.Data.Objects.ObjectContext
|
||||
Public Aplicacion As ApCabLin
|
||||
Public dp As DocumentPanel
|
||||
Dim _DescripcionDiseño As String
|
||||
Dim _TodosUsuariosDiseño As Boolean
|
||||
|
||||
' Private VentanaError As VentanaErr
|
||||
Public Event CargaAplicacion(sender As System.Object, e As System.Windows.RoutedEventArgs)
|
||||
Public Event AntesDeGuardar(sender As System.Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Public Event DespuesDeGuardar(sender As System.Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
'Public Shared ReadOnly EventoLanzaMensaje As RoutedEvent = EventManager.RegisterRoutedEvent("LanzaMensaje", RoutingStrategy.Bubble, GetType(RoutedEventHandler), GetType(ContenedorCabLin))
|
||||
'Public Custom Event LanzaMensaje As RoutedEventHandler
|
||||
' AddHandler(value As RoutedEventHandler)
|
||||
' Me.AddHandler(EventoLanzaMensaje, value)
|
||||
' End AddHandler
|
||||
|
||||
' RemoveHandler(value As RoutedEventHandler)
|
||||
' Me.RemoveHandler(EventoLanzaMensaje, value)
|
||||
' End RemoveHandler
|
||||
|
||||
' RaiseEvent(sender As Object, e As RoutedEventArgs)
|
||||
' Me.RaiseEvent(e)
|
||||
' End RaiseEvent
|
||||
'End Event
|
||||
|
||||
|
||||
Private Sub Cargado(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
|
||||
|
||||
Me.siMensaje.Content = ""
|
||||
RaiseEvent CargaAplicacion(sender, e)
|
||||
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
||||
' Me.Aplicacion.ValidarControles = True
|
||||
End Sub
|
||||
Private Sub Guardar(sender As System.Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs) Handles btGuardar.ItemClick
|
||||
'Dispatcher.BeginInvoke(New Action(Function() ucexpedientes.Estado = EstadosCablin.Nuevo), Windows.Threading.DispatcherPriority.Loaded)
|
||||
'Dispatcher.BeginInvoke(New Action(Sub() Aplicacion.Guardar(sender, e)), Windows.Threading.DispatcherPriority.ContextIdle)
|
||||
Dim Guardado As Boolean
|
||||
Try
|
||||
btGuardar.IsEnabled = False
|
||||
Guardado = Not Aplicacion.Guardar(sender, e)
|
||||
If Me.Aplicacion.Estado = EstadosCablin.AplicacionSinIndice Then btGuardar.IsEnabled = True
|
||||
Finally
|
||||
If Guardado Then
|
||||
Select Case Aplicacion.Estado
|
||||
Case EstadosCablin.ModificandoRegistro
|
||||
btGuardar.IsEnabled = Aplicacion.PermisosConcedidos.Modificar
|
||||
Case EstadosCablin.Nuevo
|
||||
btGuardar.IsEnabled = Aplicacion.PermisosConcedidos.Nuevos
|
||||
End Select
|
||||
Else
|
||||
btGuardar.IsEnabled = True
|
||||
End If
|
||||
End Try
|
||||
End Sub
|
||||
Public Sub New()
|
||||
|
||||
' Llamada necesaria para el diseñador.
|
||||
InitializeComponent()
|
||||
|
||||
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
||||
|
||||
End Sub
|
||||
'Public Sub New(Contenido As ApCabLin, TablaBase As String, Registros As ListCollectionView, Busqueda As DevExpress.Xpf.LayoutControl.LayoutGroup, GridBusqueda As DevExpress.Xpf.Grid.GridControl)
|
||||
' If Not (System.ComponentModel.DesignerProperties.GetIsInDesignMode(Me)) Then
|
||||
|
||||
|
||||
' ' Llamada necesaria para el diseñador.
|
||||
' InitializeComponent()
|
||||
' Aplicacion = Contenido
|
||||
' ' Aplicacion.Contexto = Contexto
|
||||
' Contenido.ContenedorCL = Me
|
||||
' Contenido.Registros = Registros
|
||||
' ' Contenido.ObjetoEntidad = ModeloEntidad
|
||||
' Contenido.NombreTablaBase = TablaBase
|
||||
' Contenido.Busqueda = Busqueda
|
||||
' Contenido.GridBusqueda = GridBusqueda
|
||||
' Me.contenido.Children.Add(Contenido)
|
||||
' AddHandler Me.PreviewKeyDown, AddressOf Aplicacion.ApCabLin_PreviewKeyDown
|
||||
' End If
|
||||
' '' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
||||
|
||||
'End Sub
|
||||
|
||||
'Public Sub New(Contenido As ApCabLin)
|
||||
' If Not (System.ComponentModel.DesignerProperties.GetIsInDesignMode(Me)) Then
|
||||
|
||||
|
||||
' ' Llamada necesaria para el diseñador.
|
||||
' InitializeComponent()
|
||||
' Aplicacion = Contenido
|
||||
' Contenido.ContenedorCL = Me
|
||||
' Me.contenido.Children.Add(Contenido.Aplicacion)
|
||||
|
||||
' AddHandler Me.PreviewKeyDown, AddressOf Aplicacion.ApCabLin_PreviewKeyDown
|
||||
|
||||
' End If
|
||||
'End Sub
|
||||
Private sbDesvanecer As Storyboard = Nothing
|
||||
Public Sub New(Aplicacion As ApCabLin, uc As UserControl, dp As DocumentPanel)
|
||||
If Not (System.ComponentModel.DesignerProperties.GetIsInDesignMode(Me)) Then
|
||||
' Llamada necesaria para el diseñador.
|
||||
InitializeComponent()
|
||||
Me.contenido.Children.Add(uc)
|
||||
Me.Aplicacion = Aplicacion
|
||||
Me.dp = dp
|
||||
Aplicacion.ContenedorCL = Me
|
||||
Dim da As New DoubleAnimation
|
||||
With da
|
||||
.From = 1
|
||||
.To = 0
|
||||
.Duration = New Duration(TimeSpan.FromSeconds(2))
|
||||
.AutoReverse = False
|
||||
End With
|
||||
Storyboard.SetTargetProperty(da, New PropertyPath(OpacityProperty))
|
||||
sbDesvanecer = New Storyboard
|
||||
sbDesvanecer.Children.Add(da)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
' Private Sub mv_CurrentChanged(sender As Object, e As System.EventArgs) Handles mv.CurrentChanged
|
||||
' cabecera = Me.mv.CurrentEditItem
|
||||
'End Sub
|
||||
|
||||
Private Sub Nuevo(sender As System.Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs) Handles btNuevo.ItemClick
|
||||
Me.Aplicacion.ValidarControles = False
|
||||
Me.Aplicacion.DocPanel.Tag = Me.Aplicacion.GetType.Name & "." & Me.Aplicacion.Titulo & ".NUEVO"
|
||||
Aplicacion.Estado = EstadosCablin.Nuevo
|
||||
Me.Aplicacion.ValidarControles = True
|
||||
'Busqueda.Visibility = Windows.Visibility.Collapsed
|
||||
'Busqueda.Visibility = Windows.Visibility.Hidden
|
||||
'btBuscar.IsChecked = False
|
||||
'Cabecera.AddNew()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub btEliminar_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs) Handles btEliminar.ItemClick
|
||||
Aplicacion.Eliminar(sender, e)
|
||||
|
||||
End Sub
|
||||
Friend Sub IniciaAnimacion(Mensaje As String, Color As Color)
|
||||
Try
|
||||
Me.siMensaje.Content = Mensaje
|
||||
Dim tbm As TextBlock = LayoutHelper.FindElementByName(Me.BarraBotones, "tbMensaje")
|
||||
tbm.Foreground = New SolidColorBrush(Color)
|
||||
Storyboard.SetTarget(sbDesvanecer, tbm)
|
||||
BeginStoryboard(sbDesvanecer)
|
||||
Catch ex As Exception
|
||||
Debug.Write(ex.Message)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub btImprimirPlantilla_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Dim oa = Me.Aplicacion.ObjetoActual
|
||||
Dim be As BaseEdit = Nothing
|
||||
Try
|
||||
be = LayoutHelper.FindParentObject(Of BaseEdit)(oa)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
If Not be Is Nothing Then
|
||||
Select Case be.GetType
|
||||
Case GetType(TextEdit), GetType(PasswordBoxEdit), GetType(ButtonEdit), GetType(DateEdit), GetType(ComboBoxEdit), GetType(DevExpress.Xpf.Grid.LookUp.LookUpEdit)
|
||||
Dim expression = be.GetBindingExpression(BaseEdit.EditValueProperty)
|
||||
If Configuracion.ComportamientoValidacion = Validation.InvalidValueBehavior.AllowLeaveEditor Then
|
||||
be.DoValidate()
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
Else
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
be.DoValidate()
|
||||
End If
|
||||
Case GetType(CheckEdit)
|
||||
End Select
|
||||
End If
|
||||
|
||||
|
||||
'Dim be As BaseEdit = LayoutHelper.FindParentObject(Of BaseEdit)(Keyboard.FocusedElement)
|
||||
'If Not be Is Nothing Then
|
||||
' Select Case be.GetType
|
||||
' Case GetType(TextEdit), GetType(PasswordBoxEdit), GetType(ButtonEdit), GetType(DateEdit), GetType(ComboBoxEdit), GetType(DevExpress.Xpf.Grid.LookUp.LookUpEdit)
|
||||
' Dim expression = be.GetBindingExpression(BaseEdit.EditValueProperty)
|
||||
' If Not expression Is Nothing Then expression.UpdateSource()
|
||||
' be.DoValidate()
|
||||
' Case GetType(CheckEdit)
|
||||
' End Select
|
||||
'End If
|
||||
Dim idPlantilla As Integer = bePlantilla.EditValue
|
||||
Me.Aplicacion.LanzaImprimirPlantilla(sender, e, idPlantilla)
|
||||
End Sub
|
||||
|
||||
' Private Function FindVisualChild(Of childItem As DependencyObject)(ByVal obj As DependencyObject) As childItem
|
||||
' For i As Integer = 0 To VisualTreeHelper.GetChildrenCount(obj) - 1
|
||||
' Dim child As DependencyObject = VisualTreeHelper.GetChild(obj, i)
|
||||
' If child IsNot Nothing AndAlso TypeOf child Is childItem Then
|
||||
' Return CType(child, childItem)
|
||||
' Else
|
||||
' Dim childOfChild As childItem = FindVisualChild(Of childItem)(child)
|
||||
' If childOfChild IsNot Nothing Then
|
||||
' Return childOfChild
|
||||
' End If
|
||||
' End If
|
||||
' Next i
|
||||
' Return Nothing
|
||||
' End Function
|
||||
|
||||
' Private Sub htIniciaAnimacion(Mensaje As String, Color As Color)
|
||||
|
||||
|
||||
Private Sub btAcciones_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Dim oa = Me.Aplicacion.ObjetoActual
|
||||
Dim be As BaseEdit = Nothing
|
||||
Try
|
||||
be = LayoutHelper.FindParentObject(Of BaseEdit)(oa)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
If Not be Is Nothing Then
|
||||
Select Case be.GetType
|
||||
Case GetType(TextEdit), GetType(PasswordBoxEdit), GetType(ButtonEdit), GetType(DateEdit), GetType(ComboBoxEdit), GetType(DevExpress.Xpf.Grid.LookUp.LookUpEdit)
|
||||
Dim expression = be.GetBindingExpression(BaseEdit.EditValueProperty)
|
||||
If Configuracion.ComportamientoValidacion = Validation.InvalidValueBehavior.AllowLeaveEditor Then
|
||||
be.DoValidate()
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
Else
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
be.DoValidate()
|
||||
End If
|
||||
Case GetType(CheckEdit)
|
||||
End Select
|
||||
End If
|
||||
'Dim be As BaseEdit = LayoutHelper.FindParentObject(Of BaseEdit)(Keyboard.FocusedElement)
|
||||
'If Not be Is Nothing Then
|
||||
' Select Case be.GetType
|
||||
' Case GetType(TextEdit), GetType(PasswordBoxEdit), GetType(ButtonEdit), GetType(DateEdit), GetType(ComboBoxEdit), GetType(DevExpress.Xpf.Grid.LookUp.LookUpEdit)
|
||||
' Dim expression = be.GetBindingExpression(BaseEdit.EditValueProperty)
|
||||
' If Not expression Is Nothing Then expression.UpdateSource()
|
||||
' be.DoValidate()
|
||||
' Case GetType(CheckEdit)
|
||||
' End Select
|
||||
'End If
|
||||
Dim idAccion As Integer = beAcciones.EditValue
|
||||
Me.Aplicacion.LanzaEjecutaAccion(sender, e, idAccion)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btActualizar_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
|
||||
Me.Aplicacion.RefrescaUC(True)
|
||||
End Sub
|
||||
|
||||
Private Sub beAcciones_EditValueChanged(sender As Object, e As RoutedEventArgs)
|
||||
Dim idAccion As Integer = beAcciones.EditValue
|
||||
Dim acs As List(Of Accion) = Me.cbAcciones.ItemsSource
|
||||
Dim ac As Accion = (From a In acs Where a.idAccion = idAccion).First
|
||||
Me.btAcciones.Hint = ac.Descripcion
|
||||
End Sub
|
||||
|
||||
Private Sub bePlantilla_EditValueChanged(sender As Object, e As RoutedEventArgs)
|
||||
Dim idPlantilla As Integer = bePlantilla.EditValue
|
||||
Dim plantillas As List(Of tsWPF.Plantilla) = Me.cbPlantillaAImprimir.ItemsSource
|
||||
Dim pl As Plantilla = (From p In plantillas Where p.idPlantilla = idPlantilla).First
|
||||
Me.btImprimirPlantilla.Hint = "Imprimir " & pl.Descripcion
|
||||
End Sub
|
||||
|
||||
Private Sub ContenedorCabLin_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
|
||||
Try
|
||||
If Aplicacion IsNot Nothing Then
|
||||
If Aplicacion.bdEntidad.Connection.State <> System.Data.ConnectionState.Closed Then Aplicacion.bdEntidad.Connection.Close()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btAyuda_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Me.Aplicacion.DelegadoAyuda.Invoke(Me.Aplicacion.uc.GetType.ToString)
|
||||
End Sub
|
||||
|
||||
Private Sub btDiseño_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Try
|
||||
Dim drs = ObtieneDiseñoActual()
|
||||
Me.Aplicacion.DelegadoDiseño.Invoke(Me.Aplicacion.bdEntidad, OperacionDiseñoEnum.GUARDAR, Me.Aplicacion.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, drs)
|
||||
Catch ex As Exception
|
||||
If Me.Aplicacion.DelegadoErrorNoControlado IsNot Nothing Then Me.Aplicacion.DelegadoErrorNoControlado.Invoke(Me.Aplicacion, ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Friend Function ObtieneDiseñoActual() As Byte()
|
||||
Dim ld As New DiseñoRejillas
|
||||
Dim i As Integer
|
||||
For Each l In Aplicacion.Lineas
|
||||
i += 1
|
||||
If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
Dim dr As New DiseñoRejilla
|
||||
dr.Nombre = l.Name
|
||||
dr.Version = "1"
|
||||
Dim ms As New MemoryStream
|
||||
l.SaveLayoutToStream(ms)
|
||||
dr.Diseño = ms.ToArray
|
||||
ld.Rejillas.Add(dr)
|
||||
Next
|
||||
Dim drs = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(ld))
|
||||
Return drs
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub btRestaurarDiseño_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
|
||||
|
||||
If Aplicacion.DiseñoOriginal IsNot Nothing Then
|
||||
Try
|
||||
Dim ld As New DiseñoRejillas
|
||||
ld = tsl5.Utilidades.deserializar(System.Text.Encoding.Unicode.GetString(Aplicacion.DiseñoOriginal), ld.GetType)
|
||||
Dim i As Integer
|
||||
For Each l In Aplicacion.Lineas
|
||||
i += 1
|
||||
If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
Try
|
||||
If ld.Rejillas.Any(Function(x) x.Nombre = l.Name) Then
|
||||
Dim dr As DiseñoRejilla = ld.Rejillas.Where(Function(x) x.Nombre = l.Name).First
|
||||
l.RestoreLayoutFromStream(New System.IO.MemoryStream(dr.Diseño))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
If Me.Aplicacion.DelegadoErrorNoControlado IsNot Nothing Then Me.Aplicacion.DelegadoErrorNoControlado.Invoke(Me.Aplicacion, ex)
|
||||
' Debug.Write("Error DelegadoDiseño Rejilla")
|
||||
End Try
|
||||
Next
|
||||
Dim drs = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.Serializar(ld))
|
||||
Me.Aplicacion.DelegadoDiseño.Invoke(Me.Aplicacion.bdEntidad, OperacionDiseñoEnum.RESTAURAR_ORIGINAL, Me.Aplicacion.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, drs)
|
||||
Catch ex As Exception
|
||||
If Me.Aplicacion.DelegadoErrorNoControlado IsNot Nothing Then Me.Aplicacion.DelegadoErrorNoControlado.Invoke(Me.Aplicacion, ex)
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btGuardarDiseñoComo_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Try
|
||||
Dim drs = ObtieneDiseñoActual()
|
||||
Me.Aplicacion.DelegadoDiseño.Invoke(Me.Aplicacion.bdEntidad, OperacionDiseñoEnum.GUARDAR_COMO, Me.Aplicacion.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, drs)
|
||||
Catch ex As Exception
|
||||
If Me.Aplicacion.DelegadoErrorNoControlado IsNot Nothing Then Me.Aplicacion.DelegadoErrorNoControlado.Invoke(Me.Aplicacion, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error btDiseñoComo_Itemclick")
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btAbrirDiseñoGuardado_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Dim b = Me.Aplicacion.DelegadoDiseño.Invoke(Me.Aplicacion.bdEntidad, OperacionDiseñoEnum.ABRIR_DISEÑO_GUARDADO, Me.Aplicacion.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, Nothing)
|
||||
If b IsNot Nothing Then
|
||||
Dim ld As New DiseñoRejillas
|
||||
ld = tsl5.Utilidades.deserializar(System.Text.Encoding.Unicode.GetString(b), ld.GetType)
|
||||
Dim i As Integer
|
||||
Dim lg As List(Of tsGridControl) = Nothing
|
||||
tsWPF.ObtieneHijosDeTipo(Of tsGridControl)(Me, lg)
|
||||
For Each l In lg
|
||||
i += 1
|
||||
If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
Try
|
||||
If ld.Rejillas.Any(Function(x) x.Nombre = l.Name) Then
|
||||
Dim dr As DiseñoRejilla = ld.Rejillas.Where(Function(x) x.Nombre = l.Name).First
|
||||
l.RestoreLayoutFromStream(New System.IO.MemoryStream(dr.Diseño))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
If Me.Aplicacion.DelegadoErrorNoControlado IsNot Nothing Then Me.Aplicacion.DelegadoErrorNoControlado.Invoke(Me.Aplicacion, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error btDiseñoGuardado_Itemclick")
|
||||
End Try
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BtCapturar_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Dim sficherojpg = tsl5.Utilidades.ObtieneFicheroAleatorio("jpg")
|
||||
IO.File.WriteAllBytes(sficherojpg, Me.Aplicacion.uc.ObtieneImagen(1, 100))
|
||||
Process.Start(sficherojpg)
|
||||
End Sub
|
||||
|
||||
Private Sub BtExportar_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
|
||||
Dim sfd As New SaveFileDialog
|
||||
sfd.FileName = "Exportacion.xlsx"
|
||||
sfd.Filter = "Fichero Excel (*.xls, *.xlsx|*.xls;*.xlsx"
|
||||
sfd.DefaultExt = ".xlsx"
|
||||
Dim ms As New List(Of Stream)
|
||||
Dim formato As DevExpress.Spreadsheet.DocumentFormat
|
||||
If sfd.ShowDialog Then
|
||||
Dim i As Integer = 0
|
||||
Dim ngc As New tsGridControl
|
||||
For Each oc In Me.Aplicacion.ControlesTS
|
||||
Try
|
||||
Dim gc As New tsGridColumn()
|
||||
gc.FieldName = oc.PropiedadesTS.NombreCampo
|
||||
gc.Header = oc.Label.ToString.TrimEnd(":")
|
||||
gc.Width = oc.Width
|
||||
ngc.Columns.Add(gc)
|
||||
Catch
|
||||
End Try
|
||||
Next
|
||||
ngc.ItemsSource = Me.Aplicacion.DataContext
|
||||
Dim ls = New MemoryStream
|
||||
ngc.View.ExportToXlsx(ls)
|
||||
ms.Add(ls)
|
||||
For Each l In Me.Aplicacion.Lineas
|
||||
Try
|
||||
ls = New MemoryStream
|
||||
ms.Add(ls)
|
||||
Dim vista As TableView = l.View
|
||||
Select Case IO.Path.GetExtension(sfd.FileName).ToLower
|
||||
Case ".xls"
|
||||
vista.ExportToXls(ls)
|
||||
formato = DevExpress.Spreadsheet.DocumentFormat.Xls
|
||||
Case ".xlsx"
|
||||
vista.ExportToXlsx(ls)
|
||||
formato = DevExpress.Spreadsheet.DocumentFormat.Xlsx
|
||||
End Select
|
||||
i += 1
|
||||
Catch
|
||||
End Try
|
||||
Next
|
||||
Dim wb As New Workbook
|
||||
For i = 0 To ms.Count - 1
|
||||
Try
|
||||
Dim wbc As New Workbook
|
||||
ms(i).Position = 0
|
||||
wbc.LoadDocument(ms(i), formato)
|
||||
wb.Worksheets(i).CopyFrom(wbc.Worksheets(0))
|
||||
If i = 0 Then
|
||||
wb.Worksheets(i).Name = Me.Aplicacion.Titulo
|
||||
Else
|
||||
If wb.Worksheets.Any(Function(x) x.Name = Me.Aplicacion.Lineas(i - 1).NombreTablaBase) Then
|
||||
wb.Worksheets(i).Name = (i - 1).ToString
|
||||
Else
|
||||
wb.Worksheets(i).Name = Me.Aplicacion.Lineas(i - 1).NombreTablaBase
|
||||
End If
|
||||
End If
|
||||
If i < ms.Count - 1 Then wb.Worksheets.Add()
|
||||
Catch
|
||||
End Try
|
||||
Next
|
||||
Dim nc As Integer = 0
|
||||
For Each c In Me.Aplicacion.ControlesTS
|
||||
Try
|
||||
Select Case c.Content.GetType
|
||||
Case GetType(CheckEdit)
|
||||
Dim Ce As CheckEdit = c.Content
|
||||
wb.Worksheets(0).Cells(1, nc).SetValue(If(Ce.IsChecked, "SI", "NO"))
|
||||
|
||||
Case GetType(ButtonEdit)
|
||||
Dim te As ButtonEdit = c.Content
|
||||
wb.Worksheets(0).Cells(1, nc).SetValue(te.EditValue)
|
||||
Case GetType(TextEdit)
|
||||
Dim te As TextEdit = c.Content
|
||||
wb.Worksheets(0).Cells(1, nc).SetValue(te.EditValue)
|
||||
Case GetType(DateEdit)
|
||||
Dim de As DateEdit = c.Content
|
||||
wb.Worksheets(0).Cells(1, nc).SetValue(de.EditValue)
|
||||
Case GetType(ComboBoxEdit)
|
||||
Dim cbe As ComboBoxEdit = c.Content
|
||||
wb.Worksheets(0).Cells(1, nc).SetValue(cbe.DisplayText)
|
||||
Case GetType(DevExpress.Xpf.Grid.LookUp.LookUpEdit)
|
||||
Dim le As DevExpress.Xpf.Grid.LookUp.LookUpEdit = c.Content
|
||||
wb.Worksheets(0).Cells(1, nc).SetValue(le.EditValue)
|
||||
End Select
|
||||
nc += 1
|
||||
Catch
|
||||
End Try
|
||||
Next
|
||||
|
||||
wb.SaveDocument(sfd.FileName, formato)
|
||||
Process.Start(sfd.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub bePlantilla_GotFocus(sender As Object, e As RoutedEventArgs) Handles bePlantilla.GotFocus
|
||||
Dim oa = Me.Aplicacion.ObjetoActual
|
||||
Dim be As BaseEdit = Nothing
|
||||
Try
|
||||
be = LayoutHelper.FindParentObject(Of BaseEdit)(oa)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
If Not be Is Nothing Then
|
||||
Select Case be.GetType
|
||||
Case GetType(TextEdit), GetType(PasswordBoxEdit), GetType(ButtonEdit), GetType(DateEdit), GetType(ComboBoxEdit), GetType(DevExpress.Xpf.Grid.LookUp.LookUpEdit)
|
||||
Dim expression = be.GetBindingExpression(BaseEdit.EditValueProperty)
|
||||
If Configuracion.ComportamientoValidacion = Validation.InvalidValueBehavior.AllowLeaveEditor Then
|
||||
be.DoValidate()
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
Else
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
be.DoValidate()
|
||||
End If
|
||||
Case GetType(CheckEdit)
|
||||
End Select
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub beAcciones_GotFocus(sender As Object, e As RoutedEventArgs) Handles beAcciones.GotFocus
|
||||
Dim oa = Me.Aplicacion.ObjetoActual
|
||||
Dim be As BaseEdit = Nothing
|
||||
Try
|
||||
be = LayoutHelper.FindParentObject(Of BaseEdit)(oa)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
If Not be Is Nothing Then
|
||||
Select Case be.GetType
|
||||
Case GetType(TextEdit), GetType(PasswordBoxEdit), GetType(ButtonEdit), GetType(DateEdit), GetType(ComboBoxEdit), GetType(DevExpress.Xpf.Grid.LookUp.LookUpEdit)
|
||||
Dim expression = be.GetBindingExpression(BaseEdit.EditValueProperty)
|
||||
If Configuracion.ComportamientoValidacion = Validation.InvalidValueBehavior.AllowLeaveEditor Then
|
||||
be.DoValidate()
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
Else
|
||||
If Not expression Is Nothing AndAlso expression.IsDirty Then expression.UpdateSource()
|
||||
be.DoValidate()
|
||||
End If
|
||||
Case GetType(CheckEdit)
|
||||
End Select
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
|
||||
<Serializable>
|
||||
Public Class DiseñoRejillas
|
||||
Property Rejillas As New List(Of DiseñoRejilla)
|
||||
Property Version As String
|
||||
End Class
|
||||
<Serializable>
|
||||
Public Class DiseñoRejilla
|
||||
Public Diseño() As Byte
|
||||
Public Version As String
|
||||
Public Nombre As String
|
||||
End Class
|
||||
110
Obsoleto/ContenedorLineas.xaml
Normal file
110
Obsoleto/ContenedorLineas.xaml
Normal file
@@ -0,0 +1,110 @@
|
||||
<UserControl x:Class="ContenedorLineas"
|
||||
x:ClassModifier="Public"
|
||||
x:Name="ApLineas"
|
||||
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:lc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
|
||||
xmlns:my="clr-namespace:tsWPF"
|
||||
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
|
||||
mc:Ignorable="d" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" d:DesignHeight="497" d:DesignWidth="971" xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar">
|
||||
<Grid>
|
||||
<dxb:BarManager Name="BarraBotones" ShowScreenTips="true" x:FieldModifier="Public" AllowCustomization="False" AllowQuickCustomization="False">
|
||||
<dxb:BarManager.Items>
|
||||
<dxb:BarButtonItem Name="btNuevo" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Actions/AddItem_16x16.png" x:FieldModifier="public" Focusable="True" Hint="Nuevo" />
|
||||
<dxb:BarButtonItem Name="btActualizar" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Actions/Refresh_16x16.png" x:FieldModifier="public" Focusable="true" ForceCursor="True" IsVisible="True" ItemClick="btActualizar_ItemClick" Hint="Cargar datos de nuevo" />
|
||||
<!--<dxb:BarButtonItem Name="btImprimirListado" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Print/Preview_16x16.png" x:FieldModifier="public" Focusable="True" ItemClick="btImprimirListado_ItemClick" Hint="Imprimir Listado / Exportar a Excel" />-->
|
||||
|
||||
<dxb:BarSubItem Name="MenuExportar" Glyph="{dx:DXImageGrayscale Image=ExportFile_16x16.png}" x:FieldModifier="public" Focusable="False" Hint="Exportar/Imprimir">
|
||||
<dxb:BarButtonItem Name="btExportar" Glyph="{dx:DXImageGrayscale Image=ExportToXLSX_16x16.png}" x:FieldModifier="public" Focusable="False" Content="Exportar A Excel" ItemClick="BtExportar_ItemClick" />
|
||||
<dxb:BarButtonItem Name="btImprimir" Glyph="{dx:DXImageGrayscale Image=Preview_16x16.png}" Content="Vista Preliminar" ItemClick="btImprimirListado_ItemClick" />
|
||||
<dxb:BarButtonItem Name="btCapturar" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/capture.png" Content="Captura Pantalla" ItemClick="BtCapturar_ItemClick" />
|
||||
</dxb:BarSubItem>
|
||||
|
||||
|
||||
|
||||
<dxb:BarEditItem Name="beAcciones" x:FieldModifier="public" Focusable="True" IsEnabled="True" Hint="Accion a Ejecutar" EditWidth="390">
|
||||
<dxb:BarEditItem.EditSettings>
|
||||
<dxe:ComboBoxEditSettings x:Name="cbAcciones" x:FieldModifier="Public" ValueMember="idAccion" DisplayMember="Descripcion" />
|
||||
</dxb:BarEditItem.EditSettings>
|
||||
</dxb:BarEditItem>
|
||||
<dxb:BarButtonItem Name="btAcciones" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Arrows/Next_16x16.png" x:FieldModifier="public" IsEnabled="True" Focusable="True" ItemClick="btAcciones_ItemClick" Hint="Ejecutar Acción" />
|
||||
<dxb:BarCheckItem Name="btSeleccionar" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/checklist-25.png" x:FieldModifier="public" Focusable="False" CheckedChanged="btSeleccionar_CheckedChanged" Hint="Selección múltiple" />
|
||||
<dxb:BarButtonItem Name="btInvertir" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/Invertir-25.png" x:FieldModifier="public" Focusable="False" ItemClick="btInvertir_ItemClick" IsEnabled="False" Hint="Invertir Selección" />
|
||||
<dxb:BarSubItem Name="MenuDiseño" Glyph="{dx:DXImageGrayscale Image=CustomizeGrid_16x16.png}" x:FieldModifier="public" Focusable="False" Hint="Diseño Columnas">
|
||||
<dxb:BarButtonItem Name="btDiseño" Glyph="{dx:DXImageGrayscale Image=CustomizeGrid_16x16.png}" x:FieldModifier="public" Focusable="False" Content="Guardar Diseño Columnas" ItemClick="btDiseño_ItemClick" />
|
||||
<dxb:BarButtonItem Name="btRestaurarDiseño" Glyph="{dx:DXImageGrayscale Image=Columns_16x16.png}" Content="Restaurar Diseño Columnas" ItemClick="btRestaurarDiseño_ItemClick" />
|
||||
<dxb:BarItemSeparator />
|
||||
<dxb:BarButtonItem Name="btAbrirDiseñoGuardado" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/AbrirGrid.png" Content="Abrir Diseño Guardado" ItemClick="btAbrirDiseñoGuardado_ItemClick" />
|
||||
<dxb:BarButtonItem Name="btGuardarDiseñoComo" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/GuardarGrid.png" Content="Guardar Diseño Como ..." ItemClick="btGuardarDiseñoComo_ItemClick" />
|
||||
|
||||
</dxb:BarSubItem>
|
||||
<dxb:BarButtonItem Name="btAyuda" Glyph="{dx:DXImageGrayscale Image=Index_16x16.png}" x:FieldModifier="public" Focusable="False" Hint="Ayuda" ItemClick="btAyuda_ItemClick" />
|
||||
<dxb:BarButtonItem Name="btEliminar" Glyph="pack://application:,,/tsWPF;Component/Images/Icons/papelera.png" x:FieldModifier="public" Focusable="False" Hint="Elimina Registros Seleccionados" />
|
||||
<dxb:BarEditItem Name="bePlantilla" x:FieldModifier="public" Focusable="True" IsEnabled="True" Hint="Modelo a Imprimir" EditWidth="300">
|
||||
<dxb:BarEditItem.EditSettings>
|
||||
<dxe:ComboBoxEditSettings x:Name="cbPlantillaAImprimir" x:FieldModifier="Public" ValueMember="idPlantilla" DisplayMember="Descripcion">
|
||||
</dxe:ComboBoxEditSettings>
|
||||
</dxb:BarEditItem.EditSettings>
|
||||
</dxb:BarEditItem>
|
||||
<dxb:BarButtonItem Name="btImprimirPlantilla" Hint="Imprimir" Glyph="pack://application:,,,/DevExpress.Images.v23.2;component/GrayScaleImages/Print/Print_16x16.png" x:FieldModifier="public" IsEnabled="True" Focusable="True" ItemClick="btImprimirPlantilla_ItemClick" />
|
||||
</dxb:BarManager.Items>
|
||||
<dxb:BarManager.Bars>
|
||||
<dxb:Bar x:Name="Barra1" AllowCustomizationMenu="False" AllowQuickCustomization="False" ShowDragWidget="False" AllowCollapse="False" AllowHide="False">
|
||||
<dxb:Bar.DockInfo>
|
||||
<dxb:BarDockInfo ContainerType="Top" />
|
||||
</dxb:Bar.DockInfo>
|
||||
<!--<dxb:BarButtonItemLink BarItemName="btGuardar" x:FieldModifier="Public" x:Name="ilGuardar" />-->
|
||||
<dxb:BarButtonItemLink BarItemName="btNuevo" x:FieldModifier="Public" x:Name="ilNuevo" />
|
||||
<dxb:BarButtonItemLink BarItemName="btActualizar" x:FieldModifier="Public" x:Name="ilActualizar" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<!--<dxb:BarButtonItemLink BarItemName="btImprimirListado" x:FieldModifier="Public" x:Name="ilImprimirListado" />-->
|
||||
<dxb:BarSubItemLink BarItemName="MenuExportar" x:FieldModifier="Public" x:Name="ilExportar" />
|
||||
<dxb:BarCheckItemLink BarItemName="btSeleccionar" x:FieldModifier="Public" x:Name="ilSeleccionar" />
|
||||
<dxb:BarButtonItemLink BarItemName="btInvertir" x:FieldModifier="Public" x:Name="ilInvertir" />
|
||||
<dxb:BarButtonItemLink BarItemName="btEliminar" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<dxb:BarSubItemLink BarItemName="MenuDiseño" x:Name="ilDiseño" x:FieldModifier="Public" />
|
||||
<dxb:BarButtonItemLink BarItemName="btAyuda" x:Name="ilAyuda" x:FieldModifier="Public" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<dxb:BarEditItemLink BarItemName="bePlantilla" x:FieldModifier="Public" x:Name="ilPlantilla" />
|
||||
<dxb:BarButtonItemLink BarItemName="btImprimirPlantilla" />
|
||||
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
|
||||
<dxb:BarEditItemLink BarItemName="beAcciones" x:FieldModifier="Public" x:Name="ilAcciones" />
|
||||
<dxb:BarButtonItemLink BarItemName="btAcciones" />
|
||||
|
||||
|
||||
<!--<dxb:BarButtonItemLink BarItemName="btEliminar" x:FieldModifier="Public" x:Name="ilEliminar" />-->
|
||||
</dxb:Bar>
|
||||
<dxb:Bar Name="Barsm" AllowCustomizationMenu="False" AllowQuickCustomization="False" ShowDragWidget="False" AllowCollapse="False" AllowHide="False">
|
||||
<dxb:Bar.DockInfo>
|
||||
<dxb:BarDockInfo ContainerType="Top" />
|
||||
</dxb:Bar.DockInfo>
|
||||
|
||||
|
||||
</dxb:Bar>
|
||||
</dxb:BarManager.Bars>
|
||||
<Grid>
|
||||
<dxdo:DockLayoutManager Name="dockManager" ClosedPanelsBarVisibility="Manual">
|
||||
<dxdo:DockLayoutManager.AutoHideGroups>
|
||||
<dxdo:AutoHideGroup DockType="Bottom">
|
||||
<dxdo:LayoutPanel x:Name="lpMensajes" Caption="Mensajes" AllowDockToDocumentGroup="False" AllowDrag="False" AllowFloat="False" AllowMove="False" Visibility="Collapsed" AllowHide="True" IsHitTestVisible="True" AllowDock="True" AllowClose="False" ItemHeight="160">
|
||||
|
||||
</dxdo:LayoutPanel>
|
||||
</dxdo:AutoHideGroup>
|
||||
</dxdo:DockLayoutManager.AutoHideGroups>
|
||||
<dxdo:LayoutGroup x:Name="RootGroup" Orientation="Horizontal">
|
||||
<dxdo:LayoutGroup Orientation="Vertical">
|
||||
<dxdo:LayoutPanel AllowFloat="False" AllowHide="False" AllowMove="False" ShowCloseButton="False" Name="lpContenido" ShowCaption="False">
|
||||
<Grid Name="contenido" />
|
||||
</dxdo:LayoutPanel>
|
||||
</dxdo:LayoutGroup>
|
||||
</dxdo:LayoutGroup>
|
||||
</dxdo:DockLayoutManager>
|
||||
</Grid>
|
||||
|
||||
|
||||
</dxb:BarManager>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
409
Obsoleto/ContenedorLineas.xaml.vb
Normal file
409
Obsoleto/ContenedorLineas.xaml.vb
Normal file
@@ -0,0 +1,409 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.Xpf.Core
|
||||
Imports DevExpress.Xpf.Printing
|
||||
Imports DevExpress.Utils
|
||||
Imports tsWPF.Controles
|
||||
Imports DevExpress.Xpf.Bars
|
||||
Imports DevExpress.Xpf.Grid
|
||||
Imports System.IO
|
||||
Imports System.Threading.Tasks
|
||||
Imports Microsoft.Win32
|
||||
Imports tsl5.Extensiones
|
||||
|
||||
Public Class ContenedorLineas
|
||||
Public apLinea As ApLineas
|
||||
Dim _DescripcionDiseño As String
|
||||
Dim _TodosUsuariosDiseño As Boolean
|
||||
Public Property t As Task
|
||||
|
||||
|
||||
Public Event CargaAplicacion(sender As System.Object, e As System.Windows.RoutedEventArgs)
|
||||
Public Event AntesDeGuardar(sender As System.Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Public Event DespuesDeGuardar(sender As System.Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
|
||||
|
||||
Public Sub New()
|
||||
|
||||
' Llamada necesaria para el diseñador.
|
||||
InitializeComponent()
|
||||
|
||||
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub New(apLinea As ApLineas, uc As UserControl)
|
||||
If Not (System.ComponentModel.DesignerProperties.GetIsInDesignMode(Me)) Then
|
||||
' Llamada necesaria para el diseñador.
|
||||
InitializeComponent()
|
||||
Me.contenido.Children.Add(uc)
|
||||
Me.apLinea = apLinea
|
||||
apLinea.ContenedorL = Me
|
||||
apLinea.LanzaEventoCargado()
|
||||
If apLinea.PermisosConcedidos.Exportar Then
|
||||
Dim cm As New ContextMenu
|
||||
|
||||
Dim mie As New MenuItem()
|
||||
mie.Tag = "MI_EXPORTAR_EXCEL"
|
||||
mie.Header = "Exportar a Excel"
|
||||
AddHandler mie.Click, AddressOf _ExportarExcel
|
||||
cm.Items.Add(mie)
|
||||
|
||||
|
||||
Dim mi As New MenuItem()
|
||||
mi.Tag = "MI_EXPORTAR"
|
||||
mi.Header = "Exportar Otros Formatos"
|
||||
AddHandler mi.Click, AddressOf _Exportar
|
||||
cm.Items.Add(mi)
|
||||
Me.apLinea.Rejilla.ContextMenu = cm
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub _ExportarExcel(sender As Object, e As RoutedEventArgs)
|
||||
Dim mi As MenuItem = sender
|
||||
Dim cm As ContextMenu = mi.Parent
|
||||
Dim tsgc As tsGridControl = cm.PlacementTarget
|
||||
Dim vista As TableView = tsgc.View
|
||||
|
||||
Dim sfd As New SaveFileDialog
|
||||
sfd.FileName = IO.Path.GetDirectoryName("Exportacion") & (tsgc.NombreTablaBase.NothingAVacio & " Exportacion.xlsx").Trim
|
||||
sfd.Filter = "Fichero Excel (*.xls, *.xlsx, *.csv)|*.xls;*.xlsx;*.csv"
|
||||
sfd.DefaultExt = ".xlsx"
|
||||
If sfd.ShowDialog Then
|
||||
Select Case IO.Path.GetExtension(sfd.FileName).ToLower
|
||||
Case ".xls"
|
||||
vista.ExportToXls(sfd.FileName)
|
||||
Case ".xlsx"
|
||||
vista.ExportToXlsx(sfd.FileName)
|
||||
Case ".csv"
|
||||
vista.ExportToCsv(sfd.FileName)
|
||||
End Select
|
||||
Process.Start(sfd.FileName)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub _Exportar(sender As Object, e As RoutedEventArgs)
|
||||
Dim mi As MenuItem = sender
|
||||
Dim cm As ContextMenu = mi.Parent
|
||||
Dim tsgc As tsGridControl = cm.PlacementTarget
|
||||
Dim vista As TableView = tsgc.View
|
||||
Try
|
||||
|
||||
|
||||
'Dim link As New PrintableControlLink(CType(vista, TableView))
|
||||
'link.CreateDocument()
|
||||
'Dim vi As New tsWPF.ucVisualizadorInformes()
|
||||
'vi.Visualizador.DocumentSource = link
|
||||
'Dim docpanel = New DevExpress.Xpf.Docking.DocumentPanel
|
||||
'Dim tabHeaderPrintInfoControl As New TabHeaderPrintInfoControl() With {.TabName = "Exportación " & tsgc.PropiedadesTSGC.Descripcion}
|
||||
'docpanel.Caption = tabHeaderPrintInfoControl
|
||||
'docpanel.Content = vi
|
||||
'docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
|
||||
'Me.apLinea.GrupoDocumentos.Add(docpanel)
|
||||
'Comun.dm.DockController.Activate(docpanel)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Dim preview As New DocumentPreview()
|
||||
Dim model As LinkPreviewModel = CreateLinkPreviewModel(TryCast(vista, IPrintableControl))
|
||||
model.Link.PaperKind = System.Drawing.Printing.PaperKind.A4Rotated
|
||||
preview.Model = model
|
||||
Dim tabHeaderPrintInfoControl As New TabHeaderPrintInfoControl() With {.TabName = "Exportación " & tsgc.PropiedadesTSGC.Descripcion, .LinkPreviewModel = model}
|
||||
Dim docpanel = New DevExpress.Xpf.Docking.DocumentPanel
|
||||
docpanel.Caption = tabHeaderPrintInfoControl
|
||||
docpanel.Content = preview
|
||||
docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
|
||||
Me.apLinea.GrupoDocumentos.Add(docpanel)
|
||||
Comun.dm.DockController.Activate(docpanel)
|
||||
model.Link.CreateDocument(True)
|
||||
Catch ex As Exception
|
||||
Console.WriteLine(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
'Public Shared Function CreateLinkPreviewModel(ByVal printableControl As IPrintableControl) As LinkPreviewModel
|
||||
' Dim link As New PrintableControlLink(TryCast(printableControl, IPrintableControl))
|
||||
' Return New LinkPreviewModel(link)
|
||||
'End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'Private Sub BotonEditar(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs) Handles btEditar.ItemClick
|
||||
' If Not apLinea.Rejilla.CurrentItem Is Nothing Then
|
||||
' apLinea.IApLin.Editar()
|
||||
' End If
|
||||
|
||||
'End Sub
|
||||
Private Sub BotonNuevo(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs) Handles btNuevo.ItemClick
|
||||
apLinea.IApLin.Nuevo()
|
||||
End Sub
|
||||
|
||||
Private Sub BotonEliminar(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs) Handles btEliminar.ItemClick
|
||||
'apLinea.IApLin.Eliminar()
|
||||
apLinea.Eliminar()
|
||||
End Sub
|
||||
'Private Sub BotonGuardar(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs) Handles btGuardar.ItemClick
|
||||
' apLinea.Guardar()
|
||||
'End Sub
|
||||
|
||||
|
||||
'Private Sub ContenedorLineas_GotFocus(sender As Object, e As RoutedEventArgs) Handles Me.GotFocus
|
||||
' Debug.WriteLine("contenedorlin.gotfocus")
|
||||
'End Sub
|
||||
|
||||
Private Sub btSeleccionar_CheckedChanged(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
apLinea.SeleccionarHabilitadoCambiado(btSeleccionar.IsChecked)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub btInvertir_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
|
||||
'Dim enti As System.Data.Objects.DataClasses.EntityObject = Nothing
|
||||
|
||||
'For i = 0 To Me.apLinea.Rejilla.VisibleRowCount - 1
|
||||
' enti = Me.apLinea.Rejilla.GetRow(i)
|
||||
' Dim key As Integer
|
||||
' If Not enti Is Nothing Then
|
||||
' Dim rowHandle As Integer = Me.apLinea.Rejilla.GetRowHandleByVisibleIndex(i)
|
||||
' key = enti.GetType.GetProperty(Me.apLinea.CampoIndice).GetValue(enti, Nothing)
|
||||
' Dim newIsSelected As Boolean = Not Me.apLinea.ElementosSeleccionados.GetIsSelected(key)
|
||||
' Me.apLinea.Rejilla.SetCellValue(rowHandle, "tswpf_seleccionar", newIsSelected)
|
||||
' End If
|
||||
'Next
|
||||
'Me.apLinea.Rejilla.RefreshData()
|
||||
|
||||
Try
|
||||
Dim iq As IQueryable(Of System.Data.Objects.DataClasses.EntityObject)
|
||||
Dim li As List(Of System.Data.Objects.DataClasses.EntityObject) = Nothing
|
||||
Dim key As Integer
|
||||
|
||||
Try
|
||||
'iq = Me.apLinea.Rejilla.DataContext
|
||||
iq = Me.apLinea.Rejilla.ItemsSource
|
||||
li = iq.ToList
|
||||
Catch ex As InvalidCastException
|
||||
'Catch ex As Exception
|
||||
Try
|
||||
li = Me.apLinea.Rejilla.ItemsSource
|
||||
Catch ex2 As Exception
|
||||
Dim ob = Me.apLinea.Rejilla.ItemsSource
|
||||
For i = 0 To ob.Count - 1
|
||||
key = ob(i).GetType.GetProperty(Me.apLinea.CampoIndice).GetValue(ob(i), Nothing)
|
||||
Dim newIsSelected As Boolean = Not Me.apLinea.ElementosSeleccionados.GetIsSelected(key)
|
||||
Dim rowHandle As Integer = Me.apLinea.Rejilla.GetRowHandleByListIndex(i)
|
||||
If Me.apLinea.Rejilla.IsGroupRowExpanded(rowHandle) Or Me.apLinea.Rejilla.GetRowLevelByRowHandle(rowHandle) = 0 Then
|
||||
Me.apLinea.Rejilla.SetCellValue(rowHandle, "tswpf_seleccionar", newIsSelected)
|
||||
End If
|
||||
Next
|
||||
End Try
|
||||
End Try
|
||||
If li IsNot Nothing Then
|
||||
For i = 0 To li.Count - 1
|
||||
key = li(i).GetType.GetProperty(Me.apLinea.CampoIndice).GetValue(li(i), Nothing)
|
||||
Dim newIsSelected As Boolean = Not Me.apLinea.ElementosSeleccionados.GetIsSelected(key)
|
||||
Dim rowHandle As Integer = Me.apLinea.Rejilla.GetRowHandleByListIndex(i)
|
||||
If Me.apLinea.Rejilla.IsGroupRowExpanded(rowHandle) Or Me.apLinea.Rejilla.GetRowLevelByRowHandle(rowHandle) = 0 Then
|
||||
Me.apLinea.Rejilla.SetCellValue(rowHandle, "tswpf_seleccionar", newIsSelected)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Me.apLinea.Rejilla.RefreshData()
|
||||
Catch ex As Exception
|
||||
Debug.Write(ex.Message)
|
||||
End Try
|
||||
Me.apLinea.LanzaEventoInvertirSeleccion()
|
||||
|
||||
|
||||
'Dim key As Integer
|
||||
'Dim enti As System.Data.Objects.DataClasses.EntityObject = Nothing
|
||||
'For i As Integer = 0 To Me.apLinea.Rejilla.DataContext.Count - 1
|
||||
' enti = Me.apLinea.Rejilla.DataContext.GetType(i)
|
||||
' key = enti.GetType.GetProperty(Me.apLinea.CampoIndice).GetValue(enti, Nothing)
|
||||
' Dim newIsSelected As Boolean = Not Me.apLinea.ElementosSeleccionados.GetIsSelected(key)
|
||||
' Dim rowHandle As Integer = Grid.GetRowHandleByListIndex(i)
|
||||
' Grid.SetCellValue(rowHandle, "Selected", newIsSelected)
|
||||
'Next i
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btImprimirListado_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Dim preview As New DocumentPreview()
|
||||
Dim model As LinkPreviewModel = CreateLinkPreviewModel(TryCast(Me.apLinea.Rejilla.View, IPrintableControl))
|
||||
preview.Model = model
|
||||
|
||||
Dim tabHeaderPrintInfoControl As New TabHeaderPrintInfoControl() With {.TabName = "Listado de " & Me.apLinea.Titulo, .LinkPreviewModel = model}
|
||||
Dim docpanel = New DevExpress.Xpf.Docking.DocumentPanel
|
||||
docpanel.Caption = tabHeaderPrintInfoControl
|
||||
docpanel.Content = preview
|
||||
docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
|
||||
Me.apLinea.GrupoDocumentos.Add(docpanel)
|
||||
Comun.dm.DockController.Activate(docpanel)
|
||||
model.Link.CreateDocument(True)
|
||||
End Sub
|
||||
Public Shared Function CreateLinkPreviewModel(ByVal printableControl As IPrintableControl) As LinkPreviewModel
|
||||
Dim link As New PrintableControlLink(TryCast(printableControl, IPrintableControl))
|
||||
Return New LinkPreviewModel(link)
|
||||
End Function
|
||||
|
||||
Private Sub btImprimirPlantilla_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Dim idPlantilla As Integer = bePlantilla.EditValue
|
||||
Me.apLinea.LanzaImprimirPlantilla(sender, e, idPlantilla)
|
||||
End Sub
|
||||
|
||||
Private Sub btAcciones_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Dim idAccion As Integer = beAcciones.EditValue
|
||||
Me.apLinea.LanzaEjecutarAccion(sender, e, idAccion)
|
||||
End Sub
|
||||
|
||||
Private Sub btActualizar_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Me.apLinea.RefrescaUC()
|
||||
End Sub
|
||||
|
||||
Private Sub ContenedorLineas_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub ContenedorLineas_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
|
||||
Try
|
||||
If apLinea.Contexto IsNot Nothing Then
|
||||
If apLinea.Contexto.Connection.State <> System.Data.ConnectionState.Closed Then apLinea.Contexto.Connection.Close()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub btAyuda_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Me.apLinea.DelegadoAyuda.Invoke(Me.apLinea.uc.GetType.ToString)
|
||||
End Sub
|
||||
|
||||
Private Sub btDiseño_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
Try
|
||||
Dim drs = ObtieneDiseñoActual()
|
||||
Me.apLinea.DelegadoDiseño.Invoke(Me.apLinea.Contexto, OperacionDiseñoEnum.GUARDAR, Me.apLinea.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, drs)
|
||||
Catch ex As Exception
|
||||
If Me.apLinea.DelegadoErrorNoControlado IsNot Nothing Then Me.apLinea.DelegadoErrorNoControlado.Invoke(Me.apLinea, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error btDiseño_Itemclick")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Friend Function ObtieneDiseñoActual() As Byte()
|
||||
Dim ld As New DiseñoRejillas
|
||||
Dim i As Integer
|
||||
Dim lg As List(Of tsGridControl) = Nothing
|
||||
tsWPF.ObtieneHijosDeTipo(Of tsGridControl)(ApLineas, lg)
|
||||
For Each l In lg
|
||||
i += 1
|
||||
If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
Dim dr As New DiseñoRejilla
|
||||
dr.Nombre = l.Name
|
||||
dr.Version = "1"
|
||||
Dim ms As New MemoryStream
|
||||
'Dim ms As New FileStream("c:\tmp\diseño1.xml", FileMode.CreateNew)
|
||||
l.SaveLayoutToStream(ms)
|
||||
' l.SaveLayoutToXml("c:\tmp\diseño2.xml")
|
||||
'ms.Close()
|
||||
dr.Diseño = ms.ToArray
|
||||
ld.Rejillas.Add(dr)
|
||||
Next
|
||||
Dim drs = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.serializar(ld))
|
||||
Return drs
|
||||
End Function
|
||||
|
||||
Private Sub btRestaurarDiseño_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
|
||||
|
||||
|
||||
If apLinea.DiseñoOriginal IsNot Nothing Then
|
||||
Try
|
||||
Dim ld As New DiseñoRejillas
|
||||
ld = tsl5.Utilidades.deserializar(System.Text.Encoding.Unicode.GetString(apLinea.DiseñoOriginal), ld.GetType)
|
||||
Dim i As Integer
|
||||
Dim lg As List(Of tsGridControl) = Nothing
|
||||
tsWPF.ObtieneHijosDeTipo(Of tsGridControl)(ApLineas, lg)
|
||||
For Each l In lg
|
||||
i += 1
|
||||
If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
Try
|
||||
If ld.Rejillas.Any(Function(x) x.Nombre = l.Name) Then
|
||||
Dim dr As DiseñoRejilla = ld.Rejillas.Where(Function(x) x.Nombre = l.Name).First
|
||||
l.RestoreLayoutFromStream(New System.IO.MemoryStream(dr.Diseño))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Debug.Write("Error DelegadoDiseño Rejilla")
|
||||
End Try
|
||||
Next
|
||||
Dim drs = System.Text.Encoding.Unicode.GetBytes(tsl5.Utilidades.serializar(ld))
|
||||
Me.apLinea.DelegadoDiseño.Invoke(Me.apLinea.Contexto, OperacionDiseñoEnum.RESTAURAR_ORIGINAL, Me.apLinea.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, drs)
|
||||
Catch ex As Exception
|
||||
If Me.apLinea.DelegadoErrorNoControlado IsNot Nothing Then Me.apLinea.DelegadoErrorNoControlado.Invoke(Me.apLinea, ex)
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btGuardarDiseñoComo_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Try
|
||||
Dim drs = ObtieneDiseñoActual()
|
||||
Me.apLinea.DelegadoDiseño.Invoke(Me.apLinea.Contexto, OperacionDiseñoEnum.GUARDAR_COMO, Me.apLinea.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, drs)
|
||||
Catch ex As Exception
|
||||
If Me.apLinea.DelegadoErrorNoControlado IsNot Nothing Then Me.apLinea.DelegadoErrorNoControlado.Invoke(Me.apLinea, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error btDiseño_Itemclick")
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btAbrirDiseñoGuardado_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Dim b = Me.apLinea.DelegadoDiseño.Invoke(Me.apLinea.Contexto, OperacionDiseñoEnum.ABRIR_DISEÑO_GUARDADO, Me.apLinea.uc.GetType.ToString, _DescripcionDiseño, _TodosUsuariosDiseño, Nothing)
|
||||
If b IsNot Nothing Then
|
||||
Dim ld As New DiseñoRejillas
|
||||
ld = tsl5.Utilidades.deserializar(System.Text.Encoding.Unicode.GetString(b), ld.GetType)
|
||||
Dim i As Integer
|
||||
Dim lg As List(Of tsGridControl) = Nothing
|
||||
tsWPF.ObtieneHijosDeTipo(Of tsGridControl)(Me, lg)
|
||||
For Each l In lg
|
||||
i += 1
|
||||
If l.Name = "" Then l.Name = "tsRejilla-" & i.ToString
|
||||
Try
|
||||
If ld.Rejillas.Any(Function(x) x.Nombre = l.Name) Then
|
||||
Dim dr As DiseñoRejilla = ld.Rejillas.Where(Function(x) x.Nombre = l.Name).First
|
||||
l.RestoreLayoutFromStream(New System.IO.MemoryStream(dr.Diseño))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
If Me.apLinea.DelegadoErrorNoControlado IsNot Nothing Then Me.apLinea.DelegadoErrorNoControlado.Invoke(Me.apLinea, ex)
|
||||
DXMessageBox.Show(ex.Message, "Error btDiseño_Itemclick")
|
||||
End Try
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BtExportar_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
|
||||
Dim vista As TableView = Me.apLinea.Rejilla.View
|
||||
|
||||
Dim sfd As New SaveFileDialog
|
||||
sfd.FileName = IO.Path.GetDirectoryName("Exportacion") & (Me.apLinea.Rejilla.NombreTablaBase.NothingAVacio & " Exportacion.xlsx").Trim
|
||||
sfd.Filter = "Fichero Excel (*.xls, *.xlsx, *.csv)|*.xls;*.xlsx;*.csv"
|
||||
sfd.DefaultExt = ".xlsx"
|
||||
If sfd.ShowDialog Then
|
||||
Select Case IO.Path.GetExtension(sfd.FileName).ToLower
|
||||
Case ".xls"
|
||||
vista.ExportToXls(sfd.FileName)
|
||||
Case ".xlsx"
|
||||
vista.ExportToXlsx(sfd.FileName)
|
||||
Case ".csv"
|
||||
vista.ExportToCsv(sfd.FileName)
|
||||
End Select
|
||||
Process.Start(sfd.FileName)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub BtCapturar_ItemClick(sender As Object, e As ItemClickEventArgs)
|
||||
Dim sficherojpg = tsl5.Utilidades.ObtieneFicheroAleatorio(System.IO.Path.GetTempPath, "jpg")
|
||||
IO.File.WriteAllBytes(sficherojpg, Me.apLinea.uc.ObtieneImagen(1, 100))
|
||||
Process.Start(sficherojpg)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user