<!--#include file="connn.asp"-->
<!--#include file="cookies.asp"-->
<%
dim action,Markid
Markid=Request("id")
action=Request("action")
select case action

case "add" 
if Not isNumeric(request.form("MarkTop")) then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('类型推荐必须是数字！');history.go(-1);</script>"
response.End
end if
if Not isNumeric(request.form("MarkNum")) then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('类型排序必须是数字！');history.go(-1);</script>"
response.End
end if
if request.form("MarkName") ="" 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 FOX_parductppp",conn,1,3
rs.AddNew
rs("MarkName")=trim(request.form("MarkName"))
rs("MarkNum")=int(request.form("MarkNum"))
rs("MarkTop")=int(request.form("MarkTop"))
rs.Update
rs.Close
set rs=nothing
conn.close
set conn = nothing
response.Redirect "ppgl.asp"

case "edit"
if Not isNumeric(request.form("MarkTop")) then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('类型推荐必须是数字！');history.go(-1);</script>"
response.End
end if
if Not isNumeric(request.form("MarkNum")) then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('类型排序必须是数字！');history.go(-1);</script>"
response.End
end if
if request.form("MarkName") ="" 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 FOX_parductppp where Markid="&Markid,conn,1,3
rs("MarkName")=trim(request.form("MarkName"))
rs("MarkNum")=int(request.form("MarkNum"))
rs("MarkTop")=int(request.form("MarkTop"))
rs.Update
rs.Close
set rs=nothing
conn.close
set conn = nothing
response.Redirect "ppgl.asp"

case "del"
conn.execute ("delete from FOX_parductppp where MarkID="&Markid)
conn.close
set conn = nothing
response.Redirect "ppgl.asp"
end select
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language = "JavaScript">
<!--
function CheckAdd()
{
    if(checkspace(document.AddForm.MarkNmae.value)) {
	document.AddForm.MarkNmae.focus();
    alert("请输入商品类型名称！");
	return false;
  }

     if(checkspace(document.AddForm.MiniPost.value)) {
	document.AddForm.MiniPost.focus();
    alert("请输入等级积分！");
	return false;
  }
     if(checkspace(document.AddForm.startMark.value)) {
	document.AddForm.startMark.focus();
    alert("请输入等级排序！");
	return false;
  }
      if(checkspace(document.AddForm.Stars.value)) {
	document.AddForm.Stars.focus();
    alert("请输入等级折扣！");
	return false;
  }
 
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
	function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}
//-->
</script>
<link href="images/fox.css" rel="stylesheet" type="text/css">
<style type=text/css>
BODY{
	margin:0px;
	FONT-SIZE: 12px;
	FONT-FAMILY: "宋体", "Verdana", "Arial", "Helvetica", "sans-serif";
	background-color: #CCCC99; 
	scrollbar-highlight-color: #CC9933; 
	scrollbar-arrow-color: #FFFFFF; 
	scrollbar-base-color: #CC9933
}
table { border:0px; }
td { font:normal 12px 宋体; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 宋体; color:#111111; text-decoration:none; }
a:hover { color:#384780;text-decoration:underline; }
.sec_menu { border-left:2px solid #CC3300; border-right:2px solid #CC3300; border-bottom:2px solid #CC3300; overflow:hidden; background:#ffffff; }
.menu_title {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title span { position:relative; top:2px; left:8px; color:#FFFF00; font-weight:bold; }
.menu_title2 {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title2 span { position:relative; top:2px; left:8px; color:#FEFEFE; font-weight:bold; }
input,select,Textarea{
font-family:宋体,Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
</style>

<div align="center">

<table width="99%" border="0" cellspacing="1" bgcolor="#CC3300">
  <tr> 
    <td height="24" align="center"><span class="STYLE1"><span class="STYLE3">类型设置</span></span></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF">
	<br>
	<table width="80%" border="2" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
        <tr align="center" bgcolor="#F7F7F7" height="25"> 
          <td width="28%" height="25" background="images/topbg.gif" bgcolor="#F7F7F7"><strong>类型名称</strong></td>
          <td width="18%" height="25" background="images/topbg.gif" bgcolor="#F7F7F7"><strong> 类型排序</strong></td>
          <td width="18%" height="25" background="images/topbg.gif" bgcolor="#F7F7F7"><strong>类型推荐</strong></td>
          <td width="18%" height="25" background="images/topbg.gif" bgcolor="#F7F7F7"><strong>操作</strong></td>
        </tr>
        <%set rs=server.CreateObject("adodb.recordset")
		  rs.Open "select * from FOX_parductppp order by MarkNum",conn,1,1
		  dim follows
		  if rs.EOF and rs.BOF then
		  response.Write "<div align=center><font color=red>还没有商品类型</font></center>"
		  follows=0
		  else
		  do while not rs.EOF
		  %>
        <form name="form1" method="post" action="ppgl.asp?action=edit&id=<%=int(rs("Markid"))%>">
          <tr align="center" bgcolor="#FFFFFF"> 
            <td height="25"><input name="MarkName" type="text" class="input_sr" id="category" value="<%=trim(rs("MarkName"))%>" size="20" maxlength="15"></td>
            <td height="25"><input name="MarkNum" type="text" class="input_sr" id="MarkNum" value="<%=int(rs("MarkNum"))%>" size="4" maxlength="4"></td>
            <td height="25"><select name="MarkTop" id="MarkTop">
			    <option value="0" <% if rs("MarkTop")=0 Then Response.write("Selected") %>>会员类型</option>
            </select></td>
            <td height="25"><input name="Submit" type="submit" class="input_bot" value="修 改"> 
            &nbsp; <img src="images/pic12.gif" width="20" height="15" align="absmiddle" /><a href="ppgl.asp?id=<%=int(rs("Markid"))%>&action=del" onClick="return confirm('您确定进行删除操作吗？')"><font color=red>删除</font></a>            </td>
          </tr>
        </form>
        <%rs.MoveNext
          loop
          follows=rs.RecordCount
          end if%>
      </table>
    <br></td>
  </tr>
</table>
</div>
<br>
<div align="center">
<table width="99%" border="0" cellspacing="1" bgcolor="#CC3300">
  <tr> 
    <td height="24" align="center"><span class="STYLE1"><span class="STYLE3">添加新类型</span></span></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF">
	<br>
	<table width="80%" border="2" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
        <tr align="center" bgcolor="#F7F7F7" height="20"> 
          <td width="28%" height="25" background="images/topbg.gif"><strong> 类型名称</strong></td>
          <td width="18%" height="25" background="images/topbg.gif"><strong>类型排序</strong></td>
          <td width="18%" height="25" background="images/topbg.gif"><strong>类型推荐</strong></td>
          <td width="18%" height="25" background="images/topbg.gif"><strong>操作</strong></td>
        </tr>
        <form name="AddForm" method="post" action="ppgl.asp?action=add">
          <tr align="center" bgcolor="#FFFFFF"> 
            <td height="25"><input name="MarkName" type="text" class="input_sr" id="MarkName" size="20"></td>
            <td height="25"><input name="MarkNum" type="text" class="input_sr" id="MarkNum" value="<%=follows+1%>" size="4"></td>
            <td height="25"><select name="MarkTop" id="MarkTop">
                <option value="0" selected>会员类型</option>
            </select> </td>
            <td height="25"><input name="Submit3" type="submit" class="input_bot" onClick="return CheckAdd();" value="添 加"></td>
          </tr>
        </form>
    </table>
	<br></td>
  </tr>
</table>

</div>


</body></html>