<%@language=vbscript codepage=936 %>
<!--#include file="../../Inc/conn.asp"-->
<!--#include file="../admin.asp"-->
<!-- #include file="../Inc/Head.asp" -->
<%
dim BigClassID,Action,rs,NewBigClassName,OldBigClassName,FoundErr,ErrMsg
BigClassID=strToNum(Request("BigClassID"))
Action=ChkFormStr(Request("Action"))
NewBigClassName=ChkFormStr(Request("NewBigClassName"))
OldBigClassName=ChkFormStr(Request("OldBigClassName"))
OrderID=strToNum(request("OrderID"))
IsShow=strToNum(request("IsShow"))

if BigClassID=0 then
  response.Redirect("News_ClassManage.asp")
end if

Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open "Select * from BigClass_New where BigClassID=" &BigClassID,conn,1,3
	If rs.Bof And rs.EOF Then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>此产品大类不存在！</li>"
	Else
	If Action="Modify" Then
		If NewBigClassName="" Then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>产品大类名不能为空！</li>"
		End if
		If FoundErr<>True Then
			rs("BigClassName")=NewBigClassName
			rs("OrderID")=OrderID
			if IsShow=1 Then
				rs("IsShow")=true
			else
				rs("IsShow")=false
			end if
    	 	rs.update
			rs.Close
	     	set rs=Nothing
			if NewBigClassName<>OldBigClassName then
				conn.execute "Update SmallClass_New set BigClassName='"&NewBigClassName&"' where BigClassID="&BigClassID&""
				conn.execute "Update News set BigClassName='"&NewBigClassName&"' where BigClass="&BigClassID&""
     		end if		
			call CloseConn()
     		Response.Redirect "News_ClassManage.asp" 
		End If
	end if
	If FoundErr=True Then
		call WriteErrMsg()
	Else
%>
<script language="JavaScript" type="text/JavaScript">
<!--
function CheckBig()
{
  if (document.BigForm.NewBigClassName.value=="")
  {
    alert("大类名称不能为空！");
    document.BigForm.NewBigClassName.focus();
    return false;
  }
}
-->
</script>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top">
    <form name="BigForm" method="post" action="News_ClassModifyBig.asp" onSubmit="return CheckBig();">
              <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="table_southidc">
                <tr bgcolor="#A4B6D7" class="title"> 
                  <td height="25" colspan="2" align="center" bgcolor="#A4B6D7" class="back_southidc"><strong>修改大类名称</strong></td>
                </tr>
                <tr class="tdbg"> 
                  <td align="right" class="tr_southidc"><strong>大类ID：</strong></td>
                  <td width="457" align="left" class="tr_southidc"><%=rs("BigClassID")%>
				  <input name="BigClassID" type="hidden" id="BigClassID" value="<%=rs("BigClassID")%>"> 
                    <input name="OldBigClassName" type="hidden" id="OldBigClassName" value="<%=rs("BigClassName")%>"></td>
                </tr>
                <tr class="tdbg"> 
                  <td align="right" class="tr_southidc"><strong>大类名称：</strong></td>
                  <td align="left" class="tr_southidc"> <input name="NewBigClassName" type="text" id="NewBigClassName" value="<%=rs("BigClassName")%>" size="20" maxlength="30"></td>
                </tr>
            <tr bgcolor="#C0C0C0" class="tdbg">
              <td height="22" align="right" class="tr_southidc"><strong>排列顺序：</strong></td>
              <td height="22" align="left" class="tr_southidc"><input name="OrderID" type="text" id="OrderID" value="<%=rs("OrderID")%>" size="5"></td>
            </tr>
            <tr bgcolor="#C0C0C0" class="tdbg">
              <td height="22" align="right" class="tr_southidc"><strong>是否显示：</strong></td>
              <td height="22" align="left" class="tr_southidc">
              <input name="IsShow" type="checkbox" id="IsShow" value="1" <%if rs("IsShow")=True Then%>checked<%end if%>></td>
            </tr>
                <tr class="tdbg"> 
                  <td align="center" class="tr_southidc">&nbsp;</td>
                  <td align="center" class="tr_southidc"> <div align="left"> 
                      <input name="Action" type="hidden" id="Action" value="Modify">
                      <input name="Save" type="submit" id="Save" value="确认修改">
                  &nbsp;
                  <input type="button" name="Submit" value="返回上一页" onClick="history.go(-1);">
                  </div></td>
                </tr>
              </table>
      </form>
 </td>
  </tr>
</table><%
	end if
end if
rs.close
set rs=nothing
%>
<!-- #include file="../Inc/Foot.asp" -->