?? jcy_pxb_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 pxxh_id = std.getValue(request,"ID"); // 培訓班代碼
String szt = std.getValue(request,"zt"); // 按鈕類別
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("B0500034") == false) //判斷是否有刪除權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("modify"))
{
if (jcypurview.purviewVerdict("B0500033") == false) //判斷是否有修改權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("new"))
{
if (jcypurview.purviewVerdict("B0500032") == 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 year = std.getValue(request,"year").trim(); //培訓年度
if (year.length() > 4)
{
imager = "年度長度不能超過4位!";
ixy = 1;
}
String pxqc = std.getValue(request,"pxqc").trim(); //培訓班期次
if (ixy != 1)
{
if (pxqc.length()> 20)
{
ixy = 1;
imager = "培訓班期次長度不能超過20位!";
}
}
String pxrs = std.getValue(request,"pxrs").trim(); //培訓人數
if (ixy !=1)
{
if (pxrs.length() > 9)
{
imager = "培訓人數長度不能超過9位!";
ixy = 1;
}
}
String pxbm = std.getValue(request,"pxbm"); //培訓組織部門
String pxqr = std.getValue(request,"rq"); //培訓起時間
String pxzr = std.getValue(request,"rqr"); //培訓止時間
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;
}
}
if (ixy == 0)
{
String lrrq = std.getDateStr("YYYY.MM.DD"); //取數據庫時間
String qunianqi="select count(*) from jcy_pxb where pxbm='"+pxbm+"' and pxqc='"+pxqc+"' and year='"+year+"'";
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 pxxh ="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_pxb (pxxh) values ('"+suserid+"')";
int isi = std.getResultByUpdate(sql_insert);
if (isi == 1 )
{
String sql_update = "update jcy_pxb set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxrs='"+pxrs+"',pxqc='"+pxqc+"',year='"+year+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD') where pxxh = '"+suserid+"'";
int isu = std.getResultByUpdate(sql_update);
if (isu == 1)
{
imager = "保存成功!";
//return;
}else
{
ixy = 1;
imager = "新增失敗!";
}
}
}
else
{
imager = "已經存在此培訓班期次";
ixy = 1;
}
}
}
//修改培訓班
if (szt.equals("modify"))
{
String year = std.getValue(request,"year").trim(); //培訓年度
if (year.length() > 4)
{
imager = "年度長度不能超過4位!";
ixy = 1;
}
String pxqc = std.getValue(request,"pxqc").trim(); //培訓班期次
if (ixy != 1)
{
if (pxqc.length()> 20)
{
ixy = 1;
imager = "培訓班期次長度不能超過20位!";
}
}
String pxrs = std.getValue(request,"pxrs").trim(); //培訓人數
if (ixy !=1)
{
if (pxrs.length() > 9)
{
imager = "培訓人數長度不能超過9位!";
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 lrrq = std.getDateStr("YYYY.MM.DD"); //取數據庫時間
if(ixy == 0)
{
//判斷是否沒有修改
String xg = "select pxqc from jcy_pxb where pxxh = '"+pxxh_id+"'";
sun.jdbc.rowset.CachedRowSet v_xg = std.getResultBySelect(xg);
v_xg.next();
String pi_xg =v_xg.getString(1);
//判斷如果沒有修改過
if (!pi_xg.equals(pxqc))
{
String qunianqi="select count(*) from jcy_pxb where pxbm='"+pxbm+"' and pxqc='"+pxqc+"' and year='"+year+"'";
sun.jdbc.rowset.CachedRowSet v_qunianqi = std.getResultBySelect(qunianqi);
v_qunianqi.next();
String pi_qunianqi=v_qunianqi.getString(1);
if (pi_qunianqi.equals("0"))
{
String sql_modify_update = "update jcy_pxb set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxrs='"+pxrs+"',pxqc='"+pxqc+"',year='"+year+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD') where pxxh = '"+pxxh_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_pxb set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxrs='"+pxrs+"',pxqc='"+pxqc+"',year='"+year+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD') where pxxh = '"+pxxh_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_pxb where pxxh = '"+pxxh_id+"'";
int idel = std.getResultByUpdate(sql_del);
if (idel == 1)
{
//imager = "減少成功!";
imager = "刪除成功!";
// return;
}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 + -