<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p04")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<html>
<head>
<title>标签还原</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<script language="javascript">
function ConfirmDel()
{
   if(confirm("此操作将使用您上次备份的标签库覆盖当前的标签库，您确认这样做吗？"))
     return true;
   else
     return false;
	 
}
</script>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
dim act
act=trim(request.QueryString("act"))
if(act="do") then
	response.write("<br><p align=""center"">")
	call LabelRecovery()
	response.write("</p>")
else
%>
<table width="100%" height="170"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FF9900" style="border:1px solid #000000;">
  <tr>
    <td height="24"><div align="center" class="style1">标签还原</div></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><div align="center">
      <input type="submit" name="Submit" value="开始还原-&gt;&gt;" onClick="if(ConfirmDel()){window.location.href='?act=do';}">
    </div></td>
  </tr>
</table>
<%end if%>
</body>
</html>
<%
sub LabelRecovery()
	dim n
	on error resume next
	set rs=server.createobject("adodb.recordset")
	rs.open "select count(*) from t_labeldump",conn,3,1
	if Err.Number <> 0 then
		if(Err.Number=-2147217865) then
			response.Write("没有找到备份的标签库!<br>")
			exit sub
		end if
	else
		n=rs(0)
	end if
	rs.close
	set rs=nothing
	if(n<1) then
		response.Write("您的标签备份库中没有任何信息，为安全起见，系统停止此项操作.")
		exit sub
	else
		conn.execute("drop table label")		
		conn.execute("select * into label from t_labeldump")		
		if Err.Number = 0 then
			response.Write("成功还原标签库!")
			response.Write("<br><p align=""center""><input type=""button"" value=""<<- 返 回"" onClick=""javascript:history.back();""></p>")
		end if
	end if
end sub
sub LabelDump
	on error resume next
	conn.execute("drop table t_labeldump") 
	if Err.Number <> 0 then
		if(Err.Number=-2147217865) then
			response.Write("创建标签备份表....<br>")
		end if
		'response.Write(err.number&"<br>"&err.description&"<br>"&err.source)		
	end if
	conn.execute("select * into t_labeldump from label")
	if Err.Number = 0 then
		response.Write("成功备份标签库!")
		response.Write("<br><p align=""center""><input type=""button"" value=""<<- 返 回"" onClick=""javascript:history.back();""></p>")
	end if
end sub
call connclose()
%>
