Exemplo n.º 1
0
        // This event is raised for the header, the footer, separators, and items.

        //// Execute the following logic for Items and Alternating Items.
        //if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        //{
        //    HiddenField oCategory = (HiddenField)e.Item.FindControl("CategoryName");
        //    if (oCategory.Value == categoryName)
        //    {
        //        //  <p class="p_left_menu NavCurrent"><a href="Products.aspx?MainCat=DOG&Cat=BED" class ="aNavSelected">BED</a></p>
        //        // <p id="pTag" runat="server" class="p_left_menu"><a id="aTag" runat="server" href='Products.aspx?MainCat=<%# DataBinder.Eval(Container.DataItem, "MainCategory")%>&Cat=<%#DataBinder.Eval(Container.DataItem, "Category")%>'><%# DataBinder.Eval(Container.DataItem, "Category") %></a></p>

        //        (e.Item.FindControl("pTag") as System.Web.UI.HtmlControls.HtmlGenericControl).Attributes.Add("class", "NavCurrent");
        //       // (e.Item.FindControl("aTag") as System.Web.UI.HtmlControls.HtmlGenericControl).Attributes.Add("class", "aNavSelected");
        //    }


        //}

        private void AddToCart(int PID, int Qty)
        {
            if (Session["ShoppingCart"] != null)
            {
                oShoppingCartCollection = (ShoppingCartCollection)Session["ShoppingCart"];
                ShoppingCart oSC   = new ShoppingCart();
                Product      oItem = new Product();
                oItem     = oDB.GetProduct(PID);
                oSC.PID   = oItem.PID;
                oSC.Item  = oItem.Item;
                oSC.Price = oItem.Price;
                oSC.Qty   = Qty;
                oShoppingCartCollection.Add(oSC);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txtError.Text = "";
            oProduct      = new Product();
            oDB           = new PetStore.DB.Data();
            string pid = "";
            string CAT = "";

            pid                  = Request.QueryString["pid"];
            CAT                  = Request.QueryString["CAT"];
            oProduct             = oDB.GetProduct(Convert.ToInt32(pid));
            itemTitle.Text       = oProduct.Item;
            itemDescription.Text = oProduct.Description;
            itemPrice.Text       = oProduct.Price.ToString();
            itemImage.ImageUrl   = oProduct.Image;
        }