private void BuildSidebarCategorys()
        {
            string categorys = null;
            var    catNames  = DataManagement.GetAllCategoryNamesO();

            foreach (var catName in catNames)
            {
                var catID = DataManagement.GetCategoryIdFromNameO(catName);
                var path  = @"index.aspx?category=" + catID;
                categorys += @"<li class='category'><a href='" + path + "'>" + catName + "</a></li>";
            }
            LiteralCategorys.Text = categorys;
        }
Beispiel #2
0
        private void RefreshDropDown()
        {
            categoryList.Items.Clear();

            var catNames = DataManagement.GetAllCategoryNamesO();

            foreach (var catName in catNames)
            {
                int      catID = DataManagement.GetCategoryIdFromNameO(catName);
                ListItem item  = new ListItem(catName, catID.ToString());
                categoryList.Items.Add(item);
            }
        }
Beispiel #3
0
        private void BuildCategoryMenu()
        {
            string categorys = "<ul class='categoryList'>";
            var    catNames  = DataManagement.GetAllCategoryNamesO();

            foreach (var catName in catNames)
            {
                var catID = DataManagement.GetCategoryIdFromNameO(catName);
                var path  = @"index.aspx?category=" + catID;
                categorys += @"<li class='" + "categoryMobileMenu" + "'><a href='" + path + "'>" + catName + "</a></li>";
            }
            categorys += "</ul>";
            LiteralMobileCategoryList.Text = categorys;
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool vat = true;

            if (Session["vat"] != null)
            {
                if (Session["vat"].Equals("true"))
                {
                    vat = true;
                }
                else
                {
                    vat = false;
                }
            }

            DataManagement.WithVAT = vat;

            if (!string.IsNullOrEmpty(Request["id"]))
            {
                // visa produkt
                var product = DataManagement.GetProductByIDo(int.Parse(Request["id"]));

                if (product == null)
                {
                    return;
                }
                var    image       = DataManagement.GetImagesForProduct(product.productId);
                string productInfo = "<div class='row' id='" + product.productId + "'>";
                productInfo += "<h2 class='h2'>" + product.name + "</h2>";
                if (image.Count > 0)
                {
                    string path = image[0].url;
                    productInfo += "<img class='img-responsive' src='" + path + "' alt='' />";
                }
                else
                {
                    productInfo += "<img class='img-responsive' src='img/Papper.jpg' alt='' />";
                }
                productInfo += "<p class='priceBox'><span class='price'>" + $"{product.price:0.00}" + "</span> kr</p>";
                productInfo += "<input type='number' value='1' id='itemCounter' />";
                productInfo += "<button type='button' class='btn btn-primary addToCartButton'>Köp</button>";
                productInfo += "<div class='productDescription'><p>" + product.description + "</p></div>";
                productInfo += "</div>"; // end row
                // skriv ut produkt
                LiteralProduct.Text = productInfo;
            }
            else if (!string.IsNullOrEmpty(Request["category"]))
            {
                // visa alla produkter i given kategori
                var products = DataManagement.GetAllProductsFromCategoryO(int.Parse(Request["category"].ToString()));
                var catName  = DataManagement.GetAllCategoryNameFromCategoryID(int.Parse(Request["category"].ToString()));

                if (products == null)
                {
                    return;
                }

                string productInfo = "<h2 class='h2'>" + catName + "</h2>";
                productInfo += "<div class='row'>";
                foreach (var product in products)
                {
                    var image = DataManagement.GetImagesForProduct(product.productId);
                    productInfo += "<div class='col-sm-3' id='" + product.productId + "'>";
                    productInfo += "<div class='thumbnail'>";
                    productInfo += "<a href='index.aspx?id=" + product.productId + "'>";
                    productInfo += "<div class='BildDiv'>";
                    if (image.Count > 0)
                    {
                        string path = image[0].url;
                        productInfo += "<img class='img-responsive' src='" + path + "' alt='' />";
                    }
                    else
                    {
                        productInfo += "<img class='img-responsive' src='img/Papper.jpg' alt='' />";
                    }
                    productInfo += "</div>";
                    productInfo += "<h3 class='h3'>" + product.name + "</h3>";
                    productInfo += "<p class='priceBox'><span class='price'>" + $"{product.price:0.00}" + "</span> kr</p>";
                    productInfo += "</a>";
                    productInfo += "</div>";     // end thumbnail
                    productInfo += "</div>";     // end col-sm-3
                }
                productInfo         += "</div>"; // end row
                LiteralCategory.Text = productInfo;
            }
            else
            {
                // visa startsidan
                var products = DataManagement.GetLatestAdded();

                if (products == null)
                {
                    return;
                }

                string productInfo = "<h2 class='h2'>Nyheter</h2>";
                productInfo += "<div class='row'>";
                foreach (var product in products)
                {
                    var image = DataManagement.GetImagesForProduct(product.productId);
                    productInfo += "<div class='col-sm-3' id='" + product.productId + "'>";
                    productInfo += "<div class='thumbnail'>";
                    productInfo += "<a href='index.aspx?id=" + product.productId + "'>";
                    productInfo += "<div class='BildDiv'>";
                    if (image.Count > 0)
                    {
                        string path = image[0].url;
                        productInfo += "<img class='img-responsive' src='" + path + "' alt='' />";
                    }
                    else
                    {
                        productInfo += "<img class='img-responsive' src='img/Papper.jpg' alt='' />";
                    }
                    productInfo += "</div>";
                    productInfo += "<h3 class='h3'>" + product.name + "</h3>";
                    productInfo += "<p class='priceBox'><span class='price'>" + $"{product.price:0.00}" + "</span> kr</p>";
                    productInfo += "</a>";
                    productInfo += "</div>";   // end thumbnail
                    productInfo += "</div>";   // end col-sm-3
                }
                productInfo       += "</div>"; // end row
                LiteralStart.Text += productInfo;
            }
        }