public void SearchProduct(string value, double minPrice, double maxPrice, string category) { try { MarketLog.Log("StoreCenter", "searching for a product!"); _shopper.ValidateCanBrowseMarket(); MarketLog.Log("StoreCenter", "User enetred the system!"); validatePrices(minPrice, maxPrice); Product[] products; if (value.IsNullOrEmpty()) { products = _storeLogic.GetAllProducts(); } else { Product[] productsKeyWord = FindKeyWord(value); Product[] productsCategory = findProductsCategory(findSimilarCategories(value)); List <Product> product = new List <Product>(productsKeyWord); foreach (Product prod in productsCategory) { product.Add(prod); } products = product.ToArray(); } products = FilterResultsByPrice(products, minPrice, maxPrice); products = FilterResultByCategory(products, category); Answer = new StoreAnswer(SearchProductStatus.Success, "Data retrieved successfully!", AddStoreToProducts(products)); } catch (StoreException e) { Answer = new StoreAnswer((SearchProductStatus)e.Status, e.GetErrorMessage()); } catch (DataException e) { Answer = new StoreAnswer((SearchProductStatus)e.Status, e.GetErrorMessage()); } catch (MarketException) { MarketLog.Log("StoreCenter", "no premission"); Answer = new StoreAnswer(SearchProductStatus.DidntEnterSystem, "User Didn't enter the system!"); } }