Example #1
0
        private void ShowPopularProducts()
        {
            popularProductList = BLProduct.RetrieveTopNPopularProductsFromDB(connectionString, numberOfProducts: 3);

            LinkPop1.NavigateUrl = "Product.aspx?productId=" + popularProductList[0].Id;
            ImagePop1.ImageUrl   = "ImgHandler.ashx?productId=" + popularProductList[0].Id;
            TitlePop1.Text       = popularProductList[0].Name;
            if (popularProductList[0].Discount > 0)
            {
                OriginalPricePop1.Text = "<strike>£" + popularProductList[0].Price +
                                         "</strike>";
                DiscountPricePop1.Text = "£" +
                                         (popularProductList[0].Price * (1 - popularProductList[0].Discount / 100));
            }
            else
            {
                OriginalPricePop1.Text = "Price: £" + popularProductList[0].Price;
            }

            LinkPop2.NavigateUrl = "Product.aspx?productId=" + popularProductList[1].Id;
            ImagePop2.ImageUrl   = "ImgHandler.ashx?productId=" + popularProductList[1].Id;
            TitlePop2.Text       = popularProductList[1].Name;
            if (popularProductList[1].Discount > 0)
            {
                OriginalPricePop2.Text = "<strike>£" + popularProductList[1].Price +
                                         "</strike>";
                DiscountPricePop2.Text = "£" +
                                         (popularProductList[1].Price * (1 - popularProductList[1].Discount / 100));
            }
            else
            {
                OriginalPricePop2.Text = "Price: £" + popularProductList[1].Price;
            }

            LinkPop3.NavigateUrl = "Product.aspx?productId=" + popularProductList[2].Id;
            ImagePop3.ImageUrl   = "ImgHandler.ashx?productId=" + popularProductList[2].Id;
            TitlePop3.Text       = popularProductList[2].Name;
            if (popularProductList[2].Discount > 0)
            {
                OriginalPricePop3.Text = "<strike>£" + popularProductList[2].Price +
                                         "</strike>";
                DiscountPricePop3.Text = "£" +
                                         (popularProductList[2].Price * (1 - popularProductList[2].Discount / 100));
            }
            else
            {
                OriginalPricePop3.Text = "Price: £" + popularProductList[2].Price;
            }
        }