<%@ page contentType="text/html;charset=GBK" %>
<%@ include file="../checkLogin.jsp" %>
<%@ page import="gbase.db.*,java.util.*,gbase.util.*,java.text.*"%>
<%
	
	String message="操作失败";
	String action = request.getParameter("action")==null?"":request.getParameter("action");
	String url="sys_project_list.jsp";
	
	String web_project_id=request.getParameter("web_project_id")==null?"":request.getParameter("web_project_id");
	String web_type=request.getParameter("web_type")==null?"":request.getParameter("web_type");
	String web_account=request.getParameter("web_account")==null?"":request.getParameter("web_account");
	String id=request.getParameter("sys_account")==null?"":request.getParameter("sys_account");
	
	SimpleDateFormat timeformat = new SimpleDateFormat("yyyy-MM-dd");
        java.util.Date date = Calendar.getInstance().getTime();
        String create_date = timeformat.format(date).toString();
        
        String sql="";
        DBOperation theDBOperation = new DBOperation();
        
        if(action.equals("delete"))
	  sql="delete from sys_project where sys_account='"+id+"'";
	else
	  {
	  SeqIdGenerater theSeqIdGenerater=new SeqIdGenerater();
	  int seqId=theSeqIdGenerater.generatorKey("sys_project",1);
	  id=Integer.toString(seqId);
	  sql="insert into sys_project(sys_account,create_date,web_project_id,web_type) values('"+seqId+"','"+create_date+"',"+web_project_id+",'"+web_type+"')";
	  }
	//out.println(sql);
	
        try {
        int i=theDBOperation.executeSql(sql);
        if(i>0)
          {
          if(!action.equals("delete"))
          {
           DataProcess theDataProcess=new DataProcess();
           theDataProcess.sysProjectCreate(web_project_id,web_account,id,"","");
          }
          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>