예제 #1
0
        public List <AutoCompleteResult> AutoCompleteEmailUserGuid(string term)
        {
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return(ReturnAccessDenied());
            }

            // enforce security
            if (!WebUser.IsInRoles(siteSettings.RolesThatCanLookupUsers))
            {
                return(ReturnAccessDenied());
            }

            List <AutoCompleteResult> result = new List <AutoCompleteResult>();

            using (IDataReader reader = SiteUser.EmailLookup(siteSettings.SiteId, term, WebConfigSettings.UserAutoCompleteRowsToGet))
            {
                while (reader.Read())
                {
                    result.Add(new AutoCompleteResult(reader["Email"].ToString().Trim(), reader["UserGuid"].ToString()));
                }
            }

            return(result);
        }