Exemple #1
0
 protected void SearchSongs_Click(object sender, EventArgs e)
 {
     if (SearchText.Text != "" && SearchText.Text != null)
     {
         songJson = SearchUtility.SearchSongs(SearchText.Text);
     }
     else
     {
         songJson = JSONGenerator.generateSongJSON();
     }
 }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String searchString = Request.QueryString["searchString"];

            if (searchString == null)
            {
                songJson = JSONGenerator.generateSongJSON();
            }
            else
            {
                songJson = SearchUtility.SearchSongsbyBand(searchString);
            }

            currentDateTimeString = JSONGenerator.generateTimeString();
            songNames             = JSONGenerator.generateSongNames();
        }
Exemple #3
0
        public static string SearchSongsbyBand(string searchString)
        {
            List <Songs> songs         = JsonConvert.DeserializeObject <List <Songs> >(JSONGenerator.generateSongJSON());
            List <Songs> searchResults = new List <Songs>();

            foreach (Songs song in songs)
            {
                if ((song.BandName.IndexOf(searchString, StringComparison.CurrentCultureIgnoreCase)) > -1)
                {
                    searchResults.Add(song);
                }
            }

            return(JsonConvert.SerializeObject(searchResults));
        }