/// <summary> /// 查找指定ID的员工 /// </summary> /// <param name="employeeId">员工ID</param> /// <param name="tran">中间事务对象</param> /// <returns>返回员工实体对象</returns> public Employee FindSingle(string employeeId, ICTransaction tran) { HibernateTransaction hTran = null; ISession session = null; if (tran != null) { hTran = (HibernateTransaction)tran; session = hTran.CurrentSession; } else { session = this.CurrentHibernateConfig.GetCurrentSession(); } return(HibernateHelper.FindObjectById <Employee>(session, employeeId)); }
/// <summary> /// 查找指定ID的部门 /// </summary> /// <param name="departmentId">部门ID</param> /// <param name="tran">中间事务对象</param> /// <returns>返回部门实体对象</returns> public Department FindSingle(string departmentId, ICTransaction tran) { HibernateTransaction hTran = null; ISession session = null; if (tran != null) { hTran = (HibernateTransaction)tran; session = hTran.CurrentSession; } else { session = this.CurrentHibernateConfig.GetCurrentSession(); } return(HibernateHelper.FindObjectById <Department>(session, departmentId)); }
/// <summary> /// 删除员工 /// </summary> /// <param name="employeeId">员工ID</param> /// <param name="tran">中间事务对象</param> public void Delete(string employeeId, ICTransaction tran) { HibernateTransaction hTran = null; ISession session = null; if (tran != null) { hTran = (HibernateTransaction)tran; session = hTran.CurrentSession; } else { session = this.CurrentHibernateConfig.GetCurrentSession(); } Employee employee = HibernateHelper.FindObjectById <Employee>(session, employeeId); HibernateHelper.DeleteObject <Employee>(session, employee); }
/// <summary> /// 删除部门 /// </summary> /// <param name="departmentId">部门ID</param> /// <param name="tran">中间事务对象</param> public void Delete(string departmentId, ICTransaction tran) { HibernateTransaction hTran = null; ISession session = null; if (tran != null) { hTran = (HibernateTransaction)tran; session = hTran.CurrentSession; } else { session = this.CurrentHibernateConfig.GetCurrentSession(); } Department department = HibernateHelper.FindObjectById <Department>(session, departmentId); HibernateHelper.DeleteObject <Department>(session, department); }
/// <summary> /// 删除职位 /// </summary> /// <param name="positionId">职位ID</param> /// <param name="tran">中间事务对象</param> public void Delete(string positionId, ICTransaction tran) { HibernateTransaction hTran = null; ISession session = null; if (tran != null) { hTran = (HibernateTransaction)tran; session = hTran.CurrentSession; } else { session = this.CurrentHibernateConfig.GetCurrentSession(); } Position position = HibernateHelper.FindObjectById <Position>(session, positionId); HibernateHelper.DeleteObject <Position>(session, position); }
/// <summary> /// 删除公司 /// </summary> /// <param name="companyId">公司ID</param> /// <param name="tran">中间事务对象</param> public void Delete(string companyId, ICTransaction tran) { HibernateTransaction hTran = null; ISession session = null; if (tran != null) { hTran = (HibernateTransaction)tran; session = hTran.CurrentSession; } else { session = this.CurrentHibernateConfig.GetCurrentSession(); } Company company = HibernateHelper.FindObjectById <Company>(session, companyId); HibernateHelper.DeleteObject <Company>(session, company); }