📄 trnmngaction.java
字号:
{
if(aplcoms != null)
{
aplcoms.close();
}
}
}
/****************************************************
*新增课程培训档案
****************************************************/
private ActionForward newLessonArchive (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//得到输入参数
String operatorflag = ((TrnmngForm)form).getOperatorflag();
String staffno =((TrnmngForm)form).getStaffno();
String lessonid = ((TrnmngForm)form).getLessonid();
String lessondate = ((TrnmngForm)form).getLessondate();
String duration = ((TrnmngForm)form).getDuration();
String groupIds = ((TrnmngForm) form).GetGroupIds();
String staffIds = ((TrnmngForm) form).GetStaffIds();
if (lessondate != null)
{
lessondate = lessondate.replaceAll("-","");
}
if (groupIds != null)
{
groupIds = groupIds.replaceAll(",","#");
}
if (staffIds != null)
{
staffIds = staffIds.replaceAll(",","#");
}
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
if (groupIds != null && !(groupIds.equals("")))
{
aplcoms.preparedSP();
aplcoms.setString(1,groupIds);
SysDataSet ds1 = aplcoms.csCommonSP("P_agt_GroupToStaff");
SysRecord rc1 = ds1.getParamSet() ;
if (rc1!=null && rc1.getInt(0) == 0 && !(rc1.getString(1).equals("")))
{
if ( staffIds == null || staffIds.equals(""))
{
staffIds = rc1.getString(1);
}
else
{
staffIds = staffIds + "#" + rc1.getString(1);
}
}
else return(mapping.findForward("error"));
}
aplcoms.preparedSP();
//获得参数
aplcoms.setString(1 ,staffIds);
aplcoms.setString(2 ,lessonid);
aplcoms.setString(3 ,lessondate);
aplcoms.setString(4 ,duration);
//调用P_Agt_AddLessonArchive新增记录
SysDataSet ds1 = aplcoms.csCommonSP("P_Agt_AddLessonArchive");
SysRecord rc1 = ds1.getParamSet();
if (rc1!=null && rc1.getInt(0) == 0)
{
/*
if (operatorflag.equalsIgnoreCase("TRN_TRNADD_NEXTMOD"))
{
((TrnmngForm) form).setOperatorflag("TRNMNG_QUERYATRN");
((TrnmngForm) form).setId(rc1.getString(1));
return (queryATrn(mapping, form, req, res));
}
else
if (operatorflag.equalsIgnoreCase("TRN_TRNADD_NEXTNEW"))
{
req.setAttribute("staffno",staffno);
return (mapping.findForward("trnadd"));
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
*/
req.setAttribute("successId",SuccessCode.TRNMNG_ADD);
req.setAttribute("backURL","agt/trnmng/newtrnarchive_lesson.jsp?firID=M01&secNo=3&thrNo=7&secCount=10&thrCount=4");
return (mapping.findForward("success"));
}else if (rc1!=null && rc1.getInt(0) == 2)
{
req.setAttribute("errorId",ErrorCode.TRNMNG_ADDKEY);
req.setAttribute("errorMes","您所选择的工号为" + rc1.getString(1)
+ "的业务代表已存在此课程的档案,不能再新增,其他业务代表的课程档案已经新增成功");
return (mapping.findForward("error"));
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_ADD);
return (mapping.findForward("error"));
}
}catch (SysDbException aple)
{
//捕获CommonService系统异常,定向到出错页面,错误码为ErrorCode.COMMONSERVICE_ERROR
aple.printStackTrace();
req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
return (mapping.findForward("error"));
}
catch(java.sql.SQLException sqle)
{
//捕获调用aplcoms异常,定向到出错页面,错误码为ErrorCode.DATABASE_ERROR
sqle.printStackTrace();
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{
//捕获未知异常,定向到出错页面,错误码为ErrorCode.UNKNOW_ERROR
e.printStackTrace();
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
//关闭连接实例
{
if(aplcoms != null)
{
aplcoms.close();
}
}
}
/****************************************************
*新增考试培训档案
****************************************************/
private ActionForward newTestArchive (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//得到输入参数
String operatorflag = ((TrnmngForm)form).getOperatorflag();
String staffno =((TrnmngForm)form).getStaffno();
String testid = ((TrnmngForm)form).getTestid();
String testtype = ((TrnmngForm)form).getTesttype() ;
String testtime = ((TrnmngForm)form).getTesttime();
String testscore = ((TrnmngForm)form).getTestscore();
String totalscore = ((TrnmngForm)form).getTotalscore();
String ispass = ((TrnmngForm)form).getIspass();
if (testtime != null)
{
testtime = testtime.replaceAll("-","");
}
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得参数
aplcoms.setString(1 ,staffno);
aplcoms.setString(2 ,testid);
aplcoms.setString(3 ,testtype);
aplcoms.setString(4 ,testtime);
aplcoms.setString(5 ,testscore);
aplcoms.setString(6 ,ispass);
aplcoms.setString(7 ,totalscore);
//调用P_Agt_AddTestArchive新增记录
SysDataSet ds1 = aplcoms.csCommonSP("P_Agt_AddTestArchive");
SysRecord rc1 = ds1.getParamSet();
if (rc1!=null && rc1.getInt(0) == 0)
{
/*
if (operatorflag.equalsIgnoreCase("TRN_TRNADD_NEXTMOD"))
{
((TrnmngForm) form).setOperatorflag("TRNMNG_QUERYATRN");
((TrnmngForm) form).setId(rc1.getString(1));
return (queryATrn(mapping, form, req, res));
}
else
if (operatorflag.equalsIgnoreCase("TRN_TRNADD_NEXTNEW"))
{
req.setAttribute("staffno",staffno);
return (mapping.findForward("trnadd"));
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
*/
req.setAttribute("successId",SuccessCode.TRNMNG_ADD);
req.setAttribute("backURL","agt/trnmng/newtrnarchive_test.jsp?firID=M01&secNo=3&thrNo=8&secCount=10&thrCount=4");
return (mapping.findForward("success"));
}else if (rc1!=null && rc1.getInt(0) == 2)
{
req.setAttribute("errorId",ErrorCode.TRNMNG_ADDKEY);
return (mapping.findForward("error"));
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_ADD);
return (mapping.findForward("error"));
}
}catch (SysDbException aple)
{
//捕获CommonService系统异常,定向到出错页面,错误码为ErrorCode.COMMONSERVICE_ERROR
aple.printStackTrace();
req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
return (mapping.findForward("error"));
}
catch(java.sql.SQLException sqle)
{
//捕获调用aplcoms异常,定向到出错页面,错误码为ErrorCode.DATABASE_ERROR
sqle.printStackTrace();
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{
//捕获未知异常,定向到出错页面,错误码为ErrorCode.UNKNOW_ERROR
e.printStackTrace();
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
//关闭连接实例
{
if(aplcoms != null)
{
aplcoms.close();
}
}
}
/****************************************************
*修改课程培训档案
****************************************************/
private ActionForward modLessonArchive (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//得到输入参数
String operatorflag = ((TrnmngForm)form).getOperatorflag();
String staffno =((TrnmngForm)form).getStaffno();
String lessonid = ((TrnmngForm)form).getLessonid();
String lessondate = ((TrnmngForm)form).getLessondate();
String duration = ((TrnmngForm)form).getDuration();
if (lessondate != null)
{
lessondate = lessondate.replaceAll("-","");
}
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得参数
aplcoms.setString(1 ,staffno);
aplcoms.setString(2 ,lessonid);
aplcoms.setString(3 ,lessondate);
aplcoms.setString(4 ,duration);
//调用P_Agt_UpdateTrainArchive新增记录
SysDataSet ds1 = aplcoms.csCommonSP("P_Agt_UpdateLessonArchive");
SysRecord rc1 = ds1.getParamSet();
if (rc1!=null && rc1.getInt(0) == 0)
{
/*
if (operatorflag.equalsIgnoreCase("TRN_TRNMOD_NEXTMOD"))
{
((TrnmngForm) form).setOperatorflag("TRNMNG_QUERYATRN");
((TrnmngForm) form).setId(id);
return (queryATrn(mapping, form, req, res));
}
if (operatorflag.equalsIgnoreCase("TRN_TRNMOD_NEXTNEW"))
{
req.setAttribute("staffno",staffno);
return (mapping.findForward("trnadd"));
}
else
if (operatorflag.equalsIgnoreCase("TRN_TRNMOD_NEXTLIST"))
{
((TrnmngForm)form).setOperatorflag("TRNMNG_QUERYDETAIL");
return queryTrnArchive(mapping,form,req,res);
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
*/
req.setAttribute("successId",SuccessCode.TRNMNG_MOD);
return (mapping.findForward("success"));
}else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_MOD);
return (mapping.findForward("error"));
}
}catch (SysDbException aple)
{
//捕获CommonService系统异常,定向到出错页面,错误码为ErrorCode.COMMONSERVICE_ERROR
aple.printStackTrace();
req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
return (mapping.findForward("error"));
}
catch(java.sql.SQLException sqle)
{
//捕获调用aplcoms异常,定向到出错页面,错误码为ErrorCode.DATABASE_ERROR
sqle.printStackTrace();
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{
//捕获未知异常,定向到出错页面,错误码为ErrorCode.UNKNOW_ERROR
e.printStackTrace();
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
//关闭连接实例
{
if(aplcoms != null)
{
aplcoms.close();
}
}
}
/****************************************************
*修改考试培训档案
****************************************************/
private ActionForward modTestArchive (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//得到输入参数
String operatorflag = ((TrnmngForm)form).getOperatorflag();
String staffno =((TrnmngForm)form).getStaffno();
String testid = ((TrnmngForm)form).getTestid();
String testtype = ((TrnmngForm)form).getTesttype() ;
String testtime = ((TrnmngForm)form).getTesttime();
String testscore = ((TrnmngForm)form).getTestscore();
String totalscore = ((TrnmngForm)form).getTotalscore();
String ispass = ((TrnmngForm)form).getIspass();
if (testtime != null)
{
testtime = testtime.replaceAll("-","");
}
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得参数
aplcoms.setString(1 ,staffno);
aplcoms.setString(2 ,testid);
aplcoms.setString(3 ,testtype);
aplcoms.setString(4 ,testtime);
aplcoms.setString(5 ,testscore);
aplcoms.setString(6,ispass);
aplcoms.setString(7,totalscore);
//调用P_Agt_UpdateTrainArchive新增记录
SysDataSet ds1 = aplcoms.csCommonSP("P_Agt_UpdateTestArchive");
SysRecord rc1 = ds1.getParamSet();
if (rc1!=null && rc1.getInt(0) == 0)
{
/*
if (operatorflag.equalsIgnoreCase("TRN_TRNMOD_NEXTMOD"))
{
((TrnmngForm) form).setOperatorflag("TRNMNG_QUERYATRN");
((TrnmngForm) form).setId(id);
return (queryATrn(mapping, form, req, res));
}
if (operatorflag.equalsIgnoreCase("TRN_TRNMOD_NEXTNEW"))
{
req.setAttribute("staffno",staffno);
return (mapping.findForward("trnadd"));
}
else
if (operatorflag.equalsIgnoreCase("TRN_TRNMOD_NEXTLIST"))
{
((TrnmngForm)form).setOperatorflag("TRNMNG_QUERYDETAIL");
return queryTrnArchive(mapping,form,req,res);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -