<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.bulletin.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
%>
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="PKEY" value="<%=sPKEY%>">
  <input type="hidden" name="type" value="<%=sType%>">
</form>
	
<%
	//添加与删除
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));

    SzLogControl logControl = new SzLogControl();
    boolean flag = false;
    String sUrl = "index.jsp";
    String sMessage = "";
    if (sOPERATOR.equals("delete")) {
        String id_str[] = request.getParameterValues("chkId");
        flag = logControl.delete(id_str);
    } else {
        String sKEY = SzConvert.toZeroStr(request.getParameter("KEY"));

        String RZID =   SzConvert.toZeroStr(request.getParameter("RZID"));
        String RZCZRY = SzConvert.strWriteData(request.getParameter("RZCZRY"));
        String RZDLID = SzConvert.strWriteData(request.getParameter("RZDLID"));
        String RZMK =   SzConvert.strWriteData(request.getParameter("RZMK"));
        String RZXX =   SzConvert.strWriteData(request.getParameter("RZXX"));
        String RZBZ =   SzConvert.strWriteData(request.getParameter("RZBZ"));
        String RZNR =   SzConvert.strWriteData(request.getParameter("RZNR"));
        String RZCZSJ = SzConvert.strWriteData(request.getParameter("RZCZSJ"));
        String RZIP =   SzConvert.strWriteData(request.getParameter("RZIP"));
        String RZWK =   SzConvert.strWriteData(request.getParameter("RZWK"));
        String RZGSID = SzConvert.strWriteData(request.getParameter("RZGSID"));
        String RZLX =   SzConvert.strWriteData(request.getParameter("RZLX"));
        String RZQT =   SzConvert.strWriteData(request.getParameter("RZQT"));

        
        String value_str[] = {
          ""  + RZID + "",
          "'" + RZCZRY + "'",
          "'" + RZDLID + "'",
          "'" + RZMK + "'",
          "'" + RZXX + "'",
          "'" + RZBZ + "'",
          "'"  + RZNR + "'",
          "'" + RZCZSJ + "'",
          "'" + RZIP + "'",
          "'" + RZWK + "'",
          "'" + RZGSID + "'",
          "'" + RZLX + "'",
          "'" + RZQT + "'",
        };
        if (sOPERATOR.equals("add")) {
            flag = logControl.add(value_str);
        } else if (sOPERATOR.equals("update") || sOPERATOR.equals("back")) {
            flag = logControl.update(value_str, Integer.parseInt(sKEY));
        }
    }
    sMessage = SzOut.getMessage();

    if (flag) {
        out.println(SzPageHelp.jsAlert("操作成功"));
        //out.println(SzPageHelp.jsGoUrl(sUrl));
        out.println(SzPageHelp.jsFormSubmit("formHidden",sUrl));
    } else {
        out.println(SzPageHelp.jsAlertBack(sMessage));
    }
%>
