protected void lvRoom_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        //to check the date cannot be past date
        if (Convert.ToDateTime(tbxCheckIn.Text) <= Convert.ToDateTime(tbxCheckOut.Text) && Convert.ToDateTime(tbxCheckIn.Text) >= DateTime.Now)
        {
            if (e.CommandName == "RoomBook") //user selects on the particular room to book
            {
                bool exist = false;
                Room r     = RoomDB.getRoom(e.CommandArgument.ToString()); //get the room id from user selection
                //initialize the checkin and checkout -- datetime
                DateTime chkin  = Convert.ToDateTime(tbxCheckIn.Text);
                DateTime chkout = Convert.ToDateTime(tbxCheckOut.Text);

                double amount;        //declare amount
                if (chkin == chkout)  //if the checkin and checkout same day
                {
                    amount = r.Price; //amount will be same
                }
                else
                {
                    int duration = Convert.ToInt32((chkout - chkin).TotalDays); //initialize the duration, to calculate how many days
                    amount = r.Price * duration;                                //calculate the price, based on how many days
                }
                //add the cartitem details for room
                CartItem     c  = new CartItem(r, chkin.ToShortDateString(), chkout.ToShortDateString(), Convert.ToDouble(amount), r.Type, (Convert.ToInt32(tbxNoRoom.Text)));
                ShoppingCart sc = (ShoppingCart)Session["cart"]; //create s shopping cart session
                if (sc == null)                                  //if shopping cart is null
                {
                    //user can add into cart item classes
                    sc = new ShoppingCart();
                    sc.RoomAdd(c);
                    lblOutput.Text = "Room added to the Shopping Cart"; //show the messages, when user already add the room
                }
                else
                {
                    List <CartItem> ci = sc.RoomCI;
                    foreach (CartItem citm in ci) //use foreach to check whether cartitem already added or not
                    {
                        if (citm.SCRoom.RoomID == r.RoomID)
                        {
                            exist = true;
                        }
                    }
                    if (exist == false)
                    {
                        sc.RoomAdd(c);
                        lblOutput.Text = "Room added to the shopping cart"; //show the message when user already add the room into cart item
                    }
                    else
                    {
                        lblOutput.Text = "You have already added this room to the shopping cart"; //to show the message, user already added this room into shopping cart
                    }
                }
                Session["cart"] = sc; //create a session for shopping cart
            }
        }
        else
        {
            lblOutput.Text = "Check-Out date cannot be earlier than Check-In date or check in date cannot be past date!"; //to show the error message when the user select the past date
        }
    }