Ejemplo n.º 1
0
        private void DisplayCategoryResult()
        {
            BLCategory category = BLCategory.RetrieveFromDB(connectionString, categoryId);

            if (category == null)
            {
                throw new HttpException(404, $"Result.aspx?categoryId={categoryId} doesn't exist.");
            }
            resultBLProducts = BLProduct.RetrieveListFromDB(connectionString,
                                                            $"CategoryID = {categoryId} AND ID NOT IN (SELECT VariantID FROM ProductVariants)");
            ResultTitle.InnerHtml       = category.Name;
            ResultImage.Src             = $"ImgHandler.ashx?categoryId={categoryId}";
            ResultDescription.InnerHtml = category.Description;
            DisplayProducts();
        }
Ejemplo n.º 2
0
        private void DisplaySearchResult()
        {
            ResultDescription.Visible = false;
            string[] searchWords     = searchString.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string   sqlSearchString = "%";

            for (int i = 0; i < searchWords.Length; i++)
            {
                sqlSearchString += searchWords[i] + "%";
            }
            resultBLProducts = BLProduct.RetrieveListFromDB(connectionString, $"Name LIKE '{sqlSearchString}'");
            if (resultBLProducts.Count > 0)
            {
                ResultTitle.InnerHtml = $"Search results for '{searchString}':";
                DisplayProducts();
            }
            else
            {
                ResultTitle.InnerHtml = $"No results were found for '{searchString}'.";
            }
        }