<%@ page contentType="text/html;charset=GBK" %>
<%@ include file="../checkLogin.jsp" %>
<%@ page import="gbase.db.*,java.util.*,gbase.util.*"%>
<%
	
	String message="操作失败";
	String action = request.getParameter("action")==null?"":request.getParameter("action");
	String url="web_114company_detailtype_list.jsp";
	
	String id=request.getParameter("id")==null?"":request.getParameter("id");
        String title=request.getParameter("title")==null?"":request.getParameter("title");
        String content=request.getParameter("content")==null?"":request.getParameter("content");
        String maintype=request.getParameter("maintype")==null?"":request.getParameter("maintype");
	ConvertSql theConvertSql=new ConvertSql();
        content=theConvertSql.convertSqlValue(content);
        String sql="";
        DBOperation theDBOperation = new DBOperation();
        
	if(action.equals("update"))
	  { 
	  sql="update web_114company_detailtype set title='"+title+"',content='"+content+"',maintype='"+maintype+"' where id="+id+"";
	  }
	else if(action.equals("delete"))
	  sql="delete from web_114company_detailtype  where id="+id+"";
	else
	  {
	  SeqIdGenerater theSeqIdGenerater=new SeqIdGenerater();
	  int seqId=theSeqIdGenerater.generatorKey("web_114company_detailtype");
	  sql="insert into web_114company_detailtype(id,title,content,maintype,web_account) values("+seqId+",'"+title+"','"+content+"','"+maintype+"','"+web_account+"')";
	  }
	//out.println(sql);
	
        try {
        int i=theDBOperation.executeSql(sql);
        if(i>0)
          {
          message = "操作成功!";
          }
        else
          message = "操作失败!";
      }
      catch (Exception ex) {
        message = "操作失败!";
      }
	
%>
<script language="javascript">
	function process ( message,url){
		alert(message);
		self.location = url;
	}
</script>
<html>
	<head>
		<title></title>
	</head>
	<body onload="javascript: process('<%=message%>','<%=url%>');">
	</body>
</html>