Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UserID"] == null || String.IsNullOrWhiteSpace(Convert.ToString(Session["UserID"])))
                {
                    Response.Redirect("~/LoginPage.aspx");
                }

                if (Session["ShoppingCart"] != null)
                {
                    string    shoppingCart = (Convert.ToString(Session["ShoppingCart"]));
                    DataTable dt           = objBAL.GetShoppingCart(shoppingCart);

                    if (dt.Rows.Count > 0)
                    {
                        dtlShopList.DataSource = dt;
                        dtlShopList.DataBind();
                    }
                    else
                    {
                        lblMsg.Text = "Shopping list is empty";
                    }
                }
                else
                {
                    lblMsg.Text = "Shopping list is empty";
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            txtSearch.Attributes.Add("onKeyPress", "doClick('" + btnGo.ClientID + "',event)");

            if (Session["UserID"] == null || Convert.ToString(Session["UserID"]) == "")
            {
                pnlLogIn.Visible  = false;
                pnlSignUp.Visible = true;
            }
            else
            {
                pnlLogIn.Visible  = true;
                pnlSignUp.Visible = false;
            }

            if (Session["ShoppingCart"] != null)
            {
                DataTable dt = objBAL.GetShoppingCart(Convert.ToString(Session["ShoppingCart"]));

                if (dt.Rows.Count > 0)
                {
                    lblCart.Text = Convert.ToString(dt.Rows.Count) + " items";
                }
                else
                {
                    lblCart.Text = "0 items";
                }
            }
            else
            {
                lblCart.Text = "0 items";
            }
        }
Esempio n. 3
0
        public int FillCart()
        {
            int cartItems = 0;

            if (Session["ShoppingCart"] != null && Session["ShoppingCart"].ToString().Trim().Length > 0)
            {
                string shoppingCart = Convert.ToString(Session["ShoppingCart"]);

                DataTable dt = objBAL.GetShoppingCart(shoppingCart);

                if (dt.Rows.Count > 0)
                {
                    cartItems = dt.Rows.Count;

                    dtlCart.DataSource = dt;
                    dtlCart.DataBind();

                    FillSubTotal(dt);

                    pnlNoProd.Visible  = false;
                    pnlProduct.Visible = true;
                }
                else
                {
                    cartItems          = 0;
                    lblTotal.Text      = "0.00";
                    pnlNoProd.Visible  = true;
                    pnlProduct.Visible = false;
                }
            }

            return(cartItems);
        }
        private void FillCart()
        {
            DataTable dt = new DataTable();

            if (Session["ShoppingCart"] != null)
            {
                dt = objBAL.GetShoppingCart(Convert.ToString(Session["ShoppingCart"]));

                if (dt.Rows.Count > 0)
                {
                    grvOrderDetails.DataSource = dt;
                    grvOrderDetails.DataBind();

                    CalculateTotal(dt);
                }
                else
                {
                    HideCart(true);
                }
            }
            else
            {
                HideCart(true);
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txtSearch.Attributes.Add("onKeyPress", "doClick('" + btnGo.ClientID + "',event)");

            if (Session["ShoppingCart"] != null)
            {
                DataTable dt = objBAL.GetShoppingCart(Convert.ToString(Session["ShoppingCart"]));

                if (dt.Rows.Count > 0)
                {
                    lblCart.Text = Convert.ToString(dt.Rows.Count) + " items";
                }
                else
                {
                    lblCart.Text = "0 items";
                }
            }
            else
            {
                lblCart.Text = "0 items";
            }

            if (!IsPostBack)
            {
                if (Session["UserID"] == null || Session["UserID"].ToString().Trim().Length == 0)
                {
                    pnlLogIn.Visible  = false;
                    pnlSignUp.Visible = true;
                }
                else
                {
                    pnlLogIn.Visible  = true;
                    pnlSignUp.Visible = false;
                    FillUserName();
                }

                dtlCategory.DataSource = objBAL.BindAisleTop();
                dtlCategory.DataBind();
            }
        }