<!--#include file="Item_Conn.asp"-->
<!--#include file="Item_Function.asp"-->
<html>
<head>
<title>采集系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../Skins/Admin_Style.Css" rel="stylesheet" type="text/css">
<script Language="JavaScript" src="../../Inc/Js/admin.js"></script>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<%
Dim Action,ItemID,Arr_Item,Arr_i,ItemName,Arr_Filter
Action=Trim(Request("Action"))
ItemID=Trim(Request("ItemID"))
FoundErr=False

If Action<>"Copy" Then
   FoundErr=True
   ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>"
End if   
If ItemID=""  Then
   FoundErr=True
   ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>"
Else
   ItemID=Clng(ItemID)
End If

If FoundErr<>True Then
   Set Rs=ConnItem.execute("Select * from Item Where ItemID=" & ItemID)
   If Not Rs.Eof And Not Rs.Bof Then
      Arr_Item=Rs.GetRows()
   Else
      Arr_Item=""
   End if
   Set Rs=Nothing

   If IsArray(Arr_Item)=True then
      Set Rs=ConnItem.execute("Select * from Filters Where PublicTf=False And ItemID=" & ItemID)
      If Not Rs.Eof And Not Rs.Bof Then
         Arr_Filter=Rs.GetRows()
      Else
         Arr_Filter=""
      End if
      Set Rs=Nothing
   End if
   
   If IsArray(Arr_Item)=True Then
      set rs=server.createobject("adodb.recordset")
      sql="select top 1 * from Item" 
      rs.open sql,connItem,1,3
      rs.AddNew
         rs(1)=Arr_Item(1,0)&"复件"
         ItemName=Arr_Item(1,0)
         For Arr_i=2 To Ubound(Arr_Item,1)
            rs(Arr_i)=Arr_Item(Arr_i,0)
         Next
         ItemID=rs("ItemID")
      rs.Update
      rs.close
      set rs=Nothing

      If IsArray(Arr_Filter)=True Then
         set rs=server.createobject("adodb.recordset")
         sql="select top 1 * from Filters" 
         rs.open sql,connItem,1,3
         rs.AddNew
            rs(1)=ItemID
            For Arr_i=2 To Ubound(Arr_Filter,1)
               rs(Arr_i)=Arr_Filter(Arr_i,0)
            Next
         rs.Update
         rs.close
         set rs=Nothing
      End if      
   else
      FoundErr=True
      ErrMsg=ErrMsg & "参数错误，没有找到该项目"
   end if
   
End if

If FoundErr=True Then
   Call Admin_ShowErr(ErrMsg)
Else
   Call Main
End If   
'关闭数据库链接
Call CloseAllObj()
Call CloseConnItem()

Sub Main%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="2" align="center" class="topbg"><strong>采&nbsp;&nbsp;集&nbsp;&nbsp;系&nbsp;&nbsp;统&nbsp;&nbsp;项&nbsp;&nbsp;目&nbsp;&nbsp;管&nbsp;&nbsp;理</td>
  </tr>
  <tr class="tdbg"> 
    <td width="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href=Item_Manage.asp>管理首页</a> | <a href="Item_AddNew.asp">添加新项目</a> | 项目复制</td>
  </tr>         
</table>         
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><strong>添 加 新 
		项 目--项 目 复 制</strong></div></td>
    </tr>
    <tr class="tdbg"> 
      <td height="22" colspan="2" class="tdbg" align="center"><br><%=ItemName%> 项目复制完成，新的项目保存为：<%=ItemName%>复件<br><br>
      </td>
    </tr>
</table>
<br>
<%End Sub%>
</body>         
</html>