/// <summary> /// Gets the company department by identifier. /// </summary> /// <param name="departmentId">The department identifier.</param> /// <param name="companyId">The company identifier.</param> /// <returns></returns> /// <exception cref="ApplicationException">Repository GetDepartmentByName</exception> public IDepartment GetCompanyDepartmentById(int departmentId, int companyId) { try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var aRecord = DepartmentQueries.getDepartmentById(dbContext, departmentId, companyId); return(aRecord); } } catch (Exception e) { throw new ApplicationException("Repository GetDepartmentByName", e); } }
/// <summary> /// Gets all department. /// </summary> /// <returns></returns> /// <exception cref="ApplicationException">Repository GetDepartmentAll Department</exception> public IList <IDepartment> GetAllDepartment() { try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var list = DepartmentQueries.getAllDepartments(dbContext).ToList(); return(list); } } catch (Exception e) { throw new ApplicationException("Repository GetAllDepartment", e); } }