Ejemplo n.º 1
0
  public String onUpdate() {
    try {
      Session session = getSession();
      Long id = role.getId();
      if (id != null && id > 0) {
        Roles temp = new Roles();
        temp = (Roles) session.get(Roles.class, id);
        temp.setValue(role.getValue());
        temp.setName(role.getName());
        if (isactive != null) {
          temp.setIsactive("Y");
        } else {
          temp.setIsactive("N");
        }

        session.update(temp);
        session.flush();
      }
      jsonDataGrid.setLabel("SUCCESS");
      jsonDataGrid.setCustomInfo("Update Thành Công!");
      onSearch();
    } catch (Exception ex) {
      jsonDataGrid.setLabel("ERROR");
      jsonDataGrid.setCustomInfo(ex.getMessage());
    }
    return "jsonDataGrid";
  }
Ejemplo n.º 2
0
 public String onActive() {
   try {
     Session session = getSession();
     if (getRequest().getParameter("id") != null && getRequest().getParameter("active") != null) {
       Roles temp = new Roles();
       temp = (Roles) session.get(Roles.class, Long.parseLong(getRequest().getParameter("id")));
       if ("Y".equals(getRequest().getParameter("active"))) {
         temp.setIsactive("N");
       } else {
         temp.setIsactive("Y");
       }
       session.update(temp);
       session.flush();
     }
     jsonDataGrid.setLabel("SUCCESS");
     jsonDataGrid.setCustomInfo("Cập Nhật Trạng Thái Thành Công!");
     //            onSearch();
   } catch (Exception ex) {
     jsonDataGrid.setLabel("ERROR");
     jsonDataGrid.setCustomInfo(ex.getMessage());
   }
   return "jsonDataGrid";
 }