⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libmanagerbean.java

📁 招标投标网上系统
💻 JAVA
字号:
/*
 * @(#)BusinessBean.java 
 *
 * Copyright 2003 by SYNTC, All rights reserved.
 *
 * This software is the confidential and proprietary information of SYNTC.
 * ("Confidential Information").
 */
package cn.com.syntc.webapp.business;

import javax.servlet.*;
import javax.servlet.http.*;

import cn.com.syntc.common.action.*;
import cn.com.syntc.common.io.*;
import cn.com.syntc.common.util.*;
import cn.com.syntc.common.type.*;
import cn.com.syntc.webapp.taglib.CheckLogin;

import cn.com.syntc.webapp.session.UserSession;

/**
 * 题库管理<br>
 * @author wang yong
 * @version 1.0
 */
public class LibManagerBean extends BusinessLogic{
  /**
   * 构造函数
   */
  public LibManagerBean(){
    System.out.println("FrameWork:业务处理类实例化完成【" + this.getClass().getName() + "】");
  }

  /**
   * 业务逻辑处理机能
   */
  public void execute(HttpServletRequest request, HttpServletResponse response, Parameters parameters) throws CommonException{
    try{
      String strSql = "";
      ResultSet resultset = null;
      SqlUtil sqlutil = new SqlUtil();

      UserSession USession = (UserSession)request.getSession().getAttribute("UserSession");
      
      String command = "";
      if(parameters.getParameters("request", "command")!=null)
      {
        command = (String)parameters.getParameters("request", "command");
      }
   
      if(command.equals("add"))
      {
        // 添加题库
        String libname = (String)parameters.getParameters("request", "libname");
        if(!libname.trim().equals(""))
        {
          strSql = "INSERT INTO LIB_TBL(LIBNAME,CREATEUSERID,CREATETIME,ONOFF) VALUES('" + StringUtil.escape(libname) + "', '" + USession.getUserID() + "', SYSDATE(), '0')";
          sqlutil.executeUpdate(strSql);
        }
      }
      else if(command.equals("del"))
      {
        String libid[] = null;
        if(request.getParameterValues("libid")!=null)
        {
          libid = (String[])request.getParameterValues("libid");
          for(int i=0; i<libid.length; i++)
          {
            // 删除题库
            strSql = "DELETE FROM LIB_TBL WHERE LIBID = '" + libid[i] + "'";
            sqlutil.executeUpdate(strSql);

            // 删除该题库下的所有考题
            strSql = "DELETE FROM LIBRARY_TBL WHERE LIBID = '" + libid[i] + "'";
            sqlutil.executeUpdate(strSql);
          }
        }
      }
      else if(command.equals("onoff"))
      {
        String libid = "";
        if(request.getParameter("libid")!=null)
        {
          libid = (String)request.getParameter("libid");

        }

        String onoff = "0";
        if(request.getParameter("onoffvalue")!=null)
        {
          onoff = (String)request.getParameter("onoffvalue");
        }

          // 改变题库可用状态
          strSql = "UPDATE LIB_TBL SET ONOFF='" + onoff + "' WHERE LIBID = '" + libid + "'";
          sqlutil.executeUpdate(strSql);
      }
      else
      {
      }

      strSql = "SELECT A.LIBID,A.LIBNAME,B.USERNAME AS CREATEUSERNAME,A.CREATETIME,A.ONOFF FROM LIB_TBL A,USER_TBL B WHERE A.CREATEUSERID=B.USERID ORDER BY A.CREATETIME";
      resultset = sqlutil.executeQuery(strSql);

      sqlutil.close();

      parameters.setParameters("results","LibList", resultset);

      parameters.setParameters("results", "ForwardPage", "/framework/exam/liblist.jsp");

    }
    catch(Exception ex){
      System.out.println("error:"+ex.getMessage());;
    }
  }


  /**
   * 页面表单检测处理机能
   */
  public void validate(HttpServletRequest request, HttpServletResponse response, Parameters parameters) throws CommonException{


  }

}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -