public List <CompanyEmployeeDomain> GetAllEmployeesByCompanyId(EmployeeProfileRequest model, ref int TotalCount) { List <CompanyEmployeeDomain> companyEmployeeList = null; int totalCount = 0; try { DataProvider.ExecuteCmd(GetConnection, "dbo.UserProfile_GetByCompanyId" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@companyId", model.companyId); // server side pagination paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); }, map : delegate(IDataReader reader, short set) { var singleUser = new CompanyEmployeeDomain(); int startingIndex = 0; //startingOrdinal totalCount = reader.GetSafeInt32(startingIndex++); singleUser.UserId = reader.GetSafeString(startingIndex++); singleUser.Email = reader.GetSafeString(startingIndex++); singleUser.FirstName = reader.GetSafeString(startingIndex++); singleUser.LastName = reader.GetSafeString(startingIndex++); singleUser.url = reader.GetSafeString(startingIndex++); singleUser.userRole = reader.GetSafeString(startingIndex++); singleUser.Name = reader.GetSafeString(startingIndex++); singleUser.PhoneNumber = reader.GetSafeString(startingIndex++); if (companyEmployeeList == null) { companyEmployeeList = new List <CompanyEmployeeDomain>(); } companyEmployeeList.Add(singleUser); }); } catch (Exception ex) { throw ex; } return(companyEmployeeList); }
public List <CompanyEmployeeDomain> GetAllEmployees(int CompanyId) { List <CompanyEmployeeDomain> companyEmployeeList = null; try { DataProvider.ExecuteCmd(GetConnection, "dbo.UserProfile_GetAllByCompanyId" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@companyId", CompanyId); }, map : delegate(IDataReader reader, short set) { var singleUser = new CompanyEmployeeDomain(); int startingIndex = 0; //startingOrdinal singleUser.UserId = reader.GetSafeString(startingIndex++); singleUser.Email = reader.GetSafeString(startingIndex++); singleUser.FirstName = reader.GetSafeString(startingIndex++); singleUser.LastName = reader.GetSafeString(startingIndex++); singleUser.url = reader.GetSafeString(startingIndex++); singleUser.userRole = reader.GetSafeString(startingIndex++); singleUser.Name = reader.GetSafeString(startingIndex++); singleUser.PhoneNumber = reader.GetSafeString(startingIndex++); if (companyEmployeeList == null) { companyEmployeeList = new List <CompanyEmployeeDomain>(); } companyEmployeeList.Add(singleUser); }); } catch (Exception ex) { throw ex; } return(companyEmployeeList); }