Example #1
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";
 }
Example #2
0
 public String addChatDetail() {
   ChatDetail chtdl = new ChatDetail();
   ChatDetailDAO dao = new ChatDetailDAO();
   ChatDAO dao1 = new ChatDAO();
   Map session = ActionContext.getContext().getSession();
   ElUser user = (ElUser) session.get("sysUser");
   this.setPage(1);
   if (chatdetail.getElchdContent() == null || chatdetail.getElchdContent().equals("")) {
     ActionContext.getContext().put("error", "留言不能为空");
     return turnChatDetailTch();
   }
   if (chatdetail.getElchdContent().length() >= 499) {
     ActionContext.getContext().put("error", "留言过长");
     return turnChatDetailTch();
   }
   chat = dao1.loadChat(chat.getElchId());
   chtdl.setElchdId(UUID.randomUUID().toString().replaceAll("-", ""));
   chtdl.setElchdDate(new Date());
   chtdl.setElchId(chat.getElchId());
   chtdl.setElchdName(user.getEluserName());
   chtdl.setElchdContent(chatdetail.getElchdContent());
   chtdl.setElchdReverse1(dao.CountAllChatDetail(chat) + 1);
   try {
     dao.getSession().clear();
     dao.beginThransaction();
     dao.createChatDetail(chtdl);
     dao.commitThransaction();
   } catch (Exception e) {
     // TODO: handle exception
     dao.rollbackThransaction();
   }
   if (user.getEluserIdentity() == 2) {
     return turnChatDetailTch();
   } else {
     return turnChatDetailStu();
   }
 }
Example #3
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";
 }