protected void SaveItem_OnClick(object sender, EventArgs e)
        {
            Button      btn  = sender as Button;
            GridViewRow row  = btn.NamingContainer as GridViewRow;
            string      ISBN = CartGridView.DataKeys[row.RowIndex].Values["ISBN"].ToString();


            ServicesShoppingCart.SaveWishProduct(ISBN);
            ServicesShoppingCart.DeleteIteminDB(ISBN);
            RenderGrid();
        }
Beispiel #2
0
        protected void Login1_LoggedIn(object sender, EventArgs e)
        {
            // getting user information from the DB
            user = userMan.getUserInfo(Login1.UserName.Trim(), hashedPassword, ConfigurationManager.ConnectionStrings["GeekTextConnection"].ConnectionString);

            // put info into session ID and use UserManager methods to get the rest from these
            Session["UserID"] = user.userID;
            ServicesShoppingCart.LoadShoppingCartFromDB();
            Session["Username"] = user.userProfileName;
            Session["UserPass"] = user.userPassword;


            Response.Redirect("Profile.aspx");
        }
        protected void RemoveItem_OnClick(object sender, EventArgs e)
        {
            Button      btn  = sender as Button;
            GridViewRow row  = btn.NamingContainer as GridViewRow;
            string      ISBN = CartGridView.DataKeys[row.RowIndex].Values["ISBN"].ToString();

            BookItem myitem = new BookItem
            {
                ISBN     = ISBN,
                quantity = -1
            };

            ServicesShoppingCart.AddItem(myitem);
            RenderGrid();
        }
        private void RenderGrid()
        {
            var itemlist = ServicesShoppingCart.GetShoopingCart().BookList;

            CartGridView.DataSource = ServicesShoppingCart.GetItemDetails(itemlist);
            CartGridView.DataBind();

            var WishList = (from p in ServicesShoppingCart.GetWishList()
                            select new BookItem {
                ISBN = p
            }).ToList();

            WishGridView.DataSource = ServicesShoppingCart.GetItemDetails(WishList);
            WishGridView.DataBind();
        }
        protected void AddItemtoCar_OnClick(object sender, EventArgs e)
        {
            Button      btn  = sender as Button;
            GridViewRow row  = btn.NamingContainer as GridViewRow;
            string      ISBN = WishGridView.DataKeys[row.RowIndex].Values["ISBN"].ToString();


            ServicesShoppingCart.AddItem(new BookItem
            {
                ISBN     = ISBN,
                quantity = 1
            });
            ServicesShoppingCart.RemoveWishItem(ISBN);
            RenderGrid();
        }
        protected void AddButton_OnClick(object sender, EventArgs e)
        {
            Button      btn    = sender as Button;
            GridViewRow row    = btn.NamingContainer as GridViewRow;
            string      ISBN   = BookDetailsGridView.DataKeys[row.RowIndex].Values["ISBN"].ToString();
            string      title  = BookDetailsGridView.DataKeys[row.RowIndex].Values["title"].ToString();
            double      price  = double.Parse(BookDetailsGridView.DataKeys[row.RowIndex].Values["price"].ToString());
            BookItem    myitem = new BookItem
            {
                ISBN     = ISBN,
                quantity = 1,
                title    = title,
                price    = price
            };

            ServicesShoppingCart.AddItem(myitem);
            Response.Redirect("Shopping_Cart.aspx");
        }
Beispiel #7
0
 protected void Session_Start(object sender, EventArgs e)
 {
     // Code that runs when a new session is started
     ServicesShoppingCart.SaveShoopingCart(new ShoppingCart());
 }