public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    PostcodeGroupForm groupForm = (PostcodeGroupForm) form;
    Connection conn = null;
    try {
      conn = DBManager.getConnection();
      // conn.setAutoCommit(false);
      PostcodeGroup groupData = new PostcodeGroup();
      groupData.setGroupName(groupForm.getGroupName());
      groupData.setDescription(groupForm.getDescription());
      int groupId = SequenceManager.getNextVal(conn, "jxc.seq_postcode_group");
      groupData.setId(groupId);
      PostCodeSetDAO.insertGroup(conn, groupData);

      /*PostcodeSet setData = new PostcodeSet();
      setData.setPostcodeGroup(groupData);
      for (int i = 0; i < groupForm.getPostcode().length; i ++) {
      	setData.setPostcode(groupForm.getPostcode()[i]);
      	setData.setPostFee(groupForm.getPostFee()[i]);
      	PostCodeSetDAO.insertSet(conn, setData);
      }*/
      // conn.commit();
    } catch (Exception e) {
      // conn.rollback();
      throw new ServletException("[**an error occured when you create postcode group**]");

    } finally {
      if (conn != null && !conn.isClosed()) conn.close();
    }
    return mapping.findForward("success");
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    Connection conn = null;
    MemberDAO memberDAO = new MemberDAO();

    // String member_id = request.getParameter("member_id");
    String member_id = "";
    try {
      conn = DBManager.getConnection();

      /** 如果是callcenter系统,从sessin中取出会员信息,如果没有提示登录服务对象 * */
      String iscallcenter = request.getParameter("iscallcenter");
      if (iscallcenter != null && iscallcenter.equals("1")) {
        CallCenterHander hander = new CallCenterHander(request.getSession());
        if (hander.isOnService()) {
          Member mb = hander.getServicedMember();
          member_id = String.valueOf(mb.getID());
        } else {
          ControlledError ctlErr = new ControlledError();
          ctlErr.setErrorTitle("操作错误");
          ctlErr.setErrorBody("没有服务对象,请接入服务");
          request.setAttribute(Constants.ERROR_KEY, ctlErr);
          return mapping.findForward("controlledError");
        }
      }

      String cardId = MemberDAO.getCard_ID(conn, Integer.parseInt(member_id));
      request.setAttribute("cardId", cardId);
      Collection memberGetMemberCol = memberDAO.MBR_GET_MBR_info(conn, member_id);
      request.setAttribute("memberGetMemberCol", memberGetMemberCol);
      return mapping.findForward("success");

    } catch (SQLException se) {

      throw new ServletException(se);

    } finally {

      try {

        conn.close();

      } catch (SQLException sqe) {

        throw new ServletException(sqe);
      }
    }
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HttpSession session = request.getSession();
    User user = new User();
    user = (User) session.getAttribute("user");
    Connection conn = null;
    CallableStatement cstmt = null;
    MemberaddMoney memberaddMoney = new MemberaddMoney();
    /*
     * 取到所有值复选框的值
     */

    String inputid[] = request.getParameterValues("inputid");

    try {
      conn = DBManager.getConnection();
      for (int i = 0; i < inputid.length; i++) {
        memberaddMoney.setID(Integer.parseInt(inputid[i]));
        memberaddMoney.setMB_ID(0);
        memberaddMoney.setORDER_ID(0);
        memberaddMoney.setStatus(2);
        memberaddMoney.setOPERATOR_ID(Integer.parseInt(user.getId()));
        MemberaddMoneyDAO.update(conn, memberaddMoney);
      }

      return mapping.findForward("success");

    } catch (SQLException se) {

      throw new ServletException(se);

    } finally {

      try {

        conn.close();

      } catch (SQLException sqe) {

        throw new ServletException(sqe);
      }
    }
  }
  /**
   * 查询录入的书香卡
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  public ActionForward query(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    MemberaddMoneyForm myForm = (MemberaddMoneyForm) form;
    Connection conn = null;
    try {
      conn = DBManager.getConnection();
      MemberaddMoneyDAO moneyDao = new MemberaddMoneyDAO();
      Collection list = moneyDao.findSxkRecordsByCondition(conn, myForm);
      request.setAttribute("list", list);
      request.setAttribute("memberaddMoneyForm", myForm);
    } catch (Exception e) {
      throw new ServletException();
    } finally {
      if (conn != null) {
        conn.close();
      }
    }
    return mapping.findForward("query");
  }
Ejemplo n.º 5
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    RoleForm rf = (RoleForm) form;

    Role role = new Role();

    PropertyUtils.copyProperties(role, rf);

    Connection conn = null;

    System.out.println("role delete 000000");

    try {

      // DataSource dts = getDataSource(request);

      conn = DBManager.getConnection();

      // check if the role is in use

      conn.setAutoCommit(false);

      UserRoleDAO userRoleDao = new UserRoleDAO();

      Collection userRoleCol = userRoleDao.find(conn, role);

      System.out.println("role delete 111111111");

      if (userRoleCol != null && userRoleCol.size() > 0) {

        System.out.println("role delete 222222222");

        ControlledError ctlErr = new ControlledError();

        ctlErr.setErrorTitle("删除角色错误");

        ctlErr.setErrorBody("角色正在使用中,不能删除");

        request.setAttribute(com.magic.crm.util.Constants.ERROR_KEY, ctlErr);

        return mapping.findForward("controlledError");
      }

      RoleDAO dao = new RoleDAO();

      RoleRightDAO roleRightDao = new RoleRightDAO();

      roleRightDao.delete(conn, role);

      System.out.println("role delete 3333333");

      dao.delete(conn, role);

      System.out.println("role delete 4444444");

      conn.commit();

      return mapping.findForward("success");

    } catch (SQLException se) {

      throw new ServletException(se);

    } finally {

      try {

        conn.close();

      } catch (SQLException sqe) {

        throw new ServletException(sqe);
      }
    }
  }