<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.system.SzOut" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.organize.SzUser" %>
<%@ page import="net.sz600.organize.SzUserInfo" %>
<%
    //获取提交的参数
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
%>
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
</form>
<%
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));

    SzUser szUser = new SzUser();
    boolean flag = false;
    String sUrl = "update.jsp";
    String sMessage = "";
    if (sOPERATOR.equals("delete")) {
        String id_str[] = request.getParameterValues("chkId");
        flag = szUser.delete(id_str);
    } else {
        //YGID,YGDL,YGBH,YGSFZ,YGXB,YGSJ,YGYX,YGDZ,YGSR,YGZW,YGTP,YGJJ
        String sKEY = SzConvert.toZeroStr(request.getParameter("KEY"));
        String YGID = SzConvert.toZeroStr(request.getParameter("YGID"));
        String YGDL = SzConvert.toZeroStr(request.getParameter("YGDL"));
        String YGBH = SzConvert.strWriteData(request.getParameter("YGBH"));
        String YGSFZ = SzConvert.strWriteData(request.getParameter("YGSFZ"));
        String YGXB = SzConvert.strWriteData(request.getParameter("YGXB"));
        String YGSJ = SzConvert.strWriteData(request.getParameter("YGSJ"));
        String YGYX = SzConvert.strWriteData(request.getParameter("YGYX"));
        String YGDZ = SzConvert.strWriteData(request.getParameter("YGDZ"));
        String YGSR = SzConvert.strWriteData(request.getParameter("YGSR"));
        String YGZW = SzConvert.strWriteData(request.getParameter("YGZW"));
        String YGTP = SzConvert.strWriteData(request.getParameter("YGTP"));
        String YGJJ = SzConvert.strWriteData(request.getParameter("YGJJ"));
        String YGZJLX = SzConvert.strWriteData(request.getParameter("YGZJLX"));
        String YGDH = SzConvert.strWriteData(request.getParameter("YGDH"));
        String YGCZ = SzConvert.strWriteData(request.getParameter("YGCZ"));
        String YGMSN = SzConvert.strWriteData(request.getParameter("YGMSN"));
        String YGQQ = SzConvert.strWriteData(request.getParameter("YGQQ"));
        //YGID,YGDL,YGBH,YGSFZ,YGXB,YGSJ,YGYX,YGDZ,YGSR,YGZW,YGTP,YGJJ,YGZJLX,YGDH,YGCZ,YGMSN,YGQQ

        String value_str[] = {
            "" + YGID + "",
            "" + YGDL + "",
            "'" + YGBH + "'",
            "'" + YGSFZ + "'",
            "'" + YGXB + "'",
            "'" + YGSJ + "'",
            "'" + YGYX + "'",
            "'" + YGDZ + "'",
            "'" + YGSR + "'",
            "'" + YGZW + "'",
            "'" + YGTP + "'",
            "'" + YGJJ + "'",
            "'" + YGZJLX + "'",
            "'" + YGDH + "'",
            "'" + YGCZ + "'",
            "'" + YGMSN + "'",
            "'" + YGQQ + "'"
        };
        if (sOPERATOR.equals("add")) {
            flag = szUser.add(value_str);
        } else if (sOPERATOR.equals("update")) {
            flag = szUser.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));
    }
%>
