se agregaron columnas faltantes y se agregaron los botones de descarga del documento(presente a cambios)
This commit is contained in:
@@ -28,17 +28,22 @@
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveDocumento,SubCategoria,Descripcion,Observacion,Version,Responsable,FechaAprobacion,FechaInicioVigencia"
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveDocumento,Categoria,SubCategoria,Descripcion,Observacion,Version,Responsable,FechaAprobacion,FechaInicioVigencia,ArchivoFisico"
|
||||
EmptyDataText="No se encontraron Documentos Registrados" ToolTip="Listado de Documentos" CssClass="table table-striped table-advance table-hover"
|
||||
Style="margin-top: -10px; text-align: center; width: 100%" GridLines="None">
|
||||
Style="margin-top: -10px; text-align: center; width: 100%" GridLines="None" OnRowDataBound="GvDatos_RowDataBound">
|
||||
<Columns>
|
||||
<asp:HyperLinkField HeaderText="Descripcion" DataTextField="Descripcion" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}" ItemStyle-HorizontalAlign="Left"/>
|
||||
<asp:HyperLinkField HeaderText="Observación" DataTextField="Observacion" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}" ItemStyle-HorizontalAlign="Left"/>
|
||||
<asp:HyperLinkField HeaderText="Versión" DataTextField="Version" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||
<asp:HyperLinkField HeaderText="Categoria" DataTextField="Categoria" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||
<asp:HyperLinkField HeaderText="SubCategoria" DataTextField="SubCategoria" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||
<asp:HyperLinkField HeaderText="Responsable" DataTextField="Responsable" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}" ItemStyle-HorizontalAlign="Left"/>
|
||||
<%--<asp:HyperLinkField HeaderText="Fecha Aprobacion" DataTextField="FechaAprobacion" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>--%>
|
||||
<asp:HyperLinkField HeaderText="Fecha Inicio Vigencia" DataTextField="FechaInicioVigencia" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||
<asp:HyperLinkField HeaderText="Fecha Inicio Vigencia" DataTextField="FechaInicioVigencia" DataTextFormatString="{0:d}" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LkbDescargarDoc" runat="server" OnClick="LkbDescargarDoc_Click" Visible="true" ClientIDMode="AutoID" AlternateText="Descargar" CausesValidation="False" CssClass="btn btn-circle btn-sm blue" Text="<i title='Subir Documento' class='fa fa-download' title='Descargar Documento' ></i>" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
|
||||
public partial class OI_Documentos : ClsPaginas
|
||||
{
|
||||
@@ -27,4 +28,32 @@ public partial class OI_Documentos : ClsPaginas
|
||||
}
|
||||
ObjOI.Dispose();
|
||||
}
|
||||
|
||||
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
LinkButton lkButonAux = e.Row.FCLinkButton("LkbDescargarDoc");
|
||||
ScriptManager.GetCurrent(this).RegisterPostBackControl(lkButonAux);
|
||||
}
|
||||
}
|
||||
|
||||
protected void LkbDescargarDoc_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
|
||||
string ArchivoFisico = GvRow.DataKey("ArchivoFisico");
|
||||
string NombreArchivo = ArchivoFisico.Split('_')[1];
|
||||
|
||||
string Ruta = string.Format("{0}Empresas/{1}/DocumentosRepo/{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ArchivoFisico);
|
||||
byte[] archivoBytes = File.ReadAllBytes(Ruta);
|
||||
|
||||
HttpContext.Current.Response.Clear();
|
||||
HttpContext.Current.Response.ClearContent();
|
||||
HttpContext.Current.Response.ContentType = "application/octet-stream";
|
||||
HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", NombreArchivo));
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", archivoBytes.Length.ToString());
|
||||
HttpContext.Current.Response.OutputStream.Write(archivoBytes, 0, archivoBytes.Length);
|
||||
HttpContext.Current.Response.End();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user