Esempio n. 1
0
 /**
  * 专家新写的一个公告
  *
  * @param gonggao
  * @return 公告id
  */
 public int NewGongGao(ExpertNotice gonggao) {
   Session session = HibernateSessionFactory.getSession();
   Transaction tran = session.beginTransaction();
   session.save(gonggao);
   tran.commit();
   session.close();
   return gonggao.getId();
 }
Esempio n. 2
0
 /**
  * 通过会员ID查询家属记录
  *
  * @param membId
  * @return 家属列表
  */
 public List<MembFami> findDetailByMembId(String membId) {
   Session session = HibernateSessionFactory.getSession();
   Criteria criteria = session.createCriteria(MembFami.class);
   criteria.add(Restrictions.eq("membRegi.membId", membId));
   List<MembFami> familyList = criteria.list();
   session.close();
   return familyList;
 }
Esempio n. 3
0
  /**
   * 方法<code>setState</code> 设置登录状态
   *
   * @param id
   * @param state
   * @return boolean
   */
  public boolean setState(String id, Boolean state) {
    /** 通过专家id查询专家对象* */
    ExpeRegi expe = getExpeinfoById(id);
    if (expe == null) return false;

    /** 如果专家对象非空则设置专家状态* */
    Session session = HibernateSessionFactory.getSession();
    org.hibernate.Transaction tx = session.beginTransaction();
    expe.setState(state);
    session.update(expe);
    tx.commit(); // 提交事务。
    session.close();
    return true;
  }
Esempio n. 4
0
 /**
  * 对专家修改信息更新保存
  *
  * @param expe
  * @return 更新成功则返回true
  */
 public boolean UpdateExpeRegi(ExpeRegi expe) {
   Session session = HibernateSessionFactory.getSession();
   try {
     Transaction tran = session.beginTransaction();
     session.update(expe);
     tran.commit();
     session.close();
     return true;
   } catch (Exception e) {
     e.printStackTrace();
     session.close();
     return false;
   }
 }
Esempio n. 5
0
 /**
  * 删除家属记录
  *
  * @param family
  * @return 删除成功则返回true
  */
 public boolean deleteFamily(MembFami family) {
   Session session = HibernateSessionFactory.getSession();
   try {
     Transaction tran = session.beginTransaction();
     session.delete(family);
     tran.commit();
     session.close();
     return true;
   } catch (Exception e) {
     e.printStackTrace();
     session.close();
     return false;
   }
 }
Esempio n. 6
0
 /**
  * 会员新增一位家属信息
  *
  * @param family
  * @return 成功返回ID,失败返回0
  */
 public int NewFamily(MembFami family) {
   Session session = HibernateSessionFactory.getSession();
   Transaction tran = session.beginTransaction();
   int flag = 0;
   try {
     session.save(family);
     tran.commit();
     session.close();
     flag = family.getFamiId();
   } catch (Exception e) {
     e.printStackTrace();
     session.close();
     flag = 0;
   }
   return flag;
 }
Esempio n. 7
0
  public boolean regiExpe(
      String username,
      String realname,
      String password,
      Boolean sex,
      String id_card_numb,
      String email,
      String phone,
      String telephone,
      String referrer) {

    ExpeRegi obj = getExpeinfoById(username);
    if (obj != null) return false; // 判断数据库中是否已经存在,若存在则返回false
    Session session = HibernateSessionFactory.getSession();
    org.hibernate.Transaction tx = session.beginTransaction();
    obj =
        new ExpeRegi(
            username, realname, password, sex, id_card_numb, email, phone, telephone, referrer);
    session.save(obj); // 保存对象到数据库
    tx.commit(); // 提交事务。
    session.close();
    return true;
  }
Esempio n. 8
0
 /**
  * 方法<code>getExpeinfoById</code> 通过专家的expe_id来获取对应的对象
  *
  * @param expeId
  * @return ExpeRegi
  */
 public ExpeRegi getExpeinfoById(String expeId) {
   Session session = HibernateSessionFactory.getSession();
   ExpeRegi obj = (ExpeRegi) session.get(ExpeRegi.class, expeId);
   session.close();
   return obj;
 }
Esempio n. 9
0
 /**
  * 通过家属记录ID,查询家属记录详情
  *
  * @param id
  * @return 家属对象
  */
 public MembFami findDetailById(int id) {
   Session session = HibernateSessionFactory.getSession();
   MembFami family = (MembFami) session.get(MembFami.class, id);
   session.close();
   return family;
 }