<!--#include file="../../conn.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/check.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称：新云网站管理系统
' 当前版本：NewAsp Content Management System Version 4.0
' 文件名称：admin_paymode.asp
' 更新日期：2008-09-16
' 官方网站：新云网络(www.NewAsp.net www.NewAsp.cn) QQ：94022511
'=====================================================================
' Copyright 2003-2008 NewAsp.net - All Rights Reserved.
' newasp is a trademark of NewAsp.net
'=====================================================================
%>
<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tableline linetitle" width="100" align="left">付款方式管理</td>
		<td class="tableline" width="*" align="right"><a href="admin_index.asp">管理首页</a>
			 - <a href="admin_userorder.asp">会员定单管理</a>
			 - <a href="admin_account.asp">交易明细查询</a>
			 - <a href="admin_confirm.asp">交费确认</a>
			 - <a href="admin_paymode.asp">付款方式</a>
			 - <a href="admin_list.asp">用户列表</a>
			 - <a href="admin_group.asp">用户组管理</a>
			 - <a href="admin_master.asp">管理员列表</a>
		</td>
	</tr>
</table>
<%
Dim Action
If Not ChkAdmin("PayMode") Then
	Call Transfer_error()
End If
Action = LCase(Request("action"))
Select Case Trim(Action)
Case "del"
	Call delPaymode()
Case "save"
	Call savePaymode()
Case "modify"
	Call modifyPaymode()
Case "edit"
	Call editPaymode()
Case Else
	Call showmain()
End Select
If FoundErr=True Then
	ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
NewAsp.PageEnd

Sub showmain()
%>
<form action="?action=save" method="post" name="myform">
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th nowrap="nowrap" colspan="4">增加付款方式</th>
	</tr>
	<tr>
		<td class="tablerow1" nowrap="nowrap" align="right"><b>付款标题：</b></td>
		<td class="tablerow1"><input size="35" name="modename" type="text" /></td>
		<td class="tablerow2" nowrap="nowrap" align="right" rowspan="6"><b>其它说明：</b><br />
		支持HTML</td>
		<td class="tablerow1" rowspan="6"><textarea rows="10" cols="45" name="readme"></textarea></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>开户银行：</b></td>
		<td class="tablerow2"><input size="35" name="site" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>银行帐号：</b></td>
		<td class="tablerow1"><input size="35" name="code" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>收 款 人：</b></td>
		<td class="tablerow2"><input name="payee" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" nowrap="nowrap" align="right"><b>银行 URL：</b></td>
		<td class="tablerow1"><input size="35" name="url" value="http://" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="center" colspan="4"><input class="button" type="submit" name="submit_button" value=" 确认提交 " /></td>
	</tr>
</table>
</form>
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th colspan="3">付款方式</th>
	</tr>
<%
	Dim Rs
	Set Rs = Newasp.Execute("SELECT modeid,modename,site,code,payee,url,readme FROM NC_Paymode ORDER BY modeid")
	If Rs.BOF And Rs.EOF Then
		Response.Write "<tr><td align=""center"" colspan=""3"" class=""tablerow1"">还没有添加付款方式！</td></tr>"
	Else
		Do While Not Rs.EOF
%>
	<tr>
		<td class="tabletitle" colspan="3"><a target="_blank" href="<%=Rs("url")%>"><%=Rs("modename")%></a></td>
	</tr>
	<tr>
		<td class="tablerow1" nowrap="nowrap" align="right" width="10%"><b>开户银行：</b></td>
		<td class="tablerow1" width="35%"><%=Rs("site")%></td>
		<td class="tablerow1" valign="top" width="55%" rowspan="4"><b>说明：</b><br />
		&nbsp;&nbsp;&nbsp;&nbsp;<%=Rs("readme")%></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>银行帐号：</b></td>
		<td class="tablerow2"><%=Rs("code")%></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>收 款 人：</b></td>
		<td class="tablerow1"><%=Rs("payee")%></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>管理选项：</b></td>
		<td class="tablerow2" align="center"><a href="?action=edit&amp;modeid=<%=Rs("modeid")%>">修 改</a> | <a onclick="return confirm('您确定要删除此付款方式吗?')" href="?action=del&amp;modeid=<%=Rs("modeid")%>">删 除</a></td>
	</tr>
<%
		Rs.movenext
		Loop
	End If
	Rs.Close:Set Rs = Nothing
	Response.Write "</table>"
End Sub

Sub editPaymode()
	Dim Rs
	Set Rs=NewAsp.Execute("SELECT modeid,modename,site,code,payee,url,readme FROM NC_Paymode WHERE modeid="&NewAsp.ChkNumeric(Request("modeid")))
	If Rs.BOF And Rs.EOF Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数！</li>"
		Set Rs = Nothing
		Exit Sub
	End If
%>
<form action="?action=modify" method="post" name="myform">
<input type="hidden" name="modeid" value="<%=Rs("modeid")%>">
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th nowrap="nowrap" colspan="4">修改付款方式</th>
	</tr>
	<tr>
		<td class="tablerow1" nowrap="nowrap" align="right"><b>付款标题：</b></td>
		<td class="tablerow1"><input size="35" name="modename" value="<%=Server.HTMLEncode(Rs("modename")&"")%>" type="text" /></td>
		<td class="tablerow2" nowrap="nowrap" align="right" rowspan="6"><b>其它说明：</b><br />
		支持HTML</td>
		<td class="tablerow1" rowspan="6"><textarea rows="10" cols="45" name="readme"><%=Server.HTMLEncode(Rs("readme")&"")%></textarea></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>开户银行：</b></td>
		<td class="tablerow2"><input size="35" name="site" value="<%=Server.HTMLEncode(Rs("site")&"")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>银行帐号：</b></td>
		<td class="tablerow1"><input size="35" name="code" value="<%=Server.HTMLEncode(Rs("code")&"")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>收 款 人：</b></td>
		<td class="tablerow2"><input name="payee" value="<%=Server.HTMLEncode(Rs("payee")&"")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" nowrap="nowrap" align="right"><b>银行 URL：</b></td>
		<td class="tablerow1"><input size="35" name="url" value="<%=Server.HTMLEncode(Rs("url")&"")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="center" colspan="4"><input class="button" type="button" onclick="javascript:history.go(-1)" name="go_button" value="返回上一页" />
		<input class="button" type="submit" name="submit_button" value=" 确认提交 " /></td>
	</tr>
</table>
<form>
<%
	Rs.Close:Set Rs = Nothing
End Sub

Sub savePaymode()
	Dim SQL
	SQL = "INSERT INTO NC_Paymode (modename,site,code,payee,url,readme,modetype) VALUES ('"& Newasp.CheckStr(Request("modename")) &"','"& Newasp.CheckStr(Request("site")) &"','"& Newasp.CheckStr(Request("code")) &"','"& Newasp.CheckStr(Request("payee")) &"','"& Newasp.CheckStr(Request("url")) &"','"& Newasp.CheckStr(Request("readme")) &"',0)"
	Newasp.Execute(SQL)
	Succeed("<li>恭喜您！添加付款方式成功。</li>")
End Sub

Sub modifyPaymode()
	Dim SQL
	If Not IsNumeric(Request("modeid")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数，ID错误！</li>"
		Exit Sub
	End If
	SQL = "UPDATE [NC_Paymode] SET modename='"& NewAsp.CheckStr(Request("modename")) &"',site='"& NewAsp.CheckStr(Request("site")) &"',code='"& NewAsp.CheckStr(Request("code")) &"',payee='"& NewAsp.CheckStr(Request("payee")) &"',url='"& NewAsp.CheckStr(Request("url")) &"',readme='"& NewAsp.CheckStr(Request("readme")) &"',modetype=0 WHERE modeid="& CLng(Request("modeid"))
	Newasp.Execute(SQL)
	Succeed("<li>恭喜您！修改付款方式成功。</li>")
End Sub

Sub delPaymode()
	If IsNumeric(Request("modeid")) Then
		Newasp.Execute("DELETE FROM [NC_Paymode] WHERE modeid="& CLng(Request("modeid")))
		Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
	Else
		FoundErr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数，ID错误！</li>"
		Exit Sub
	End If
End Sub
%>