/// <summary> /// 更新员工数据 /// </summary> /// <param name="employeeList">员工实体对象</param> /// <param name="tran">中间事务对象</param> public void Update(IList <Employee> employeeList, ICTransaction tran) { HibernateTransaction hTran = null; ISession session = null; ITransaction ihTran = null; if (tran != null) { hTran = (HibernateTransaction)tran; session = hTran.CurrentSession; } else { session = this.CurrentHibernateConfig.GetCurrentSession(); ihTran = session.BeginTransaction(); } try { if (employeeList != null) { foreach (Employee employee in employeeList) { HibernateHelper.UpdateObject <Employee>(session, employee); } if (ihTran != null) { ihTran.Commit(); } } HibernateHelper.FlushSession(session); } catch (Exception ex) { if (ihTran != null) { ihTran.Rollback(); } throw new Exception(ex.Message, ex); } }