/// <summary> /// Reinitialize the Attributes list with the given businesses remaining /// </summary> /// <param name="businesses">List of businesses remaining</param> /// <returns>List of attributes found</returns> public static List <BaseInfo> BusinessAttributes(List <BaseInfo> businesses) { List <string> qualifiedAttributes = new List <string>(MainData.GetQualifiedAttributes().Keys); OrFilter orfilter = new OrFilter(); foreach (string atr in qualifiedAttributes) { orfilter.Add($"attributename like '{atr}'"); } if (businesses.Count > 0) { if (businesses[0] is Business business) { Select data = new Select("businessattributes"); data.AddColumns("attributename, Count(attributename) as total"); data.AddInnerJoin("business", "businessid"); data.SetGroupBy("attributename"); data.AddFilter($"state = '{business.State}'"); data.AddFilter($"city = '{business.City}'"); data.AddFilter($"zipcode = '{business.Zipcode}'"); data.AddFilter($"value <> 'False'"); data.AddFilter($"value <> 'no'"); data.AddOrFilter(orfilter); OrFilter orfilter2 = new OrFilter(); foreach (Business b in businesses) { orfilter2.Add($"business.businessid = '{b.Businessid}'"); } data.AddOrFilter(orfilter2); return(CreateList(typeof(BusinessAttribute), RunQuery(data))); } } return(new List <BaseInfo>()); }