Example #1
0
        public IList <SuggestionEventForPersonDTO> GetSuggestionsRefactored(Person p, IList <int> enabledIds)
        {
            var profiler = MiniProfiler.Current;

            Suggester s = new Suggester();

            IDictionary <string, AdminSuggestionFeaturePersonResponsibility> features = this.GetAdminSuggestionFeaturePersonResponsibilities();

            using (profiler.Step("set counts of previous suggestions"))
                s.SetFeatureProbabilityCalcs(this.CountSuggestedFeatures());

            using (profiler.Step("get person relationship suggestions"))
                s.AddSuggestedFeatures(this.GetPersonRelationshipSuggestions(p));

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.RESPONSIBLE_FOR_RELATED_EVENT].Id))
            {
                using (profiler.Step("get event relationship suggestions"))
                    s.AddSuggestedFeatures(this.GetEventRelationshipSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.LAST_NAME_APPEARS].Id))
            {
                using (profiler.Step("get last name suggestions"))
                    s.AddSuggestedFeatures(this.GetLastNameSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.FIRST_NAME_APPEARS].Id))
            {
                using (profiler.Step("get first name suggestions"))
                    s.AddSuggestedFeatures(this.GetFirstNameSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.ALIAS_APPEARS].Id))
            {
                using (profiler.Step("get alias suggestions"))
                    s.AddSuggestedFeatures(this.GetAliasSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.COMMON_SOURCE].Id))
            {
                using (profiler.Step("get shared source suggestions"))
                    s.AddSuggestedFeatures(this.GetSourceSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.CAREER_IN_LOCATION].Id))
            {
                using (profiler.Step("get career location suggestions"))
                    s.AddSuggestedFeatures(this.GetCareerLocationSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.CAREER_IN_ORG_RESPONSIBLE].Id))
            {
                using (profiler.Step("get career in responsible org suggestions"))
                    s.AddSuggestedFeatures(this.GetCareerInResponsibleOrganizationSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.CAREER_IN_UNIT_RESPONSIBLE].Id))
            {
                using (profiler.Step("get career in responsible unit suggestions"))
                    s.AddSuggestedFeatures(this.GetCareerInResponsibleUnitSuggestions(p));
            }

            if (enabledIds.Contains(features[AdminSuggestionFeaturePersonResponsibility.RESPONSIBILITY_IN_LOCATION].Id))
            {
                using (profiler.Step("get event in same location suggestions"))
                    s.AddSuggestedFeatures(this.GetEventInSameLocationSuggestions(p));
            }

            IList <SuggestionEventForPersonDTO> dtos;

            using (profiler.Step("Suggester.Suggest"))
                dtos = s.Suggest(p);

            return(dtos);
        }