예제 #1
0
  public String addChat() {
    System.out.println("addchat");
    Chat cht = new Chat();
    ChatDAO dao = new ChatDAO();
    if (chat.getElchName() == null || chat.getElchName().equals("")) {
      System.out.println("1");
      ActionContext.getContext().put("error", "讨论名称不能为空");
      return turnAddChat();
    }
    cht.setElchId(UUID.randomUUID().toString().replaceAll("-", ""));
    cht.setElchName(chat.getElchName());
    cht.setElchReverse1(chat.getElchReverse1());
    cht.setElchReverse2("0");
    cht.setElchTime(new Date());
    cht.setElcourseId(coursedata.getElcourseId());
    try {
      dao.getSession().clear();
      dao.beginThransaction();
      dao.createChat(cht);
      dao.commitThransaction();

    } catch (Exception e) {
      // TODO: handle exception
      dao.rollbackThransaction();
    }
    return turnChatGrid();
  }
예제 #2
0
 public String turnUpdateChat() {
   System.out.println("turnupdatechat");
   CourseDAO dao = new CourseDAO();
   coursedata = dao.loadCourse(coursedata.getElcourseId());
   ChatDAO dao1 = new ChatDAO();
   chat = dao1.loadChat(chat.getElchId());
   return "turnupdatechat";
 }
예제 #3
0
 public String turnChatList() {
   System.out.println("turnchatlist");
   CourseDAO dao = new CourseDAO();
   ChatDAO dao1 = new ChatDAO();
   coursedata = dao.loadCourse(coursedata.getElcourseId());
   ActionContext.getContext().put("chatlist", dao1.loadcoursechat(coursedata));
   return "turnchatlist";
 }
예제 #4
0
 public String turnChatDetailTch() {
   System.out.println("turnchatdetailtch");
   ChatDetailDAO dao = new ChatDetailDAO();
   ChatDAO dao2 = new ChatDAO();
   CourseDAO dao3 = new CourseDAO();
   coursedata = dao3.loadCourse(coursedata.getElcourseId());
   chat = dao2.loadChat(chat.getElchId());
   maxpage = maxpage;
   page = page;
   if (maxpage == 0) {
     System.out.println("maxpage null");
     maxpage = dao.CountChatDetail(chat, pagesize);
     System.out.println(maxpage);
   }
   ActionContext.getContext().put("chatdetaillist", dao.loadPageChatDetail(chat, pagesize, page));
   return "turnchatdetailtch";
 }
예제 #5
0
 public String turnAddChat() {
   System.out.println("turnaddchat");
   CourseDAO dao = new CourseDAO();
   coursedata = dao.loadCourse(coursedata.getElcourseId());
   return "turnaddchat";
 }