<!--#include file="byshop_conn.asp"-->
<!--#include file="session.asp"-->

<%
if request("action")="update" then
    for i=1 to request.form("id").count
	id=replace(request.form("id")(i),"'","")
	gdorder=replace(request.form("gdorder")(i),"'","")
	gdorder2=-gdorder
	gudingdate="3000-1-1 1:1:1"
	dd=DateAdd("h",gdorder2,gudingdate)
conn.execute("update sell set gdorder="&gdorder&" ,adddate='"&dd&"' where id="&id)
next
end if

if request("action")="add" then
	id=replace(request.form("id"),"'","")
	gdorder=replace(request.form("gdorder"),"'","")
	Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from sell where id="&id,conn,1,3
rs("guding")=1
rs("gdorder")=gdorder
rs.update
rs.close
response.Redirect "sellsellgd.asp"
end if

%> 
<html>
<head>
<title>新楼盘顶固</title>
<script>
function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<center>
<div align="center">
<table cellpadding="3" cellspacing="1" border="1" width="100%" class="tableBorder" style="border-collapse: collapse" bordercolor="#C0C0C0">
 <form method="post" action="sellgd.asp?action=update">
   <tr> 
	<th class="tableHeaderText" colspan=4 bgcolor="#E8F1FF">租凭房出租固顶</th>	
   </tr>
      <tr align=center> 
        <td class="forumRowHighlight" bgcolor="#F7F7F7" width=15%>ID</td>
        <td class="forumRowHighlight" bgcolor="#F7F7F7" width=35%>楼盘名称</td>
        <td class="forumRowHighlight" bgcolor="#F7F7F7" width=35%>固顶排序(从小到大)</td>
        <td class="forumRowHighlight" bgcolor="#F7F7F7" width=15%>删除</td>
      </tr>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "SELECT  * from rent where guding=1 order by gdorder  ",conn,1,1
if rs.recordcount=0 then 
%>
      <tr> 
        <td colspan="4" height=25 align="center" width="100%" class="forumRowHighlight" bgcolor="#F7F7F7"> 
		还没有二手房出售固顶</td>
      </tr>
<%
else
    do while not rs.eof
%>
      <tr height=25> 
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7"><%=rs("ID")%></td>
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7"> 
          <input type="hidden" name="id" value="<%=rs("id")%>">
          	<%
	if rs("guding")=1 then
	response.write "<font color='#FF0000'>"
	end if	
 response.write rs("address")
  
  %>
        </td>
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7"> 
          <input class=text type="text" name="gdorder" size="10" value="<%=rs("gdorder")%>" ONKEYPRESS="event.returnValue=IsDigit();" >
        </td>
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7"> 
          <a href="sellgd.asp?killid=<%=rs("id")%>">删除</a> 
        </td>
      </tr>
      <%
    rs.MoveNext
    Loop
%>
      <tr> 
        <td colspan="4" height=25 align="center" width="100%" class="forumRowHighlight" bgcolor="#F7F7F7"> 
          <input class="button" type="submit" name="Submit2" value="保存修改" style="font-family: 宋体; font-size: 9pt" >
          &nbsp; 
          <input class="button" type="reset" value="重新设定" style="font-family: 宋体; font-size: 9pt" name="重置" >
        </td>
      </tr>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
    </form>
    <form method="post" action="sellgd.asp?action=add">
      <tr height=25> 
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7">新楼盘ID</td>
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7" > 
          <input class=text type="text" name="id" size="16" colspan="2">
        　(<font color="#FF0000">注意是ID</font>)</td>
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7"> 
          &nbsp;<input class=text type="text" name="gdorder" size="10" ONKEYPRESS="event.returnValue=IsDigit();"></td>
        <td align=center class="forumRowHighlight" bgcolor="#F7F7F7"> 
          <input class="button" type="submit" name="Submit3" value="添加" style="font-family: 宋体; font-size: 9pt"></td>
      </tr>
    </form>
  </table>
</div>
</center>
</body>
</html> 
<%

%>