bool RemoveShoppingCart(string itemID)
 {
     if (Session["ShoppingCart"] == null)
     {
         Literal1.Text = "Sorry, Can not remove item in your shopping cart";
     }
     else
     {
         DataTable dataTable  = (DataTable)Session["ShoppingCart"];
         Common    common     = new Common();
         int       indexOfRow = common.IsExistItemInShoppingCart(itemID, dataTable);
         if (indexOfRow != -1)
         {
             dataTable.Rows.RemoveAt(indexOfRow);
             Session["ShoppingCart"] = dataTable;
             GridItemCart.DataSource = dataTable;
             GridItemCart.DataBind();
             if (dataTable.Rows.Count == 0)
             {
                 Session.Remove("ShoppingCart");
             }
             return(true);
         }
     }
     return(false);
 }
        void UpdateShoppingCart(string itemID, string itemName, String itemPrice, string unitPrice, String quantity, int index)
        {
            if (Session["ShoppingCart"] == null)
            {
                Literal1.Text = "Sorry, Can not Update item in your shopping cart";
            }
            else
            {
                DataTable dataTable = (DataTable)Session["ShoppingCart"];

                dataTable.Rows.RemoveAt(index);
                //xoa cai bang kia và add 1 round moi theo cai gia tri nhap
                DataRow dataRow = dataTable.NewRow();
                dataRow["ID"]        = itemID;
                dataRow["Name"]      = itemName;
                dataRow["Quantity"]  = quantity;
                dataRow["Price"]     = itemPrice;
                dataRow["UnitPrice"] = unitPrice;
                dataTable.Rows.Add(dataRow);
                // add vô session
                Session["ShoppingCart"] = dataTable;
                GridItemCart.DataSource = dataTable;
                GridItemCart.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PanelErrMsgg.Visible = false;
                // If the cart does not exist yet
                if (Session["ShoppingCart"] == null)
                {
                    this.CartPanel.Visible  = false;
                    this.EmptyPanel.Visible = true;
                    PanelMsgg.Visible       = false;
                }
                // If the cart exists
                else
                {
                    PanelMsgg.Visible       = false;
                    this.CartPanel.Visible  = true;
                    this.EmptyPanel.Visible = false;
                    DataTable dataTable = (DataTable)Session["ShoppingCart"];
                    GridItemCart.DataSource = dataTable;

                    GridItemCart.DataBind();
                }
                if (Session["AccountID"] != null)
                {
                    DiscountPanel.Visible         = true;
                    PleaseLoginPanel.Visible      = false;
                    SqlDataSource2.SelectCommand += "and (ISNULL((SELECT AccountID FROM Booking where DiscountID = D.ID AND StatusID <> 3), -1)) <> " + Session["AccountID"];
                    DataView          view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
                    DataTable         dt   = view.ToTable();
                    DataRowCollection rows = dt.Rows;
                    foreach (DataRow row in rows)
                    {
                        string code  = row["Code"].ToString();
                        string value = row["Value"].ToString();
                        string id    = row["ID"].ToString();
                        DropdownListDiscount.Items.Add(new ListItem(code + " - " + value + " (%)", code));
                    }
                }
                else
                {
                    DiscountPanel.Visible    = false;
                    PleaseLoginPanel.Visible = true;
                }


                CalculatePrice();
            }
        }