private IList<UserRowData> InternalSelect(int startRowIndex, int maximumRows, out int resultCount) { if (maximumRows == 0) { resultCount = 0; return new List<UserRowData>(); } List<UserRowData> users; using (var service = new UserManagement()) { var filter = new ListUsersRequest { UserName = UserName.Replace("*", "%").Replace("?", "_"), DisplayName = DisplayName.Replace("*", "%").Replace("?", "_"), Page = {FirstRow = startRowIndex}, ExactMatchOnly = false }; users = CollectionUtils.Map( service.FindUsers(filter), (UserSummary summary) => new UserRowData(summary, service.GetUserDetail(summary.UserName))); } resultCount = users.Count; return users; }
public List<UserRowData> GetAllUsers() { List<UserRowData> data; using(UserManagement service = new UserManagement()) { data = CollectionUtils.Map( service.FindUsers(new ListUsersRequest()), delegate(UserSummary summary) { UserRowData user = new UserRowData(summary, null); return user; }); } return data; }
public bool ExistsUsername(string username) { bool exists = false; using(UserManagement service = new UserManagement()) { ListUsersRequest filter = new ListUsersRequest(); filter.ExactMatchOnly = true; filter.UserName = username; IList<UserSummary> users = service.FindUsers(filter); if (users != null && users.Count > 0) { exists = true; } } return exists; }