コード例 #1
0
        protected void productList_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            var wishlistID = e.CommandArgument;
            WishlistController wishlistControl = new WishlistController();

            if (e.CommandName == "Delete")
            {
                wishlistControl.DeleteWishlist(wishlistID.ToString());

                DataBindToPage(customer_id.InnerText);
            }
            else if (e.CommandName == "InsertData")
            {
                Wishlist obj_wishlist = new Wishlist();
                obj_wishlist = wishlistControl.GetWishlistByID(wishlistID.ToString());
                //Add to Cart
                CartController obj_cart_control = new CartController();
                CartInfo       obj_cart         = new CartInfo();
                obj_cart.ProductID  = obj_wishlist.ProductID;
                obj_cart.CustomerID = obj_wishlist.CustomerID;
                obj_cart.Quantity   = Convert.ToInt32("1");
                obj_cart_control.InsertCart(obj_cart);
                //Delete Wishlist
                wishlistControl.DeleteWishlist(wishlistID.ToString());

                DataBindToPage(customer_id.InnerText);
            }
        }