Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oDB = new PetStore.DB.Data();
            if (!IsPostBack)
            {
                txtError.Text = "";

                if (Session["ShoppingCart"] != null)
                {
                    oShoppingCartCollection = (ShoppingCartCollection)Session["ShoppingCart"];
                }
                else
                {
                    oShoppingCartCollection = new ShoppingCartCollection();
                }

                string mainCategory = "";
                string categoryName = "";
                mainCategory = Request.QueryString["MainCat"];
                categoryName = Request.QueryString["Cat"];
                if (mainCategory == null)
                {
                    mainCategory = "DOG";
                }
                if (categoryName == null)
                {
                    categoryName = oDB.GetFirstCategoryForMainCategory(mainCategory);
                }

                //if (mainCategory == "DOG") { ldog.Attributes.Add("class", "headerNavSelected");  imgCategory.ImageUrl = "../Images/dogbanner.jpg";    }
                //else if (mainCategory == "CAT") { lcat.Attributes.Add("class", "headerNavSelected"); imgCategory.ImageUrl = "../Images/catbanner.jpg"; }
                //else if (mainCategory == "FISH") { lfish.Attributes.Add("class", "headerNavSelected"); imgCategory.ImageUrl = "../Images/fishbanner.jpg"; }
                //else if (mainCategory == "BIRD") { lbird.Attributes.Add("class", "headerNavSelected"); imgCategory.ImageUrl = "../Images/birdbanner.jpg"; }

                categoryTitle.Text = oDB.GetCategoryTitle(mainCategory, categoryName);
                DataTable dtProduct = new DataTable();
                dtProduct             = oDB.GetProductByCategory(mainCategory, categoryName);
                rptProduct.DataSource = dtProduct;
                rptProduct.DataBind();
            }
        }