%'on error resume next
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_conBD_string
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open = MM_conBD_string
strsql = "select * from tbOrden"
Set RSOrd = Server.CreateObject("ADODB.Recordset")
RSOrd.Open strSQL, oConn,3,1
if RSOrd("Cambios")<>date then
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=1 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=1 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=2 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=2 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=3 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=3 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=3 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=3 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=4 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=4 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=5 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=5 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=6 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=6 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=7 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=7 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
strsql = "select Orden,TipoId from tbEstablecimientos where TipoId=8 order by Orden desc"
Set RSEstablecimientos1 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos1.Open strSQL, oConn,3,1
strsql = "select Orden,TipoId,Id from tbEstablecimientos where TipoId=8 order by Orden asc"
Set RSEstablecimientos2 = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos2.Open strSQL, oConn,3,1
if not RSEstablecimientos1.eof then
if not RSEstablecimientos2.eof then
r1=RSEstablecimientos1("Orden")
r2=RSEstablecimientos2("Orden")
if r1<>r2 then
MM_editCmd.commandtext = "Update tbEstablecimientos Set Orden="&r1+1&" Where Id="&RSEstablecimientos2("Id")
MM_editCmd.Execute
end if
end if
end if
RSEstablecimientos1.Close()
Set RSEstablecimientos1 = Nothing
RSEstablecimientos2.Close()
Set RSEstablecimientos2 = Nothing
RSOrd.Close()
Set RSOrd = Nothing
MM_editCmd.commandtext = "Update tbOrden Set Cambios='"&date&"'"
MM_editCmd.Execute
strsql = "select * from tbOrden"
Response.Redirect "default.asp"
end if
strsql = "select * from tbEstablecimientos order by TipoId,Orden asc"
Set RSEstablecimientos = Server.CreateObject("ADODB.Recordset")
RSEstablecimientos.Open strSQL, oConn,3,1
strsql = "select count(*) as num from tbEstablecimientos where (FC1=True or FC2=True or FC3=True or FC4=True or FC5=True or FC6=True or FC7=True) and (TipoId<>7 and TipoId<>8)"
Set RSFC = Server.CreateObject("ADODB.Recordset")
RSFC.Open strSQL, oConn,3,1%>
<%
Const totalfotos = 3
Randomize
Dim foto
foto = Int((totalfotos * Rnd) + 1)
%>
 |
<%RSOrd.Close()
Set RSOrd = Nothing
RSFC.Close()
Set RSFC = Nothing
RSEstablecimientos.Close()
Set RSEstablecimientos = Nothing%>