Пример #1
0
        public List <ModelView.SerachResultvalue> SearchInHoma(Guid congressId, Enums.SearchType SerachType, string txtvalue)
        {
            var resultvalues = new List <ModelView.SerachResultvalue>();

            if (string.IsNullOrEmpty(txtvalue))
            {
                return(resultvalues);
            }
            var homaBo = new HomaBO();

            switch (SerachType)
            {
            case Enums.SearchType.All:
                homaBo.NewsSearch(ConnectionHandler, congressId, txtvalue, resultvalues);
                homaBo.ContenetSearch(ConnectionHandler, congressId, txtvalue, resultvalues);
                return(resultvalues);

                break;

            case Enums.SearchType.Content:
                homaBo.ContenetSearch(ConnectionHandler, congressId, txtvalue, resultvalues);
                return(resultvalues);

            case Enums.SearchType.News:
                homaBo.NewsSearch(ConnectionHandler, congressId, txtvalue, resultvalues);
                return(resultvalues);
            }
            return(resultvalues);
        }
Пример #2
0
        internal static IDictionary <string, string> GetBaseSearchParams(Enums.SearchType type)
        {
            IDictionary <string, string> searchParams = new Dictionary <string, string>();

            switch (type)
            {
            case Enums.SearchType.ASIN:
                searchParams["Operation"]     = "ItemLookup";
                searchParams["ResponseGroup"] = "Medium";
                searchParams["Service"]       = "AWSCommerceService";
                break;

            case Enums.SearchType.SearchTerm:
                searchParams["Operation"]     = "ItemSearch";
                searchParams["ResponseGroup"] = "Medium";
                searchParams["Service"]       = "AWSCommerceService";
                break;

            case Enums.SearchType.ArtistSearch:
                searchParams["Condition"]     = "New";
                searchParams["Format"]        = "Audio CD";
                searchParams["Operation"]     = "ItemSearch";
                searchParams["ResponseGroup"] = "Medium";
                searchParams["SearchIndex"]   = "Music";
                searchParams["Service"]       = "AWSCommerceService";
                searchParams["Sort"]          = "-releasedate";
                break;
            }

            return(searchParams);
        }
Пример #3
0
        public ActionResult DoSearch(string query, Enums.SearchType searchType)
        {
            switch (searchType)
            {
            case Enums.SearchType.Character:
                return(View("CharacterSearchResults",
                            repo.GetCharacterSearchResults(query)));

            case Enums.SearchType.Planet:
                return(View("PlanetSearchResults",
                            repo.GetPlanetSearchResults(query)));

            case Enums.SearchType.Species:
                return(View("SpeciesSearchResults",
                            repo.GetSpeciesSearchResults(query)));

            case Enums.SearchType.Vehicle:
                return(View("VehicleSearchResults",
                            repo.GetVehicleSearchResults(query)));
            }

            return(View("Error"));
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Text"></param>
        /// <param name="Words"></param>
        /// <param name="Type"></param>
        /// <returns></returns>
        public static bool Searching(string Text, string[] Words, Enums.SearchType Type = Enums.SearchType.Contains)
        {
            try
            {
                switch (Type)
                {
                case Enums.SearchType.Starts:
                    if (Words.Length > 1)
                    {
                        foreach (string Letter in Words)
                        {
                            if (Text.StartsWith(Letter))
                            {
                                return(true);
                            }
                        }
                    }
                    else if (Text.StartsWith(Words[0]))
                    {
                        return(true);
                    }

                    break;

                case Enums.SearchType.Contains:
                    if (Words.Length > 1)
                    {
                        foreach (string Letter in Words)
                        {
                            if (Text.Contains(Letter))
                            {
                                return(true);
                            }
                        }
                    }
                    else if (Text.Contains(Words[0]))
                    {
                        return(true);
                    }

                    break;

                case Enums.SearchType.Ends:
                    if (Words.Length > 1)
                    {
                        foreach (string Letter in Words)
                        {
                            if (Text.EndsWith(Letter))
                            {
                                return(true);
                            }
                        }
                    }
                    else if (Text.EndsWith(Words[0]))
                    {
                        return(true);
                    }

                    break;
                }
                return(false);
            }
            catch
            {
                return(false);
            }
        }