protected void Page_Load(object sender, EventArgs e)
        {
            List <product> products = new List <product>
            {
                new product {
                    Id = 1, Name = "Wolfpack Jacket - Black", Price = 179, Description = "Test description", Amount = 2
                },
                new product {
                    Id = 2, Name = "Storm Jacket - Olive", Price = 150, Description = "Test description", Amount = 3
                },
                new product {
                    Id = 3, Name = "Stealth Jacket - Fatigue", Price = 199, Description = "Test description", Amount = 2
                },
                new product {
                    Id = 4, Name = "Operator Jacket - Black", Price = 99, Description = "Test description", Amount = 4
                },
                new product {
                    Id = 5, Name = "Navigator acket - Black", Price = 79, Description = "Test description", Amount = 3
                },
                new product {
                    Id = 6, Name = "Gulf Jacket - Olive", Price = 279, Description = "Test description", Amount = 1
                },
                new product {
                    Id = 7, Name = "Compound Jacket - Acid ", Price = 159, Description = "Test description", Amount = 2
                },
            };

            GridViewCart.DataSource = products;
            GridViewCart.DataBind();
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         User us = (User)Session["user"];
         if (Session["user"] != null)
         {
             lblPayment.Visible              = false;
             btnCheckout.Visible             = false;
             DropDownListPaymentType.Visible = false;
             if (us.RoleID == 2)
             {
                 var data = ViewCartController.getCart(us.UserID);
                 GridViewCart.DataSource = data.ToList();
                 GridViewCart.DataBind();
                 if (data.Count != 0)
                 {
                     viewCart(us.UserID);
                 }
                 else
                 {
                     empty.Visible = true;
                 }
             }
             else
             {
                 Response.Redirect("Home.aspx");
             }
         }
         else
         {
             Response.Redirect("Home.aspx");
         }
     }
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         GridViewCart.DataSource = bookstorebo.GridViewTableSC();
         GridViewCart.DataBind();
     }
 }
예제 #4
0
        private void BindGridView()
        {
            GridViewCart.DataSource = Connection.dbTable("SELECT * FROM cart WHERE Client_Username='******' AND Status='Active'");
            GridViewCart.DataBind();

            int rowCount = GridViewCart.Rows.Count;

            if (rowCount < 1)
            {
                nothingTodisplay.Text    = "Cart is empty.";
                HyperLinkShopNow.Visible = true;
                ButtonRemove.Visible     = false;
                ButtonEdit.Visible       = false;
                ButtonOrder.Visible      = false;
            }
        }
예제 #5
0
        public void GetData()
        {
            string oid      = (String)Session["orderid"];
            string pincode  = Convert.ToString((String)Session["pincodesession"]);
            string fname    = (String)Session["firstnamesession"];
            string lname    = (String)Session["lastnamesession"];
            string address  = (String)Session["addresssession"];
            string emailid  = (String)Session["emailidsession"];
            string mobileno = (String)Session["mobilenosession"];

            lblorderid.Text      = oid;
            lbltxtfirstname.Text = fname;
            lbllastname.Text     = lname;
            lbladdress.Text      = address;
            lblzipcode.Text      = pincode;
            lblemailid.Text      = emailid;
            lblmobileno.Text     = mobileno;

            string         qr  = "Select product_name,size,MRP,ordered_quantity,total_price from tempcart where order_id = " + oid + "";
            SqlDataAdapter adp = new SqlDataAdapter(qr, con);
            DataTable      dt  = new DataTable();

            adp.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                GridViewCart.Visible    = true;
                GridViewCart.DataSource = dt;
                GridViewCart.DataBind();
            }
            else
            {
            }

            string     qr1  = "select sum(total_price) from tempcart where order_id = '" + oid + "' ";
            SqlCommand cmd1 = new SqlCommand(qr1, con);

            con.Open();
            SqlDataReader dr1 = cmd1.ExecuteReader();

            dr1.Read();
            int TotalAmount = Convert.ToInt32(dr1[0].ToString());

            lbltotalamount.Text = Convert.ToString(TotalAmount);
            con.Close();
        }
예제 #6
0
        private void random()
        {
            int count = ViewProductController.countProduct();

            if (count < 6)
            {
                var less = ViewProductController.getAllProduct();
                GridViewCart.DataSource = less.ToList();
                GridViewCart.DataBind();
            }
            else
            {
                var pr = ViewProductController.generateRandom();

                GridViewCart.DataSource = pr.ToList();
                GridViewCart.DataBind();
            }
        }
예제 #7
0
        void InitGridCart()
        {
            GridViewCart.DataSource = Session["ToyModels"];
            GridViewCart.DataBind();

            List <ToyModel> itemList = (List <ToyModel>)Session["ToyModels"];

            decimal amount = 0;

            foreach (var item in itemList)
            {
                amount += item.Amount;
            }
            allquan.Text   = itemList.Count().ToString();
            allamount.Text = amount.ToString();

            lblQuan.Visible   = false;
            txtQuan.Visible   = false;
            btnUpdate.Visible = false;
        }
예제 #8
0
        private void LoadCart()
        {
            Carts = (Dictionary <int, int>)Session["Cart"];
            if (Carts.Count > 0)
            {
                Label1.Text = "Your Cart:";
            }
            else
            {
                Label1.Text = "Cart is Empty.!";
            }
            dt.Columns.Add("ProductID", typeof(int));
            dt.Columns.Add("ProductName", typeof(string));
            dt.Columns.Add("Price", typeof(double));
            dt.Columns.Add("Quantity", typeof(int));
            dt.Columns.Add("Total", typeof(int));


            //string countryName = "USA";
            //DataTable dt = new DataTable();
            //int id = (from DataRow dr in dt.Rows
            //          where (string)dr["CountryName"] == countryName
            //          select (int)dr["id"]).FirstOrDefault();
            for (int i = 0; i < Carts.Count; i++)
            {
                int       pID       = Carts.Keys.ElementAt(i);
                Product   p         = Product.GetProductByID(pID);
                DataTable dataTable = DAO.GetProductById(pID);
                dt.Rows.Add();
                //dt.Rows[dt.Rows.Count - 1]["ProductID"] = p.ProductID;
                dt.Rows[dt.Rows.Count - 1]["ProductID"] = (from DataRow dr in dataTable.Rows
                                                           select(int) dr["ProductID"]).FirstOrDefault();
                dt.Rows[dt.Rows.Count - 1]["ProductName"] = (from DataRow dr in dataTable.Rows
                                                             select(string) dr["ProductName"]).FirstOrDefault();
                dt.Rows[dt.Rows.Count - 1]["Price"]    = p.Price;
                dt.Rows[dt.Rows.Count - 1]["Quantity"] = Carts[pID];
                dt.Rows[dt.Rows.Count - 1]["Total"]    = Carts[pID] * p.Price;
            }
            GridViewCart.DataSource = dt;
            GridViewCart.DataBind();
        }
예제 #9
0
        private void LoadCart()
        {
            Cart = (Dictionary <int, int>)Session["Cart"];

            dt.Columns.Add("ProductID", typeof(int));
            dt.Columns.Add("ProductName", typeof(string));
            dt.Columns.Add("Price", typeof(double));
            dt.Columns.Add("Quantity", typeof(int));
            dt.Columns.Add("Total", typeof(int));

            for (int i = 0; i < Cart.Count; i++)
            {
                int     pID = Cart.Keys.ElementAt(i);
                Product p   = Product.GetProductByID(pID);
                dt.Rows.Add();
                dt.Rows[dt.Rows.Count - 1]["ProductID"]   = p.ProductID;
                dt.Rows[dt.Rows.Count - 1]["ProductName"] = p.ProductName;
                dt.Rows[dt.Rows.Count - 1]["Price"]       = p.Price;
                dt.Rows[dt.Rows.Count - 1]["Quantity"]    = Cart[pID];
                dt.Rows[dt.Rows.Count - 1]["Total"]       = Cart[pID] * p.Price;
            }
            GridViewCart.DataSource = dt;
            GridViewCart.DataBind();
        }