예제 #1
0
        override protected void OnLoad(EventArgs e)
        {
            // Fetch the key field from the query stirng
            string itemId = WebComponents.CleanString.InputText(Request["itemId"], 50);

            // Create an instance of the item business components
            CartItem item = new CartItem();

            // Get the item info from the item component
            itemInfo = item.GetItem(itemId);

            // If an item is found then display the results
            if (itemInfo != null)
            {
                lblDescription.Text = itemInfo.ProductDesc;
                lblName.Text        = itemInfo.Name;
                lblProductName.Text = itemInfo.ProductName;
                lblPrice.Text       = itemInfo.Price.ToString("c");

                // Modify the message if an item is out of stock
                if (itemInfo.Quantity > 0)
                {
                    lblQty.Text = itemInfo.Quantity.ToString();
                }
                else
                {
                    lblQty.Text     = MSG_BACK_ORDERED;
                    lblQty.CssClass = CSS_ALERT;
                }
            }
            else
            {
                lblSearchResults.Text = "Item not found";
            }
        }
예제 #2
0
        public ActionResult ItemDetails(string id)
        {
            CartItem bo = new CartItem();

            return(View(bo.GetItem(id)));
        }