Esempio n. 1
0
        protected void BtnCart_Click(object sender, EventArgs e)
        {
            if (Session["userName"] != null) //if logged in, display all necessary infomation
            {
                double Total;
                double price;
                int    quantity;

                price    = Convert.ToDouble(LblPrice.Text);
                quantity = 1;
                Total    = ComputeTotal(price, quantity);

                string   Username = Session["userName"].ToString();
                BLL.Cart c        = new BLL.Cart();
                c = new BLL.Cart(Username, LblName.Text, Image1.ImageUrl, 1, LblPrice.Text, Total);
                int result = c.AddCart();
                if (result == 1)
                {
                    LblMessage.Text      = "Product added to cart successfully!";
                    LblMessage.ForeColor = Color.Green;
                }
                else
                {
                    LblMessage.Text      = "Error in adding product! Inform System Administrator!";
                    LblMessage.ForeColor = Color.Red;
                }
            }
            else
            {
                Validation.Visible = true;
                Lbl_Msg.Text       = "Please log in to make transactions";
            }
            //Response.Redirect("Cart.aspx");
        }
Esempio n. 2
0
        private void RefreshGridView()
        {
            BLL.Cart c = new BLL.Cart();
            cList = c.GetAllCartP();

            GvCart.Visible    = true;
            GvCart.DataSource = cList;
            GvCart.DataBind();
        }
Esempio n. 3
0
        protected void GvCart_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            BLL.Cart c = new BLL.Cart();
            //c = new BLL.Cart(1, LblName.Text, "", 1, LblPrice.Text);
            int result = c.DeleteItem();

            if (result == 1)
            {
                LblMsg.Text      = "Item deleted successfully!";
                LblMsg.ForeColor = Color.Green;
            }
            else
            {
                LblMsg.Text      = "Error in deleting Item! Inform System Administrator!";
                LblMsg.ForeColor = Color.Red;
            }
        }
Esempio n. 4
0
        protected void BtnCart_Click(object sender, EventArgs e)
        {
            BLL.Cart c = new BLL.Cart();
            c = new BLL.Cart(LblName.Text, Image1.ImageUrl, 1, LblPrice.Text);
            int result = c.AddCart();

            if (result == 1)
            {
                LblMessage.Text      = "Product added to cart successfully!";
                LblMessage.ForeColor = Color.Green;
            }
            else
            {
                LblMessage.Text      = "Error in adding product! Inform System Administrator!";
                LblMessage.ForeColor = Color.Red;
            }
            //Response.Redirect("Cart.aspx");
        }