<!--#include file="../include/Conn.jsp"-->
<!--#include file="Admin_IsLogin.jsp" -->
<%
if request("jpname")="" or request("point")="" then
response.Write "<script language='javascript'>alert('请用正确的方式添加或修改奖品！');history.go(-1);</script>"
response.End
end if
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
dim jpdate,dazhe
'dazhe=round(request("huiyuanjia")/request("shichangjia"),2)
'if request("bookdateyear")<>"" then
'bookdate=trim(request("bookdateyear"))&"年"&trim(request("bookdatemonth"))&"月"
'else
'bookdate=""
'end if
dim action,jpid
jpid=request.QueryString("id")
action=request.QueryString("action")
select case action
case "add"
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from T_jp",conn,1,3
rs.AddNew
rs("jpname")=trim(request("jpname")) '奖品名称
rs("point")=trim(request("point"))  '金币
rs("count")=trim(request("count")) 
rs("jpcontent")=htmlencode2(trim(request("jpcontent")))  '简介
rs("adddate")=now() '加入日期
if request("xianshi")=1 then  '推荐
rs("xianshi")=1
else
rs("xianshi")=0
end if
rs.Update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('添加成功！');window.location.href='AddAward.jsp';</script>"
response.End
case "edit"
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from T_jp where jpid="&jpid,conn,1,3
rs("jpname")=trim(request("jpname")) '奖品名称
rs("point")=trim(request("point"))  '金币
rs("count")=trim(request("count")) 
rs("jpcontent")=htmlencode2(trim(request("jpcontent")))  '简介
'rs("adddate")="bookdate"    '加入日期
if request("xianshi")=1 then  '推荐
rs("xianshi")=1
else
rs("xianshi")=0
end if
rs.Update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('修改成功！');window.location.href='ManageAward.jsp';</script>"
response.End
end select
%>
