Agregar archivos de proyecto.

This commit is contained in:
2026-01-23 12:45:41 +01:00
parent 5ed4e0bc46
commit c8d1044267
237 changed files with 34721 additions and 0 deletions

View File

@@ -0,0 +1,179 @@
Imports tsWPFCore
Imports bdGrupoSanchoToro.db
Imports System.CodeDom.Compiler
Imports DevExpress.Xpf.Core
Imports System.Reflection
Imports bdGrupoSanchoToro.db.tscGrupoSanchoToro
Imports bdGrupoSanchoToro.db.Utilidades
Public Class ucProcesos
Private bd As tscGrupoSanchoToro
Public Overrides Sub Cargado()
End Sub
Public Overrides Function EstablecedcPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion
gcProcesos.ItemsSource = bd.procesos.ToList
Return tsUtilidades.EstadosAplicacion.AplicacionSinIndice
End Function
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
End Sub
Public Overrides Sub EstableceTitulo()
Me.docpanel.Caption = "Procesos"
End Sub
Public Overrides ReadOnly Property idRegistroAplicacionActual As String
Get
Return "Procesos"
End Get
End Property
Public Overrides ReadOnly Property NombreTablaBase As String
Get
Return "procesos"
End Get
End Property
Public Overrides ReadOnly Property DescripcionRegistro As String
Get
Return "Procesos"
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 btEjecutar_Click(sender As Object, e As RoutedEventArgs)
Try
Dim dwi As dxwInicio = CType(Window.GetWindow(Me), dxwInicio)
Dim pr As bdGrupoSanchoToro.db.procesos = CType(Me.gcProcesos.CurrentItem, procesos)
If pr.Accion <> "" Then
Dim stipo As String = tsUtilidades.Utilidades.Ttagi(pr.Accion, "CLASE")
Dim tipo As Type
If stipo <> "" Then
Dim sEnsamblado As String = tsUtilidades.Utilidades.Ttagi(pr.Accion, "ENS")
If sEnsamblado <> "" Then
Dim dm As AppDomain = AppDomain.CurrentDomain
Dim b() As Byte = IO.File.ReadAllBytes(sEnsamblado)
tipo = dm.Load(b).GetType(stipo, False, True)
Try
tipo.GetMethod(tsUtilidades.Utilidades.Ttagi(pr.Accion, "SUB")).Invoke(Nothing, Nothing)
tipo = Nothing
Catch ex As Exception
End Try
Else
tipo = tsUtilidades.Utilidades.FindType(stipo)
End If
Dim sSub As String = tsUtilidades.Utilidades.Ttagi(pr.Accion, "SUB")
Dim sPar As String = tsUtilidades.Utilidades.Ttagi(pr.Accion, "PAR")
If tipo.GetMethod(sSub).GetParameters.Count = 0 Then
tipo.GetMethod(sSub).Invoke(Nothing, Nothing)
Else
If sPar = "" Then
' tipo.GetMethod(sSub).Invoke(Nothing, {dwi, Comun.dcfg, Comun.dcn, bdGrupoSanchoToro.db.Utilidades.dsc, pr.Accion})
tipo.GetMethod(sSub).Invoke(Nothing, {dwi, pr.Accion})
Else
'tipo.GetMethod(sSub).Invoke(Nothing, {sPar, dwi, Comun.dcfg, Comun.dcn, bdGrupoSanchoToro.db.Utilidades.dsc, pr.Accion})
tipo.GetMethod(sSub).Invoke(Nothing, {sPar, dwi, pr.Accion})
End If
End If
End If
Else
Dim oCProvider As New VBCodeProvider
Dim oCompiler As CodeDomProvider = oCProvider
Dim oCParam As New CompilerParameters
oCParam.GenerateInMemory = True
' oCParam.CompilerOptions = [String].Format("/lib:""{0}""", IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Reference Assemblies\Microsoft\Framework\v4.0")) + [String].Format(" /lib:""{0}""", IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Reference Assemblies\Microsoft\Framework\v4.5"))
' Dim a As Assembly = Assembly.GetExecutingAssembly
'For Each ra In a.GetReferencedAssemblies
' oCParam.ReferencedAssemblies.Add(ra.Name)
'Next
oCParam.ReferencedAssemblies.AddRange(AppDomain.CurrentDomain.GetAssemblies.Where(Function(x) x.IsDynamic = False).Select(Function(x) x.Location).ToArray)
'oCParam.ReferencedAssemblies.Add("System.dll")
'oCParam.ReferencedAssemblies.Add("System.Data.dll")
'oCParam.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
'oCParam.ReferencedAssemblies.Add("PresentationFramework.dll")
'oCParam.ReferencedAssemblies.Add("GestionParlamento.exe")
'Creamos un objeto CompilerResult que obtendrá los resultados de la compilación
Dim oCResult As CompilerResults
Dim sRutina As String = System.Text.Encoding.UTF8.GetString(pr.idFicheroNavigation.Fichero)
oCResult = oCompiler.CompileAssemblyFromSource(oCParam, sRutina)
'Comprobamos que no existan errores de compilación.
Dim oCError As CompilerError
Dim sErrores As String = ""
If oCResult.Errors.Count > 0 Then
'Si existen errores los mostramos.
'Si bien, podriamos implementar un mejor método para visualizar
'los errores de compilación, este nos servirá por los momentos.
For Each oCError In oCResult.Errors
sErrores &= oCError.ErrorText.ToString & " --- "
'MsgBox(oCError.ErrorText.ToString)
Next
Throw New Exception(sErrores)
Else
'Como el ensamblado se generó en memoria, debemos obtener
'una referencia al ensamblado generado, para esto usamos
'la propiedad CompiledAssembly
Dim oEnsamblado As System.Reflection.Assembly
oEnsamblado = oCResult.CompiledAssembly
Dim oClass As Type = oEnsamblado.GetType("RutinasTecnosis")
oClass.GetMethod("Ejecutar").Invoke(Nothing, Nothing)
End If
End If
Catch ex As Exception
DXMessageBox.Show(ex.Message, "Error")
End Try
End Sub
Private Sub Nuevo(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
FuncionesDinamicas.AbrirAP(New ucProceso, OtrosParametros)
End Sub
Private Sub ap_Enlazar(Celda As DevExpress.Xpf.Grid.EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
Dim P = Comun.ObtienePermisos(Me.bd, "AP.ADMINISTRADOR", idUsuario)
If P.Consultar Then
Dim id As Integer = DirectCast(Me.gcProcesos.CurrentItem, procesos).idProceso
FuncionesDinamicas.AbrirAP(New ucProceso(id), OtrosParametros)
Else
btEjecutar_Click(Nothing, Nothing)
End If
End Sub
End Class