Option Strict On Imports System.IO Partial Class diario Inherits System.Web.UI.Page Private dias(), nombredias() As String Private num_dias As String = System.Configuration.ConfigurationManager.AppSettings("num_diasPDF") Private d_fecha As Date Private ListaDirectorios, ListaDirectoriosObtenidos As New ArrayList Private str_dir() As String Public str_vinculos, str_vinculos1, str_cuerpo As String Private sitio_pdfs As String = System.Configuration.ConfigurationManager.AppSettings("sitio_pdfs") Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ReDim dias(CInt(num_dias) - 1) ReDim nombredias(CInt(num_dias) - 1) If Not IsPostBack Then Dim i As Integer For i = 0 To CInt(num_dias) - 1 'dias(i) = Date.Now.AddDays(-i).ToString("yyyyMMdd") nombredias(i) = Date.Now.AddDays(-i).ToString("dd/MM/yyyy") Next Drop_fecha.DataSource = nombredias Drop_fecha.DataBind() If CInt(Date.Now.ToString("HH")) < 3 Then d_fecha = Date.Now.AddDays(-1) '' si es antes de las 3 AM, muestra ayer Else d_fecha = Date.Now.AddDays(0) End If Dim str_fecha As String = d_fecha.ToString("yyyyMMdd") ' ' VeoDirectorios(str_fecha) If Not Request.Params("fecha") Is Nothing Then If Request.Params("fecha").ToString.Length = 8 Then str_fecha = Request.Params("fecha").ToString End If End If VeoDirectorios2(str_fecha) End If End Sub Private Sub VeoDirectorios2(ByVal str_fecha As String) ''str_fecha = "20121014" ''ojojojojojo 'admin.Errores("ServerMapPath " + Server.MapPath("\medios\pdfx\" + str_fecha)) If Directory.Exists(Server.MapPath("\medios\pdfx\" + str_fecha)) Then Dim str_file As String = "" Dim n_suples As Integer = 0 For Each File In Directory.GetFiles(Server.MapPath("\medios\pdfx\" + str_fecha), "*.pdf") If File.IndexOf("1.pdf") > 0 Then str_cuerpo = "
" _ + "
" str_vinculos = "" str_vinculos1 = "" Else str_file = File.Substring(File.LastIndexOf("\") + 1, File.Length - File.LastIndexOf("\") - 1) If n_suples < 3 Then str_vinculos += "
" n_suples += 1 Else str_vinculos1 += "
" n_suples += 1 End If End If Next If str_vinculos.Length > 1 Then str_vinculos = "
" + str_vinculos + "
" _ + "
" End If If str_vinculos1.Length > 1 Then str_vinculos1 = "
" + str_vinculos1 + "
" _ + "
" End If Else ' Pruebo con el día anterior: str_fecha = func.fecha1(str_fecha, -1).ToString("yyyyMMdd") Dim str_file As String = "" Dim n_suples As Integer = 0 For Each File In Directory.GetFiles(Server.MapPath("\medios\pdfx\" + str_fecha), "*.pdf") If File.IndexOf("1.pdf") > 0 Then str_cuerpo = "
" _ + "
" str_vinculos = "" str_vinculos1 = "" Else str_file = File.Substring(File.LastIndexOf("\") + 1, File.Length - File.LastIndexOf("\") - 1) If n_suples < 3 Then str_vinculos += "
" n_suples += 1 Else str_vinculos1 += "
" n_suples += 1 End If End If Next If str_vinculos.Length > 1 Then str_vinculos = "
" + str_vinculos + "
" _ + "
" End If If str_vinculos1.Length > 1 Then str_vinculos1 = "
" + str_vinculos1 + "
" _ + "
" End If End If '' Directory.Exists End Sub Protected Sub Drop_fecha_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Drop_fecha.SelectedIndexChanged Dim str_fecha As String = Drop_fecha.SelectedValue Dim fecha As Date = CDate(str_fecha) str_fecha = fecha.ToString("yyyyMMdd") admin.Errores("drop_fecha_indexchanged " + str_fecha) 'VeoDirectorios(str_fecha) VeoDirectorios2(str_fecha) End Sub End Class