protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidateInput())
            {
                int    id       = Convert.ToInt32(LblId.Text);
                int    quantity = Convert.ToInt32(TbQuantity.Text);
                double price    = Convert.ToDouble(LblPrice.Text);

                double NewTotal;
                NewTotal = ComputeNewTotal(price, quantity);
                CartDetails cd = new CartDetails("", id, LblName.Text, price, quantity, "", NewTotal.ToString());

                int result = cd.UpdateCartQuantity();
                if (result == 1)
                {
                    LblMsg.Text      = "Quantity updated successfully";
                    LblMsg.ForeColor = Color.Green;
                }
                else
                {
                    LblMsg.Text      = "Error in changing Quantity! Inform System Administrator!";
                    LblMsg.ForeColor = Color.Red;
                }

                Response.Redirect("Cart.aspx");
            }
        }
Exemple #2
0
        private void RefreshGridView()
        {
            CartDetails c = new CartDetails();

            cList = c.GetAllCartP(Session["userName"].ToString());

            GvCart.Visible    = true;
            GvCart.DataSource = cList;
            GvCart.DataBind();
        }
        protected void BtnDelete_Click(object sender, EventArgs e)
        {
            int    quantity = Convert.ToInt32(TbQuantity.Text);
            int    id       = Convert.ToInt32(LblId.Text);
            double price    = Convert.ToDouble(LblPrice.Text);

            BLL.CartDetails c      = new CartDetails("", id, LblName.Text, price, quantity, "", "");
            int             result = c.DeleteItem();

            if (result == 1)
            {
                LblMsg.Text      = "Item deleted from cart successfully!";
                LblMsg.ForeColor = Color.Green;
            }
            else
            {
                LblMsg.Text      = "Error in deleting item! Inform System Administrator!";
                LblMsg.ForeColor = Color.Red;
            }

            Response.Redirect("Cart.aspx");
        }