Correciones de descarga de archivos

This commit is contained in:
2020-05-12 01:21:06 -07:00
parent d36ed8b48e
commit 5e14074189
5 changed files with 31 additions and 3 deletions

View File

@@ -130,6 +130,30 @@ Partial Class PopUpVerFactura
Dim Path As String = String.Format("{0}Ventas\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("RFC"), Request("FileV"))
Dim Archivo As New System.IO.FileInfo(Path)
If Archivo.Exists Then
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = "xml", "application/xml", "application/pdf")
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
HttpContext.Current.Response.TransmitFile(Path)
'HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
End If
Archivo = Nothing
ElseIf Request("File") IsNot Nothing AndAlso Request("TipoDocto") IsNot Nothing AndAlso Request("TipoArchivo") IsNot Nothing Then
Dim Path As String = "" ' String.Format("{0}Ventas\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("RFC"), Request("FileV"))
Select Case Request("TipoArchivo")
Case "PDF"
Path = String.Format("{0}PDF\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("TipoDocto"), Request("File"))
Case "XML"
Path = String.Format("{0}XML\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("TipoDocto"), Request("File"))
End Select
Dim Archivo As New System.IO.FileInfo(Path)
If Archivo.Exists Then
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()

View File

@@ -187,6 +187,7 @@ public partial class OI_CircularDetalleB : ClsPaginas
}
catch (Exception ex)
{
ModExtensiones.OnError(this, "Ocurrió un error al obtener al archivo", ex);
Filename = "-1";
}
}

View File

@@ -54,7 +54,7 @@ public partial class OI_MinutaDetalle : ClsPaginas
LnkGuardar.Visible = false;
using (ClsOIEventos oieve = new ClsOIEventos())
{
oieve.UpUsuarioseventosVisto(RCveEvento, UsuarioActual.CveUsuario);
oieve.UpUsuarioseventosVisto(RCveEvento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
}
LoadMinuata();
}

View File

@@ -1,4 +1,5 @@
Imports System.IO
Imports Extensiones
Partial Class CargarArchivo
Inherits ClsPaginas

View File

@@ -172,13 +172,15 @@ Partial Class PopUpBuscarFolio
e.Row.FCLiteral("LtlSucursal").Text = String.Format("<div class='truncate' style='width:80px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("SubProyecto"))
e.Row.FCLiteral("LtlEstatus").Text = String.Format("<div class='truncate' style='width:80px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("EstatusFactura"))
e.Row.FCLiteral("LtlPedidoContrato").Text = String.Format("<div class='truncate' style='width:80px;'>{0}{1}</a></div>", Liga, e.Row.DBCampo("PedidoContrato"))
If IO.File.Exists($"{Ruta}XML\{e.Row.DBCampo("TipoDocto")}\{e.Row.DBCampo("Folio")}.xml") Then
e.Row.FCLiteral("LtlXML").Text = String.Format("<div class='truncate' style='width:23px;'><a class=""Texto"" target=""_blank"" href=""/Empresas/{0}/XML/{1}/{2}.xml"">XML</a></div>", UsuarioActual.CveEmpresa, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio"))
e.Row.FCLiteral("LtlXML").Text = String.Format("<div class='truncate' style='width:23px;'><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?TipoDocto={0}&File={1}.xml&TipoArchivo=XML"">XML</a></div>", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio"))
Else
e.Row.FCLiteral("LtlXML").Text = "<div class='truncate' style='width:23px;'></div>"
End If
If IO.File.Exists($"{Ruta}PDF\{e.Row.DBCampo("TipoDocto")}\{e.Row.DBCampo("Folio")}.pdf") Then
e.Row.FCLiteral("LtlPDF").Text = String.Format("<div class='truncate' style='width:23px;'><a class=""Texto"" target=""_blank"" href=""/Empresas/{0}/PDF/{1}/{2}.pdf"">PDF</a></div>", UsuarioActual.CveEmpresa, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio"))
e.Row.FCLiteral("LtlPDF").Text = String.Format("<div class='truncate' style='width:23px;'><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?TipoDocto={0}&File={1}.pdf&TipoArchivo=PDF"">PDF</a></div>", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio"))
Else
e.Row.FCLiteral("LtlPDF").Text = "<div class='truncate' style='width:23px;'></div>"
End If