Package com.ourlinc.activity.domain

Examples of com.ourlinc.activity.domain.User


  String checkemail_aj(HttpServletRequest request,
      HttpServletResponse response) {
    String email = WebUtils.toString(request.getParameter("email")).trim()
        .toLowerCase();
    if (email.length() > 0) {
      User user = userService.getUserByEmail(email);
      response.setContentType("text/plain;charset=UTF-8");
      response.setHeader("Cache-Control", "no-cache");
      String htmlDoc = (null != user) ? "邮箱已经存在!" : "用户名可以使用!";
      try {
        response.getWriter().write(htmlDoc);
View Full Code Here


   * @throws IOException
   */
  @RequestMapping(value = "/sendemail.jspx")
  String sendemail(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    String email = request.getParameter("email");
    String password = request.getParameter("password");
    String actId = request.getParameter("actId");
    String op = request.getParameter("op");
    String[] toAddresses = request.getParameterValues("toAddresses");
    String smtpHost = EmailConfig.getValue("smtpHost");
    String needAuth = EmailConfig.getValue("needAuth");
    Page rp = userService.listAllUser(1);
    Activity act = activityService.getActivity(Integer.valueOf(actId));
    // 返回页面
    if (WebUtils.isEmptyString(email) || null == act) {
      request.setAttribute("actMsg", (null == act) ? "找不到该活动!" : "操作成功!");
      request.setAttribute("email", user.getEmail());
      request.setAttribute("actId", actId);
      request.setAttribute("list", rp);
      request.setAttribute("op", op);
      request.setAttribute("smtpHost", smtpHost);
      request.setAttribute("needAuth", needAuth);
      return "activity/sendemail";
    }
    // 发送邮件
    boolean flag = false;
    Mail mail = new Mail(email, password);
    try {
      if ("add".equals(op)) {
        mail.send(
            email,
            toAddresses,
            null,
            "活动通知",
            EmailTemplates.buildAddContent(act.getTime(),
                act.getTitle(), act.getId()));
      } else if ("edit".equals(op)) {
        mail.send(
            email,
            toAddresses,
            null,
            "活动修改通知",
            EmailTemplates.buildEditContent(act.getTime(),
                act.getTitle(),
                EmailConfig.getValue("editContent"),
                act.getId()));
      } else if ("cancel".equals(op)) {
        mail.send(
            email,
            toAddresses,
            null,
            "活动取消通知",
            EmailTemplates.buildCancelContent(act.getTime(),
                act.getTitle()));
      }
      flag = true;
    } catch (Exception e) {
      e.printStackTrace();
    }
    // 发送邮件失败
    if (!flag) {
      request.setAttribute("actMsg", "发送邮件失败!");
      request.setAttribute("email", user.getEmail());
      request.setAttribute("actId", actId);
      request.setAttribute("list", rp);
      request.setAttribute("op", op);
      request.setAttribute("smtpHost", smtpHost);
      request.setAttribute("needAuth", needAuth);
View Full Code Here

   * @throws IOException
   */
  @RequestMapping(value = "/postcomment.jspx")
  String postcomment(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    User user = (User) request.getSession().getAttribute("userLogin");
    String actId = request.getParameter("actId");
    String content = request.getParameter("content");
    Activity act = activityService.getActivity(Integer.valueOf(actId));
    if (null == act || null == content) {
      request.setAttribute("errorMsg", "找不到id=" + actId + "的活动");
      return "error";
    }
    content = WebUtils.escapeHTML(content);
    userService.postComment(user.getId(), act.getId(), content);
    response.sendRedirect("../activity/activity.jspx?actId="
        + URLEncoder.encode(actId, "utf-8"));
    return null;
  }
View Full Code Here

      return "error";
    }
    if ("add".equals(op)) {// 增加用户
      List<User> users = new ArrayList<User>();// 解决重名问题的策略:全加了
      if ("email".equals(condition)) {
        User dUser = userService
            .getUserByEmail(inputText.toLowerCase());
        if (null != dUser) {
          users.add(dUser);
        }
      } else if ("username".equals(condition)) {
        users = userService.getUserByUsername(inputText);
      }
      // 找不到人
      if (0 == users.size()) {
        request.setAttribute("errorMsg", "找不到" + condition + "为 "
            + inputText + " 人员");
        return "error";
      }
      // 这个活动能不能参加
      if (!activityService.isJoinEnable(act.getId())) {
        request.setAttribute("errorMsg", condition + "为 " + inputText
            + " 人员不能参加这个活动");
        return "error";
      }
      // 帮用户参加活动
      for (User u : users) {
        userService.joinActivity(u.getId(), act.getId());
      }
    } else if ("delete".equals(op)) {// 删除用户
      User dUser = userService.getUserById(Integer.valueOf(id));
      if (null != dUser) {
        userService.cancelJoinActivity(dUser.getId(), act.getId());
      }
    }
    List<User> u = activityService.getActMembers(act.getId());
    Page rp = new Page();
    rp.setData(u);
View Full Code Here

TOP

Related Classes of com.ourlinc.activity.domain.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.