Files
extras/diario.aspx.vb
Cecilia Piaggio df00e41104 1er commit
prueba 1 con gitignore
2025-06-23 15:28:32 -03:00

116 lines
7.7 KiB
VB.net

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 = "<div class=""cuerpopdf""><img src=""https://cdn1.eldia.com/012019/1548440115684.jpg"" alt=""Cuerpo del Diario EL DIA en PDF"" border=""0px"" />" _
+ "<a href=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/1.pdf"" target=""_blank""><img style=""width:196px"" src=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/1.jpg" + """ alt=""Tapa del Diario"" hspace=""10"" vspace=""10"" /></a></div>"
str_vinculos = ""
str_vinculos1 = ""
Else
str_file = File.Substring(File.LastIndexOf("\") + 1, File.Length - File.LastIndexOf("\") - 1)
If n_suples < 3 Then
str_vinculos += "<div style=""float:left;margin: 0 1%""><a href=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file + """ target=""_blank""><img style=""width:196px; float:left; margin:5px"" src=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file.Replace("pdf", "jpg") + "" + """ alt="""" hspace=""5"" vspace=""10"" /></a></div>"
n_suples += 1
Else
str_vinculos1 += "<div style=""float:left;margin: 0 1%""><a href=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file + """ target=""_blank""><img style=""width:196px; float:left; margin:5px"" src=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file.Replace("pdf", "jpg") + "" + """ alt="""" hspace=""5"" vspace=""10"" /></a></div>"
n_suples += 1
End If
End If
Next
If str_vinculos.Length > 1 Then
str_vinculos = "<div class=""suplementospdf""><div style=""width:100%;height:55px""><img src=""https://cdn1.eldia.com/032019/1552075204376.jpg"" alt=""Suplementos del Diario EL DIA en PDF"" border=""0px"" /></div>" + str_vinculos + "<div style=""clear:both""></div></div>" _
+ "<div style=""clear:both""></div>"
End If
If str_vinculos1.Length > 1 Then
str_vinculos1 = "<div class=""suplementos1pdf""><div style=""width:100%;height:55px""><img src=""https://cdn1.eldia.com/032019/1552075204950.jpg"" alt=""Suplementos del Diario EL DIA en PDF"" border=""0px"" /></div>" + str_vinculos1 + "<div style=""clear:both""></div></div>" _
+ "<div style=""clear:both""></div>"
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 = "<div class=""cuerpopdf""><img src=""https://cdn1.eldia.com/012019/1548440115684.jpg"" alt=""Cuerpo del Diario EL DIA en PDF"" border=""0px"" />" _
+ "<a href=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/1.pdf"" target=""_blank""><img style=""width:196px"" src=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/1.jpg" + """ alt=""Tapa del Diario"" hspace=""10"" vspace=""10"" /></a></div>"
str_vinculos = ""
str_vinculos1 = ""
Else
str_file = File.Substring(File.LastIndexOf("\") + 1, File.Length - File.LastIndexOf("\") - 1)
If n_suples < 3 Then
str_vinculos += "<div style=""float:left;margin: 0 1%""><a href=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file + """ target=""_blank""><img style=""width:196px; float:left; margin:5px"" src=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file.Replace("pdf", "jpg") + "" + """ alt="""" hspace=""5"" vspace=""10"" /></a></div>"
n_suples += 1
Else
str_vinculos1 += "<div style=""float:left;margin: 0 1%""><a href=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file + """ target=""_blank""><img style=""width:196px; float:left; margin:5px"" src=""" + sitio_pdfs + "/pdfx/" + str_fecha + "/" + str_file.Replace("pdf", "jpg") + "" + """ alt="""" hspace=""5"" vspace=""10"" /></a></div>"
n_suples += 1
End If
End If
Next
If str_vinculos.Length > 1 Then
str_vinculos = "<div class=""suplementospdf""><div style=""width:100%;height:55px""><img src=""https://cdn1.eldia.com/032019/1552075204376.jpg"" alt=""Suplementos del Diario EL DIA en PDF"" border=""0px"" /></div>" + str_vinculos + "<div style=""clear:both""></div></div>" _
+ "<div style=""clear:both""></div>"
End If
If str_vinculos1.Length > 1 Then
str_vinculos1 = "<div class=""suplementos1pdf""><div style=""width:100%;height:55px""><img src=""https://cdn1.eldia.com/032019/1552075204950.jpg"" alt=""Suplementos del Diario EL DIA en PDF"" border=""0px"" /></div>" + str_vinculos1 + "<div style=""clear:both""></div></div>" _
+ "<div style=""clear:both""></div>"
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