
<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="Inc/Function.asp"-->
<%

dim BigClassID,Action,rs,NewBigClassName,OldEnBigClassName,NewEnBigClassName,OldBigClassName
BigClassID=trim(Request("BigClassID"))
Action=trim(Request("Action"))
NewBigClassName=trim(Request("NewBigClassName"))
OldBigClassName=trim(Request("OldBigClassName"))
NewEnBigClassName=trim(Request("NewEnBigClassName"))
OldEnBigClassName=trim(Request("OldEnBigClassName"))

if BigClassID="" then
  response.Redirect("ClassManage.asp")
end if
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open "Select * from BigClass where BigClassID=" & CLng(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 NewEnBigClassName="" then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>产品英文大类名不能为空！</li>"
		end if
		if FoundErr<>True then
			rs("BigClassName")=NewBigClassName
			rs("EnBigClassName")=NewEnBigClassName			
    	 	rs.update
			rs.Close
	     	set rs=Nothing
			if NewBigClassName<>OldBigClassName then
				conn.execute "Update SmallClass set BigClassName='" & NewBigClassName & "' where BigClassName='" & OldBigClassName & "'"
				conn.execute "Update Product set BigClassName='" & NewBigClassName & "' where BigClassName='" & OldBigClassName & "'"
     		end if
			
			if NewEnBigClassName<>OldEnBigClassName then
				conn.execute "Update SmallClass set EnBigClassName='" & NewEnBigClassName & "' where EnBigClassName='" & OldEnBigClassName & "'"
				conn.execute "Update Product set EnBigClassName='" & NewEnBigClassName & "' where EnBigClassName='" & OldEnBigClassName & "'"
     		end if		
			call CloseConn()
     		Response.Redirect "ClassManage.asp" 
		end if
	end if
	if FoundErr=True then
		call WriteErrMsg()
	else
%>
<script language="JavaScript" type="text/JavaScript">
function checkBig()
{
  if (document.form1.BigClassName.value=="")
  {
    alert("大类名称不能为空！");
    document.form1.BigClassName.focus();
    return false;
  }
}
</script>
<!-- #include file="Inc/Head.asp" -->
<form name="form1" method="post" action="ClassModifyBig.asp">
        <table width="375" border="0" align="center" cellpadding="0" cellspacing="1" class=border>
          <tr class="title"> 
            <td height="25" colspan="2" align="center" class=Title><strong>修改大类名称</strong></td>
          </tr>
          <tr class="tdbg"> 
            <td width="258" class=tdbgl><div align="right"><strong>大类ID：</strong></div></td>
            <td width="729"><%=rs("BigClassID")%> <input name="BigClassID" type="hidden" id="BigClassID" value="<%=rs("BigClassID")%>"> 
              <input name="OldBigClassName" type="hidden" id="OldBigClassName" value="<%=rs("BigClassName")%>"> 
			    <input name="OldEnBigClassName" type="hidden" id="OldEnBigClassName" value="<%=rs("EnBigClassName")%>"> 
            </td>
          </tr>
          <tr class="tdbg"> 
            <td height="20" class=tdbgl><div align="right"><strong>大类名称：</strong></div></td>
            <td> <input name="NewBigClassName" type="text" id="NewBigClassName" value="<%=rs("BigClassName")%>" size="30" maxlength="50"> 
            </td>
          </tr>
          <tr class="tdbg">
            <td align="center" class=tdbgl><div align="right"><strong>英文大类名称：</strong></div></td>
            <td align="center"><div align="left">
                <input name="NewEnBigClassName" type="text" id="NewEnBigClassName" value="<%=rs("EnBigClassName")%>" size="30" maxlength="50">
              </div></td>
          </tr>
          <tr class="tdbg"> 
            <td align="center" class=tdbgl>　</td>
            <td align="center"> <div align="left"> 
                <input name="Action" type="hidden" id="Action" value="Modify">
                <input name="Save" type="submit" id="Save" value=" 修 改 ">
              </div></td>
          </tr>
  </table>
</form>
<!-- #include file="Inc/Foot.asp" -->
<%
	end if
end if
rs.close
set rs=nothing
call CloseConn()
%>