<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
end if
end if
%>
<%
dim action,emsid
emsid=SafeRequest("id",1)
action=FormatSQL(SafeRequest("action",0))
dvydate=trim(request.form("dvydateyear"))&"-"&trim(request.form("dvydatemonth"))&"-"&trim(request.form("dvydateday"))
select case action
case "add"
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权添加发货清单！');history.go(-1);</script>"
response.End
end if

if request.form("username")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写发货人！');history.go(-1);</script>"
response.End
end if
if request.form("deliverymethord")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写发货方式！');history.go(-1);</script>"
response.End
end if
if request.form("address")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写收货人地址！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from sdx_ems",conn,1,3
rs.AddNew
rs("dvydate")=dvydate
rs("username")=trim(request.form("username"))
rs("deliverymethord")=trim(request.form("deliverymethord"))
rs("emsnum")=trim(request.form("emsnum"))
rs("address")=trim(request.form("address"))
rs("emsurl")=trim(request.form("emsurl"))
rs.Update
rs.Close
set rs=nothing
response.Write "<script language='javascript'>alert('添加成功！');location.href='admin_ems.asp' ;</script>"
response.End
case "edit"
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权修改发货清单！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from sdx_ems where emsid="&emsid,conn,1,3
rs("dvydate")=trim(request.form("dvydate"))
rs("username")=trim(request.form("username"))
rs("deliverymethord")=trim(request.form("deliverymethord"))
rs("emsnum")=trim(request.form("emsnum"))
rs("address")=trim(request.form("address"))
rs("emsurl")=trim(request.form("emsurl"))
rs.update
rs.close
set rs=nothing
response.Write "<script language='javascript'>alert('修改成功！');location.href='admin_ems.asp' ;</script>"
response.End
case "del"
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权删除发货清单！');history.go(-1);</script>"
response.End
end if
conn.execute "delete from sdx_ems where emsid="&emsid
set rs=nothing
response.Write "<script language='javascript'>alert('删除成功！');location.href='admin_ems.asp' ;</script>"
response.End
response.End
end select

%>