protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                BookingComponent bookServ = new BookingComponent();

                Booking detail = new Booking();

                detail.ID = 0;
                detail.IsCanceled = false;
                //detail.UserID = 3;
                detail.UserID = 3;
                detail.StartDate = calStartDate.SelectedDate;
                detail.EndDate = calEndDate.SelectedDate;

                if (ddlRoom.SelectedIndex > 0)
                    detail.RoomID = int.Parse(ddlRoom.SelectedValue);

                if (lstSelectedAsset.Items.Count > 0)
                {
                    //detail.AssetBooked = new List<AssetBooking>();

                    foreach (ListItem selectedItem in lstSelectedAsset.Items)
                    {
                        AssetBooking bookAsset = new AssetBooking();
                        bookAsset.Status = true;
                        bookAsset.AssetID = int.Parse(selectedItem.Value);

                        detail.AssetBookings.Add(bookAsset);
                    }
                }

                bookServ.Save(detail);

                lblMessage.Text = "Booking created successful, your reference number is <b>" + detail.RefNum + "</b>"; 
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Fail to create booking. " + ex.Message;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                BookingComponent bookServ = new BookingComponent();

                Booking detail = new Booking();

                detail.ID = int.Parse(lblID.Text);
                detail.IsCanceled = false;
                //detail.UserID = 3;
                detail.UserID = 3;
                detail.RefNum = txtRefNum.Text.Trim();
                detail.StartDate = calStartDate.SelectedDate;
                detail.EndDate = calEndDate.SelectedDate;

                if (ddlRoom.SelectedIndex > 0)
                    detail.RoomID = int.Parse(ddlRoom.SelectedValue);
                else
                    detail.RoomID = 0;

                if (lstSelectedAsset.Items.Count > 0)
                {
                    //detail.AssetBooked = new List<AssetBooking>();

                    foreach (ListItem selectedItem in lstSelectedAsset.Items)
                    {
                        AssetBooking bookAsset = new AssetBooking();
                        bookAsset.Status = true;
                        bookAsset.AssetID = int.Parse(selectedItem.Value);

                        detail.AssetBookings.Add(bookAsset);
                    }
                }

                bookServ.Save(detail);
                lblMessage.Text = "Update successful";
            }
            catch (Exception)
            {
                lblMessage.Text = "Update fail";
            }
        }