示例#1
0
 protected void SearchButton_Click(object sender, EventArgs e)
 {
     if (SearchBand.Text == "")
     {
         bandJson = JSONGenerator.generateBandJSON();
     }
     else
     {
         bandJson = SearchUtility.SearchBands(SearchBand.Text);
     }
 }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     bandJson  = JSONGenerator.generateBandJSON();
     bandNames = JSONGenerator.generateBandNames();
 }
示例#3
0
        public static string SearchBands(string searchString)
        {
            BandsCollection bands         = JsonConvert.DeserializeObject <BandsCollection>(JSONGenerator.generateBandJSON());
            List <BandJSON> searchResults = new List <BandJSON>();

            foreach (BandJSON band in bands.band)
            {
                if (band.BandName.IndexOf(searchString, StringComparison.CurrentCultureIgnoreCase) != -1)
                {
                    searchResults.Add(band);
                }
            }
            BandsCollection result = new BandsCollection();

            result.band = searchResults;
            return(JsonConvert.SerializeObject(result));
        }