public void GetAllCartItem()
        {
            if (Convert.ToInt32(Session["UserId"]) == 0)
            {
                EmptyCart.Visible = true;
                CartItem.Visible  = false;
            }
            else
            {
                EmptyCart.Visible = false;
                CartItem.Visible  = true;

                List <CartItem_Result> objList = new List <CartItem_Result>();
                using (var entities = new ShoppingCartEntities())
                {
                    objList = entities.CartItem(Convert.ToInt32(Session["UserId"])).ToList <CartItem_Result>();
                }

                if (objList.Count != 0)
                {
                    EmptyCart.Visible = false;
                    CartItem.Visible  = true;

                    cartListcartImg.DataSource = objList;
                    cartListcartImg.DataBind();
                }
                else
                {
                    EmptyCart.Visible = true;
                    CartItem.Visible  = false;
                }
            }
        }
Exemplo n.º 2
0
        public void LoadCartItem()
        {
            if (Convert.ToInt32(Session["UserId"]) != 0)
            {
                List <CartItems_Result> objList = new List <CartItems_Result>();
                using (var entities = new ShoppingCartEntities())
                {
                    objList = entities.CartItems(Convert.ToInt32(Session["UserId"])).
                              ToList <CartItems_Result>();
                }

                if (objList.Count == 0)
                {
                    CartList.Visible  = false;
                    EmptyCart.Visible = true;
                }
                else
                {
                    Repeater1.DataSource = objList;
                    Repeater1.DataBind();
                    CartList.Visible  = true;
                    EmptyCart.Visible = false;
                }
            }
            else
            {
                CartList.Visible  = false;
                EmptyCart.Visible = true;
            }
        }
 protected void btnAddToCart_Click(object sender, EventArgs e)
 {
     using (var entities = new ShoppingCartEntities())
     {
         entities.CheckOut(Convert.ToInt32(Session["UserId"]));
     }
     ClientScript.RegisterStartupScript(this.GetType(), "Message", "alert('Successfully CheckOut !')", true);
 }
Exemplo n.º 4
0
        public void GetAllProduct()
        {
            List <ProductSelectAll_Result> objList = new List <ProductSelectAll_Result>();

            using (var entities = new ShoppingCartEntities())
            {
                objList = entities.ProductSelectAll().ToList <ProductSelectAll_Result>();
            }
            ProductList.DataSource = objList;
            ProductList.DataBind();
        }
Exemplo n.º 5
0
        public void LoadProducts()
        {
            List <ProductSelectAll_Result> objList = new List <ProductSelectAll_Result>();

            using (var entities = new ShoppingCartEntities())
            {
                objList = entities.ProductSelectAll().
                          ToList <ProductSelectAll_Result>();
            }

            Repeater1.DataSource = objList;
            Repeater1.DataBind();
        }
Exemplo n.º 6
0
 protected void btnAddtoCart_Command(object sender, CommandEventArgs e)
 {
     if (Convert.ToInt32(Session["UserId"]) != 0)
     {
         using (var entities = new ShoppingCartEntities())
         {
             entities.AddToCart(Convert.ToInt32(Session["UserId"]), Convert.ToInt32(e.CommandArgument));
         }
         ClientScript.RegisterStartupScript(this.GetType(), "Message", "alert('Successfully added to cart !')", true);
     }
     else
     {
         Response.Redirect("Login.aspx");
     }
 }
Exemplo n.º 7
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            List <Autrhentication_Result> objList = new List <Autrhentication_Result>();

            using (var entities = new ShoppingCartEntities())
            {
                objList = entities.Autrhentication(txtUsername.Text.Trim(), txtPassword.Text.Trim()).
                          ToList <Autrhentication_Result>();
            }
            if (objList.Count != 0)
            {
                Session["UserId"] = objList[0].UserId;
                Response.Redirect("Home.aspx");
            }
            else
            {
                lblError.Text = "Invalid username / password";
            }
        }
Exemplo n.º 8
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            List <Authentication_Result> objList = new List <Authentication_Result>();

            using (var entities = new ShoppingCartEntities()){
                objList = entities.Authentication(txtUsername.Text.Trim(), txtPassword.Text.Trim()).ToList <Authentication_Result>();
            }

            if (objList.Count == 0)
            {
                Session["UserId"]   = 0;
                lblStatus.Text      = "Invalid username or password";
                lblStatus.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                Session["UserId"] = objList[0].UserId;
                Response.Redirect("Home.aspx");
            }
        }
Exemplo n.º 9
0
        public void GetAllCartItems()
        {
            if (Convert.ToInt32(Session["UserId"]) == 0)
            {
                btnCheckOut.Visible = false;
                CartItem.Visible    = false;
                CartEmpty.Visible   = true;
            }
            else
            {
                btnCheckOut.Visible = true;
                CartItem.Visible    = true;
                CartEmpty.Visible   = false;
            }

            List <ShoppingCart_Result> objList = new List <ShoppingCart_Result>();

            using (var entities = new ShoppingCartEntities())
            {
                objList = entities.ShoppingCart(Convert.ToInt32(Session["UserId"])).ToList <ShoppingCart_Result>();
            }
            Repeater1.DataSource = objList;
            Repeater1.DataBind();
        }