public DS_UserList GetAllUsers() { string SQL = @" select userId as id, firstName+' '+middleName+' '+lastName as name, homephone as phone, cellphone as cell, walkyphone as pager from userInfo "; DS_UserList ds = new DS_UserList(); m_dao.FillDataSet(ds, "UserTbl", SQL, null); return ds; }
/// <summary> /// Get UsersToMatch /// </summary> /// <param name="roleId"></param> /// <returns></returns> public DS_UserList GetUsersToMatch(string userToMatch) { string SQL_SELECT_USERS_TO_MATCH = @" select a.userId as id, a.firstName+' '+a.middleName+' '+a.lastName as name, a.homephone as phone, a.cellphone as cell, a.walkyphone as pager from userInfo a, userLogin b where a.userId=b.userId and ( a.firstName+' ' +a.middleName+' ' +a.lastName like @match or b.loginName like @match) "; DS_UserList ds = new DS_UserList(); SqlParameter[] para = { new SqlParameter("@match", userToMatch) }; m_dao.FillDataSet(ds, "UserTbl", SQL_SELECT_USERS_TO_MATCH, para); return ds; }
/// <summary> /// Get UsersInRole /// </summary> /// <param name="roleId"></param> /// <returns></returns> public DS_UserList GetUsersInRole(int roleId) { string SQL_SELECT_USERS_IN_ROLE = @" select userId as id, firstName+' '+middleName+' '+lastName as name, homephone as phone, cellphone as cell, walkyphone as pager from userInfo where userId in ( select userId from userRole where roleId=@roleId ) "; DS_UserList ds = new DS_UserList(); SqlParameter[] para = { new SqlParameter("@roleId", roleId) }; m_dao.FillDataSet(ds, "UserTbl", SQL_SELECT_USERS_IN_ROLE, para); return ds; }