gembox implementado para descargar doc

This commit is contained in:
Antonio Gonzalez
2020-03-23 17:30:01 -07:00
parent 46623b633f
commit d0bb637083
2 changed files with 54 additions and 13 deletions

View File

@@ -3807,7 +3807,9 @@
<asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-Width="50px">
<ItemTemplate>
<asp:Literal ID="ImgDownLoad" runat="server"></asp:Literal>
<%--<asp:Literal ID="ImgDownLoad" runat="server"></asp:Literal>--%>
<asp:LinkButton ID="LnkDownLoadDoc" CssClass="btn btn-circle btn-sm blue" OnClick="DownLoad_ClickDocumentacion" runat="server"
Text="<i class='fa fa-download' style='color:white' title='Descargar formato'></i>" CausesValidation="False" />
</ItemTemplate>
</asp:TemplateField>

View File

@@ -6884,6 +6884,42 @@ Partial Class Clientes
ObjEdoc.Dispose()
End Sub
Public Sub DownLoad_ClickDocumentacion(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim Adjunto As String = GvRow.DataKey("Adjunto")
'Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto
Dim linkDescarga As String = "C:\inetpub\wwwSIGGIT\Empresas\140\DocElectronica\Clientes\271110\Pagaré.docx"
Dim memoryStreamDoc As New System.IO.MemoryStream
Dim objGemBoxDocument As New clsGemBoxDocument(linkDescarga)
Dim Tags As New List(Of TagsDocumentos)
Tags.Add(New TagsDocumentos("{Monto}", "xyz"))
Tags.Add(New TagsDocumentos("{Fecha}", Date.Today.ToString))
Tags.Add(New TagsDocumentos("{FechaConFormato}", "23 de marzo del 2020"))
Tags.Add(New TagsDocumentos("{CantidadLetra}", "69420"))
Tags.Add(New TagsDocumentos("{RazonSocial}", "mengano y perengano"))
Tags.Add(New TagsDocumentos("{Direccion}", "merida 1270"))
Tags.Add(New TagsDocumentos("{Ciudad}", "Hermosillo"))
Tags.Add(New TagsDocumentos("{Telefono}", "2209839"))
Tags.Add(New TagsDocumentos("{RazonSocialAval}", "blablabla"))
Tags.Add(New TagsDocumentos("{DireccionAval}", "asdfqwer"))
Tags.Add(New TagsDocumentos("{CiudadAval}", "Hermosillo"))
Tags.Add(New TagsDocumentos("{TelefonoAval}", "6621432648"))
'objGemBoxDocument.AgregarImagen(RutaLogo, 61.0, 53.0)
objGemBoxDocument.SustituirTags(Tags)
objGemBoxDocument.GuardarStream()
Dim memoryStream As New System.IO.MemoryStream(objGemBoxDocument.GetBytesDocumento())
objGemBoxDocument.Dispose()
Response.Clear()
Response.ContentType = "application/text"
Response.AddHeader("content-disposition", "attachment;filename=pagare.docx")
Response.Buffer = True
MemoryStream.WriteTo(Response.OutputStream)
Response.End()
End Sub
Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosCliente.RowDataBound
@@ -6891,7 +6927,8 @@ Partial Class Clientes
Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString
Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato")
Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad")
'Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad")
Dim LnkDownLoadDoc As LinkButton = e.Row.FCLinkButton("LnkDownLoadDoc")
Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired")
Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite")
Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False)
@@ -6941,10 +6978,11 @@ Partial Class Clientes
End If
If documentacionFormato = "" Then
ImgDownLoadFormato.Visible = False
'ImgDownLoadFormato.Visible = False
LnkDownLoadDoc.Visible = False
Else
Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato
ImgDownLoadFormato.Visible = True
LnkDownLoadDoc.Visible = True
End If
txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString.ToDate.ToString("dd/MM/yyyy")
@@ -6956,17 +6994,18 @@ Partial Class Clientes
If File.Exists(linkDescargaArchivo) Then
ImgDownLoad.Visible = True
If extencion.Length > 0 Then
ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CveCliente & Documentacion & "." & extencion)
Else
ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CveCliente & Documentacion)
End If
LnkDownLoadDoc.Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkDownLoadDoc)
'If extencion.Length > 0 Then
' ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CveCliente & Documentacion & "." & extencion)
'Else
' ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CveCliente & Documentacion)
'End If
Else
ImgDownLoad.Visible = False
LnkDownLoadDoc.Visible = False
End If
Else
ImgDownLoad.Visible = False
LnkDownLoadDoc.Visible = False
End If
If requerido Then
@@ -6975,7 +7014,7 @@ Partial Class Clientes
' ImgRequired.Text = " <a class='btn btn-circle btn-sm grey-salt' href='#' data-toggle='tooltip' title='No obligatorio' ><i class='fa fa-asterisk '></i></a>"
End If
If UsuarioActual.TienePermisoProceso(248) And e.Row.DBCampo("Estatus").ToString.ToEntero = 1 And ImgDownLoad.Visible Then
If UsuarioActual.TienePermisoProceso(248) And e.Row.DBCampo("Estatus").ToString.ToEntero = 1 And LnkDownLoadDoc.Visible Then
e.Row.FCLinkButton("LnkGvDocumentosEliminar").Visible = True
End If