<!--#include file="inc.asp"-->
<!--#include file="check.asp"-->
<%
act=request("act")
ClassID=request("Classid")
founderr=false
if act="del" then
FunDel
elseif act="edit" then
FunEdit
elseif act="add" then
FunAdd
elseif act="SetIsGood" then
FunSetIsGood
else
response.write "<li>操作错误！请联系管理员 <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
if founderr=true then
call error()
else
Response.write "<script>window.alert('操作成功！');javascript:history.back(1);</script>"
end if

function FunDel
Rem 删除歌曲
MyCls.Execute ("delete from special where specialid in (" & trim(request("specialid")) & ")")
Rem 删除目相关内容
MyCls.Execute ("delete from musiclist where specialid in (" & trim(request("specialid")) & ")")
end function


function FunAdd
name=trim(request("name"))
if name="" then
response.write "<li>专辑名称不能为空！<a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select * from special where (name='"&request("name")&"' and NClass='"&request("NClass")&"')"
rs.Open sql,conn, 1, 3
If Rs.Eof And Rs.Bof Then
rs.AddNew
rs("name") = request("name")
rs("NClass") = request("NClass")
rs("SClass") = request("SClass")
rs("Classid") = request("Classid")
rs("SClassid") = request("SClassid")
rs("Nclassid") = request("NClassid")
rs("yuyan") = request("yuyan")
rs("times") = request("times")
if trim(request("Pic"))<>"" then rs("Pic") = request.form("Pic")
if request("info")<>"" then rs("info") = request("info")
if request("gongsi")<>"" then rs("gongsi") = request("gongsi")
rs("isgood") = request("isgood")
if request("hits")<>"" then rs("hits") = request("hits")
rs.Update
else
Response.Write "该专集数据已经存在，跳过...<br>"
end if
rs.Close
set rs=nothing
conn.close
set conn=nothing
'Response.redirect "0hao_Geshou.asp?Classid="&request("Classid")&"&SClassid="&request("SClassid")
end function

function FunEdit
name=trim(request("name"))
if name="" then
response.write "<li>专辑名不能为空！ <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select * from special where specialid="&request("specialid")
rs.open sql,conn,1,3
if not rs.EOF then
rs("name") = request("name")
rs("NClass") = request("NClass")
rs("SClass") = request("SClass")
rs("Classid") = request("Classid")
rs("SClassid") = request("SClassid")
rs("Nclassid") = request("NClassid")
rs("yuyan") = request("yuyan")
rs("times") = request("times")
if request("info")<>"" then rs("info") = request("info")
if request("gongsi")<>"" then rs("gongsi") = request("gongsi")
if request("hits")<>"" then rs("hits") = request("hits")
rs("isgood") = request("isgood")
if request("Pic")="" then
rs("Pic")=null
else
rs("Pic") = request.form("Pic")
end if
rs.update
end if
rs.close

sql="select * from musiclist where specialid="&request("specialid")
rs.open sql,conn,1,3
if not rs.EOF then
rs("specialname") = request("name")
rs.update
end if
rs.close

set rs=nothing

conn.close
set conn=nothing
Response.redirect "0hao_Geshou.asp?Classid="&request("Classid")&"&SClassid="&request("SClassid")
end function

'推荐
function FunSetIsGood
set rs=server.createobject("adodb.recordset")
sql="select IsGood from special where specialid="&request("specialid")
rs.open sql,conn,1,3
if not rs.EOF then
if rs("IsGood")=true then
rs("IsGood")=false
else
rs("IsGood")=true
end if
rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end function
%>