Files
SIG/Sistemas/ListadoReportes.aspx.cs

61 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static Extensiones.ModExtensiones;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Sistemas_ListadoReportes : ClsPaginas
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CargaDatos();
}
}
private void CargaDatos()
{
string RutaReportes = string.Format("{0}/Formatos", UsuarioActual.Empresa.Ruta);
string[] allfiles = Directory.GetFiles(RutaReportes, "*.mrt", SearchOption.TopDirectoryOnly);
GvDatos.DataSource = (from Reporte in allfiles
let file = new FileInfo(Reporte)
select new { RutaReporte = file.FullName, Reporte = file.Name.Replace(".mrt","") }).QueryToDataTable(true);
GvDatos.DataBind();
//EN LA EMPRESA DE JULIAN SE PUEDEN EDITAR LOS GENERALES
if (UsuarioActual.CveEmpresa == 2 )
{
DivGenerales.Visible = true;
string RutaGenerales = string.Format("{0}/Grales/Formatos", Extensiones.ModExtensiones.DirectorioEmpresas);
string[] allFormatosGenerales = Directory.GetFiles(RutaGenerales, "*.mrt", SearchOption.TopDirectoryOnly);
GvGenerales.DataSource = (from Reporte in allFormatosGenerales
let file = new FileInfo(Reporte)
select new { RutaReporte = file.FullName, Reporte = file.Name.Replace(".mrt", "") }).QueryToDataTable(true);
GvGenerales.DataBind();
}
UPDatos.Update();
}
protected void BtnEditar_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
var RutaReporteEncriptada = Encripta(GvRow.DataKey("RutaReporte"));
var hostURL = "http://localhost:2202";
if (EsProduccion)
{
hostURL = "http://sig.adssistemas.mx:6599";
}
var strURL = $"{hostURL}/Designer/EditReport?P={RutaReporteEncriptada}";
RegistraScript($"openWindow('{strURL}');");
}
}