This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-03-31 21:29:42 -07:00
parent c9c8e90ce9
commit e46dfbdd9b
4 changed files with 33 additions and 41 deletions

View File

@@ -5136,55 +5136,43 @@ Public Class ClsPaginas
'limpio ReportViwer
Dim sw As New System.Diagnostics.Stopwatch()
sw.Start()
'Dim Bytes As Byte() = Nothing
'Try
' Dim fllreport As New ADSReportLib.FullTrustReportviewer()
' fllreport.Initialize("DisplayName", RutaReporte, Parametros, New List(Of String()), True)
' For Each RDS As ReportDataSource In DataSource
' fllreport.AddDataSources(RDS)
' Next
' Dim Warnings As Warning() = Nothing
' Dim StreamIds As String() = Nothing
' Dim MimeType As String = Nothing
' Dim Encoding As String = Nothing
' Dim Extension As String = Nothing
' Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings)
' fllreport = Nothing
'Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException
' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
' 'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
'Catch ex As Exception
' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
''HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
''GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
'End Try
If IsNothing(MR) Then MR = New ReportViewer
Dim Bytes As Byte() = Nothing
Dim setup As AppDomainSetup = New AppDomainSetup
With setup
.ApplicationBase = Environment.CurrentDirectory
.LoaderOptimization = LoaderOptimization.MultiDomainHost
End With
setup.SetCompatibilitySwitches({"NetFx40_LegacySecurityPolicy"})
Dim _casPolicyEnabledDomain As AppDomain = AppDomain.CreateDomain("Full Trust", Nothing, setup)
Try
'Dim rvNextgenReport2 As WebReportviewer.FullTrustReportviewer = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(WebReportviewer.FullTrustReportviewer).Assembly.CodeBase, GetType(WebReportviewer.FullTrustReportviewer).FullName), WebReportviewer.FullTrustReportviewer)
'rvNextgenReport2.Initialize(DisplayName, ReportPath, Visible, reportParam, reportRenderFormat, DeviceInfo, repMainContent, repSubContent)
'For Each _ReportDataSource As ReportDataSource In DataSources
' rvNextgenReport2.AddDataSources(_ReportDataSource.Name, CType(_ReportDataSource.Value, DataTable))
'Next
'Return rvNextgenReport2.Render(reportRenderFormat, DeviceInfo)
Dim fllreport As ADSReportLib.FullTrustReportviewer = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(ADSReportLib.FullTrustReportviewer).Assembly.CodeBase, GetType(ADSReportLib.FullTrustReportviewer).FullName), ADSReportLib.FullTrustReportviewer)
Dim bdir As String = AppDomain.CurrentDomain.BaseDirectory
RutaReporte.Replace("/", "\")
If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then
RutaReporte = String.Format("{0}{1}", bdir, RutaReporte)
End If
fllreport.Initialize("DisplayName", RutaReporte, Parametros.AsEnumerable(), New List(Of String()), True)
For Each RDS As ReportDataSource In DataSource
MR.LocalReport.DataSources.Add(RDS)
fllreport.AddDataSources(RDS.Name, DirectCast(RDS.Value, DataTable))
Next
'Dim permissions As New Security.PermissionSet(Security.Permissions.PermissionState.None)
'permissions.AddPermission(New Security.Permissions.FileIOPermission(Security.Permissions.PermissionState.Unrestricted))
'permissions.AddPermission(New Security.Permissions.SecurityPermission(Security.Permissions.SecurityPermissionFlag.Execution))
'MR.LocalReport.SetBasePermissionsForSandboxAppDomain(permissions)
MR.LocalReport.ReportPath = RutaReporte
MR.ProcessingMode = ProcessingMode.Local
MR.LocalReport.EnableExternalImages = True
MR.LocalReport.SetParameters(Parametros)
MR.LocalReport.Refresh()
Dim Warnings As Warning() = Nothing
Dim StreamIds As String() = Nothing
Dim MimeType As String = Nothing
Dim Encoding As String = Nothing
Dim Extension As String = Nothing
Bytes = MR.LocalReport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings)
Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds)
fllreport = Nothing
Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException
GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
@@ -5193,9 +5181,9 @@ Public Class ClsPaginas
GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}")
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
Finally
AppDomain.Unload(_casPolicyEnabledDomain)
End Try
MR.LocalReport.ReleaseSandboxAppDomain()
MR.Dispose()
sw.Stop()
If sw.Elapsed.TotalSeconds > 10 Then

Binary file not shown.

Binary file not shown.

View File

@@ -36,6 +36,10 @@