コード例 #1
0
        /// <summary>
        /// Credential autocomplete
        /// Needs to check authorization level for credential
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="maxTerms"></param>
        /// <returns></returns>
        public static List <object> Autocomplete(string keyword, int maxTerms = 25)
        {
            int userId = 0;

            string where = "";
            int     pTotalRows = 0;
            AppUser user       = AccountServices.GetCurrentUser();

            if (user != null && user.Id > 0)
            {
                userId = user.Id;
            }
            SetAuthorizationFilter(user, ref where);

            SetKeywordFilter(keyword, true, ref where);

            if (UtilityManager.GetAppKeyValue("usingElasticCredentialSearch", false))
            {
                return(ElasticServices.CredentialAutoComplete(keyword, maxTerms, ref pTotalRows));
            }
            else
            {
                return(CredentialManager.Autocomplete(where, 1, maxTerms, ref pTotalRows));
            }
            // return new List<string>();
        }