?? jcy_pxxx_submit.jsp
字號:
<%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*,com.vstsoft.std.*" errorPage="" %>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<jsp:useBean id="jcypurview" class="com.vstsoft.jcypurview" scope = "session" />
<html>
<%vststd std = new vststd();%>
<%
String pxxxid_id = std.getValue(request,"ID"); // 培訓代碼
String szt = std.getValue(request,"zt"); // 按鈕類別
//String sfzh= std.getValue(request,"sfzh"); // 身份證號
String userid =std.getValue(request,"userid"); // 人員編號
String imager = "";
String lry =""; //錄入人
String lrsj = ""; //錄入時間
int ixy = 0;
%>
<%
if (jcypurview.checkLogin() == false)
{
%>
<Script Language=javascript>
alert("用戶已斷線或未正常登錄,請重新登錄!")
window.open("../index.htm","_top")
</Script>
<% return;
}
if (szt.equals("del"))
{
if (jcypurview.purviewVerdict("B0500038") == false) //判斷是否有刪除權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("modify"))
{
if (jcypurview.purviewVerdict("B0500037") == false) //判斷是否有修改權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("new"))
{
if (jcypurview.purviewVerdict("B0500036") == false) //判斷是否有新增權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}%>
<%
String nowuserid = jcypurview.getUserid(); //取當前用戶編號
String nowusername = jcypurview.getUserName(); //取當前用戶名稱
String nowuserszqx = jcypurview.getUserSzqx(); //取當前用戶所在區縣
String nowuserszdw = jcypurview.getUserSzdw(); //取當前用戶所在單位
%>
<%
//公務員培訓新增
if ( szt.equals("new"))
{
String pxnd= std.getValue(request,"pxnd").trim(); //公務員培訓年度
if (pxnd.length() > 4)
{
imager = "年度長度不能超過4位!";
ixy = 1;
}
if (ixy != 1)
{
if (pxnd.equals(""))
{
imager = "年度長度不能為空!";
ixy = 1;
}
}
String pxbm = std.getValue(request,"pxbm").trim(); //公務員培訓組織部門
String pxqr = std.getValue(request,"rq").trim(); //公務員培訓時間起
String pxzr = std.getValue(request,"rqr").trim(); //公務員培訓時間止
if (ixy != 1)
{
String newpxqz = "select count(*) from dual where to_date('"+pxzr+"','yyyy.mm.dd') >= to_date('"+pxqr+"','yyyy.mm.dd')";
sun.jdbc.rowset.CachedRowSet ii = std.getResultBySelect(newpxqz);
ii.next();
String newjl = ii.getString(1);
if (newjl.equals("0"))
{
imager = "請輸入正確時間!";
ixy = 1;
}
}
String pxqc = std.getValue(request,"pxqc").trim(); //公務員培訓班期次
if (ixy != 1)
{
if (pxqc.length() > 20)
{
imager = "培訓班期次長度不能大于20個字符!";
ixy = 1;
}
}
if (ixy != 1)
{
if (pxqc.equals(""))
{
imager = "培訓班期次長度不能為空";
ixy = 1;
}
}
String sfzh= std.getValue(request,"sfzh"); //公務員身份證號
String username = std.getValue(request,"username"); //公務員姓名
String pxqk = std.getValue(request,"pxqk").trim(); //備注
if (ixy != 1)
{
if (pxqk.length()> 1000)
{
ixy = 1;
imager = "培訓情況長度不能超過1000字符!";
}
}
if (ixy != 1)
{
if (pxqk.equals(""))
{
ixy = 1;
imager = "培訓情況不能為空!";
}
}
if (ixy == 0)
{
//取數據庫時間
String lrrq = std.getDateStr("YYYY.MM.DD");
String qunianqi="select count(*) from jcy_pxxx where pxbm='"+pxbm+"' and pxqc='"+pxqc+"' and pxnd='"+pxnd+"' and userid = '"+userid+"' ";
sun.jdbc.rowset.CachedRowSet v_qunianqi = std.getResultBySelect(qunianqi);
v_qunianqi.next();
String p_qunianqi=v_qunianqi.getString(1);
if(p_qunianqi.equals("0"))
{
//單位序號
String id ="SELECT LPAD(SEQ_jcyID.NEXTVAL,10,'0') FROM DUAL";
sun.jdbc.rowset.CachedRowSet crs = std.getResultBySelect("SELECT LPAD(SEQ_jcyID.NEXTVAL,10,'0') FROM DUAL");
crs.next();
String suserid = crs.getString(1);
//查詢人員表
String sql_insert = "insert into jcy_pxxx (pxxxid) values ('"+suserid+"')";
int isi = std.getResultByUpdate(sql_insert);
if (isi == 1 )
{
String sql_update = "update jcy_pxxx set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxnd='"+pxnd+"',pxqc='"+pxqc+"',pxqk='"+pxqk+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD'),userid = '"+userid+"' where pxxxid = '"+suserid+"'";
int isu = std.getResultByUpdate(sql_update);
if (isu == 1)
{
imager = "保存成功!";
}else
{
ixy = 1;
imager = "新增失敗!";
}
}
}else
{
imager = "該公務員已經記錄過此次培訓";
ixy = 1;
}
}
}
//公務員培訓修
if (szt.equals("modify"))
{
String pxnd= std.getValue(request,"pxnd").trim(); //公務員培訓年度
if (pxnd.length() > 4)
{
imager = "年度長度不能超過4位!";
ixy = 1;
}
if (ixy != 1)
{
if (pxnd.equals(""))
{
imager = "年度長度不能為空!";
ixy = 1;
}
}
String pxbm = std.getValue(request,"pxbm"); //公務員培訓組織部門
String pxqr = std.getValue(request,"rq"); //公務員培訓時間起
String pxzr = std.getValue(request,"rqr"); //公務員培訓時間止
if (ixy != 1)
{
String pxqz = "select count(*) from dual where to_date('"+pxzr+"','yyyy.mm.dd') >= to_date('"+pxqr+"','yyyy.mm.dd')";
sun.jdbc.rowset.CachedRowSet ii = std.getResultBySelect(pxqz);
ii.next();
String jl = ii.getString(1);
if (jl.equals("0"))
{
imager = "請輸入正確時間!";
ixy = 1;
}
}
String pxqc = std.getValue(request,"pxqc").trim(); //公務員培訓班期次
if (ixy != 1)
{
if (pxqc.length() > 20)
{
imager = "培訓班期次長度不能大于20個字符!";
ixy = 1;
}
}
if (ixy != 1)
{
if (pxqc.equals(""))
{
imager = "培訓班期次長度不能為空";
ixy = 1;
}
}
String sfzh= std.getValue(request,"sfzh"); //公務員身份證號
String username = std.getValue(request,"username"); //公務員姓名
String pxqk = std.getValue(request,"pxqk").trim(); //備注
if (ixy != 1)
{
if (pxqk.length()> 1000)
{
ixy = 1;
imager = "培訓情況長度不能超過1000字符!";
}
}
if (ixy != 1)
{
if (pxqk.equals(""))
{
ixy = 1;
imager = "培訓情況不能為空!";
}
}
if(ixy == 0)
{
//取數據庫時間
String lrrq = std.getDateStr("YYYY.MM.DD");
//判斷是否修改
String xugai = "select pxqc from jcy_pxxx where pxxxid = '"+pxxxid_id+"'";
sun.jdbc.rowset.CachedRowSet v_xugai = std.getResultBySelect(xugai);
v_xugai.next();
String pi_xugai = v_xugai.getString(1);
if(!pi_xugai.equals(pxqc))
{
String qunianqi="select count(*) from jcy_pxxx where pxbm='"+pxbm+"' and pxqc='"+pxqc+"' and pxnd='"+pxnd+"' and userid = '"+userid+"' ";
sun.jdbc.rowset.CachedRowSet v_qunianqi = std.getResultBySelect(qunianqi);
v_qunianqi.next();
String p_qunianqi=v_qunianqi.getString(1);
if(p_qunianqi.equals("0"))
{
//修改人員培訓
String sql_modify_update = "update jcy_pxxx set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxnd='"+pxnd+"',pxqc='"+pxqc+"',pxqk='"+pxqk+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD'),userid = '"+userid+"' where pxxxid = '"+pxxxid_id+"'";
int imodify = std.getResultByUpdate(sql_modify_update);
if (imodify == 1 )
{
imager = "修改成功!";
}else
{
ixy = 1;
imager = "修改失敗!";
}
}else
{
imager = "該公務員已經記錄過此次培訓";
ixy = 1;
}
}
else
{
//修改人員培訓
String sql_modify_update = "update jcy_pxxx set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxnd='"+pxnd+"',pxqc='"+pxqc+"',pxqk='"+pxqk+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD'),userid = '"+userid+"' where pxxxid = '"+pxxxid_id+"'";
int imodify = std.getResultByUpdate(sql_modify_update);
if (imodify == 1 )
{
imager = "修改成功!";
}else
{
ixy = 1;
imager = "修改失敗!";
}
}
}
}
//公務員培訓刪除
if(szt.equals("del"))
{
String sql_del = "delete from jcy_pxxx where pxxxid = '"+pxxxid_id+"'";
int idel = std.getResultByUpdate(sql_del);
if (idel == 1)
{
imager = "刪除成功!";
}else
{
ixy = 1;
imager = "刪除失敗!";
}
}
%>
<head>
<title>
</title>
</head>
<body onLoad="parent.f_imager('<%=imager%>','<%=ixy%>')">
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -