Example #1
0
        private void AddBasicInformation(Dictionary<string, SearchDocument> searchDocuments, List<int> indexedUsers, UserSearch userSearch, int portalId)
        {
            if (!searchDocuments.ContainsKey(
                            string.Format("{0}_{1}", userSearch.UserId, UserVisibilityMode.AllUsers)
                                .ToLowerInvariant()))
            {
                if (!indexedUsers.Contains(userSearch.UserId))
                {
                    indexedUsers.Add(userSearch.UserId);
                }
                //if the user doesn't exist in search collection, we need add it with ALLUsers mode,
                //so that can make sure DisplayName will be indexed
                var searchDoc = new SearchDocument
                {
                    SearchTypeId = UserSearchTypeId,
                    UniqueKey =
                        string.Format("{0}_{1}", userSearch.UserId,
                            UserVisibilityMode.AllUsers).ToLowerInvariant(),
                    PortalId = portalId,
                    ModifiedTimeUtc = userSearch.LastModifiedOnDate,
                    Body = string.Empty,
                    Description = userSearch.FirstName,
                    Title = userSearch.DisplayName
                };
                //searchDoc.NumericKeys.Add("superuser", Convert.ToInt32(userSearch.SuperUser));
                searchDocuments.Add(searchDoc.UniqueKey, searchDoc);
            }

            if (!searchDocuments.ContainsKey(
                            string.Format("{0}_{1}", userSearch.UserId, UserVisibilityMode.AdminOnly)
                                .ToLowerInvariant()))
            {
                if (!indexedUsers.Contains(userSearch.UserId))
                {
                    indexedUsers.Add(userSearch.UserId);
                }
                //if the user doesn't exist in search collection, we need add it with ALLUsers mode,
                //so that can make sure DisplayName will be indexed
                var searchDoc = new SearchDocument
                {
                    SearchTypeId = UserSearchTypeId,
                    UniqueKey =
                        string.Format("{0}_{1}", userSearch.UserId,
                            UserVisibilityMode.AdminOnly).ToLowerInvariant(),
                    PortalId = portalId,
                    ModifiedTimeUtc = userSearch.LastModifiedOnDate,
                    Body = string.Empty,
                    Description = userSearch.FirstName,
                    Title = userSearch.DisplayName
                };

                searchDoc.NumericKeys.Add("superuser", Convert.ToInt32(userSearch.SuperUser));
                searchDoc.Keywords.Add("username", userSearch.UserName);
                searchDoc.Keywords.Add("email", userSearch.Email);
                searchDoc.Keywords.Add("createdondate", userSearch.CreatedOnDate.ToString(Constants.DateTimeFormat));
                searchDocuments.Add(searchDoc.UniqueKey, searchDoc);
            }
        }
Example #2
0
        private UserSearch GetUserSearch(IDataReader reader)
        {
            var userSearch = new UserSearch
            {
                UserId = Convert.ToInt32(reader["UserId"]),
                DisplayName = reader["DisplayName"].ToString(),
                
                Email = reader["Email"].ToString(),
                UserName = reader["Username"].ToString(),
                SuperUser = Convert.ToBoolean(reader["IsSuperUser"]),
                LastModifiedOnDate = Convert.ToDateTime(reader["LastModifiedOnDate"]).ToUniversalTime(),
                CreatedOnDate = Convert.ToDateTime(reader["CreatedOnDate"]).ToUniversalTime()
            };
            if (!string.IsNullOrEmpty(userSearch.FirstName) && userSearch.FirstName.Contains(ValueSplitFlag))
            {
                userSearch.FirstName = Regex.Split(userSearch.FirstName, Regex.Escape(ValueSplitFlag))[0];
            }

            return userSearch;
        }
Example #3
0
        private static void AddBasicInformation(IDictionary <string, SearchDocument> searchDocuments, ICollection <int> indexedUsers, UserSearch userSearch, int portalId)
        {
            if (!searchDocuments.ContainsKey(
                    string.Format("{0}_{1}", userSearch.UserId, UserVisibilityMode.AllUsers)
                    .ToLowerInvariant()))
            {
                if (!indexedUsers.Contains(userSearch.UserId))
                {
                    indexedUsers.Add(userSearch.UserId);
                }
                //if the user doesn't exist in search collection, we need add it with ALLUsers mode,
                //so that can make sure DisplayName will be indexed
                var searchDoc = new SearchDocument
                {
                    SearchTypeId = UserSearchTypeId,
                    UniqueKey    =
                        string.Format("{0}_{1}", userSearch.UserId,
                                      UserVisibilityMode.AllUsers).ToLowerInvariant(),
                    PortalId        = portalId,
                    ModifiedTimeUtc = userSearch.LastModifiedOnDate,
                    Body            = string.Empty,
                    Description     = userSearch.FirstName,
                    Title           = userSearch.DisplayName
                };
                searchDoc.NumericKeys.Add("superuser", Convert.ToInt32(userSearch.SuperUser));
                searchDocuments.Add(searchDoc.UniqueKey, searchDoc);
            }

            if (!searchDocuments.ContainsKey(
                    string.Format("{0}_{1}", userSearch.UserId, UserVisibilityMode.AdminOnly)
                    .ToLowerInvariant()))
            {
                if (!indexedUsers.Contains(userSearch.UserId))
                {
                    indexedUsers.Add(userSearch.UserId);
                }
                //if the user doesn't exist in search collection, we need add it with ALLUsers mode,
                //so that can make sure DisplayName will be indexed
                var searchDoc = new SearchDocument
                {
                    SearchTypeId = UserSearchTypeId,
                    UniqueKey    =
                        string.Format("{0}_{1}", userSearch.UserId,
                                      UserVisibilityMode.AdminOnly).ToLowerInvariant(),
                    PortalId        = portalId,
                    ModifiedTimeUtc = userSearch.LastModifiedOnDate,
                    Body            = string.Empty,
                    Description     = userSearch.FirstName,
                    Title           = userSearch.DisplayName
                };

                searchDoc.NumericKeys.Add("superuser", Convert.ToInt32(userSearch.SuperUser));
                searchDoc.Keywords.Add("username", userSearch.UserName);
                searchDoc.Keywords.Add("email", userSearch.Email);
                searchDoc.Keywords.Add("createdondate", userSearch.CreatedOnDate.ToString(Constants.DateTimeFormat));
                searchDocuments.Add(searchDoc.UniqueKey, searchDoc);
            }
        }