private void BookRoom()
    {
        bAsyncBookHotel = true;
          if (WBSPGHelper.IsOnlinePayment(PaymentGatewayInfos, HotelBookingPaymentAllocations, GuestDetailsEntryInfo.PaymentCardType))
          {
         bPrepayBooking = true;

         HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

         if (HotelDescriptiveInfoRS.HotelDescriptiveInfos.Length != 0)
         {
            objHotelDescriptiveInfo = HotelDescriptiveInfoRS.HotelDescriptiveInfos[0];
         }

         HotelPaymentRQ objHotelPaymentRQ = (HotelPaymentRQ)Session["HotelPaymentRQ"];
         HotelPaymentRS objHotelPaymentRS = (HotelPaymentRS)Session["HotelPaymentRS"];

         string strFailedPrepayBookingID = Guid.NewGuid().ToString();

         FailedPrepayBookingInfo objFailedPrepayBookingInfo = new FailedPrepayBookingInfo
                                                                  {
                                                                     PostingDateTime = DateTime.Now,
                                                                     HotelName = objHotelDescriptiveInfo.HotelName,
                                                                     StayCriteria = StayCriteriaSelection,
                                                                     RoomRates = RoomRateSelections,
                                                                     AddOnPackages = AddOnPackageSelections,
                                                                     GuestDetails = GuestDetailsEntryInfo,
                                                                     PaymentRequestInfo = objHotelPaymentRQ,
                                                                     PaymentResponseInfo = objHotelPaymentRS
                                                                  };

         Session["FailedPrepayBookingID"] = strFailedPrepayBookingID;
         Session["FailedPrepayBookingInfo"] = objFailedPrepayBookingInfo;

         string strFailedPrepayBookingInfo = XHS.WBSUIBizObjects.Serializer.ToString(objFailedPrepayBookingInfo);

         this.WbsMonitor.AddItem(strFailedPrepayBookingID, strFailedPrepayBookingInfo);
          }
          PageAsyncTask task = new PageAsyncTask(BeginAsyncOperation, EndAsyncOperation, TimeoutAsyncOperation, null);
          RegisterAsyncTask(task);
    }
    protected override void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);

        bAsyncBookHotel = false;
        bPrepayBooking = false;

        PaymentGatewayInfo[] objPaymentGatewayInfos = (PaymentGatewayInfo[])Session[Constants.Sessions.PaymentGatewayInfos];
        PaymentGatewayInfo objPaymentGatewayInfo = (PaymentGatewayInfo)Session[Constants.Sessions.PaymentGatewayInfo];
        HotelBookingPaymentAllocation[] objHotelBookingPaymentAllocations = (HotelBookingPaymentAllocation[])Session[Constants.Sessions.HotelBookingPaymentAllocations];
        GuestDetailsEntryInfo objGuestDetailsEntryInfo = (GuestDetailsEntryInfo)Session["GuestDetailsEntryInfo"];

        if (WBSPGHelper.IsOnlinePayment(objPaymentGatewayInfos, objHotelBookingPaymentAllocations, objGuestDetailsEntryInfo.PaymentCardType))
        {
            bPrepayBooking = true;

            StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];
            RoomRateSelection[] objRoomRateSelections = (RoomRateSelection[])Session["RoomRateSelections"];
            AddOnPackageSelection[] objAddOnPackageSelections = (AddOnPackageSelection[])Session["AddOnPackageSelections"];

            HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];

            HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

            if (objHotelDescriptiveInfoRS.HotelDescriptiveInfos.Length != 0)
            {
                objHotelDescriptiveInfo = objHotelDescriptiveInfoRS.HotelDescriptiveInfos[0];
            }

            HotelPaymentRQ objHotelPaymentRQ = (HotelPaymentRQ)Session["HotelPaymentRQ"];
            HotelPaymentRS objHotelPaymentRS = (HotelPaymentRS)Session["HotelPaymentRS"];

            string strFailedPrepayBookingID = Guid.NewGuid().ToString();

            FailedPrepayBookingInfo objFailedPrepayBookingInfo = new FailedPrepayBookingInfo();
            objFailedPrepayBookingInfo.PostingDateTime = DateTime.Now;
            objFailedPrepayBookingInfo.HotelName = objHotelDescriptiveInfo.HotelName;
            objFailedPrepayBookingInfo.StayCriteria = objStayCriteriaSelection;
            objFailedPrepayBookingInfo.RoomRates = objRoomRateSelections;
            objFailedPrepayBookingInfo.AddOnPackages = objAddOnPackageSelections;
            objFailedPrepayBookingInfo.GuestDetails = objGuestDetailsEntryInfo;
            objFailedPrepayBookingInfo.PaymentRequestInfo = objHotelPaymentRQ;
            objFailedPrepayBookingInfo.PaymentResponseInfo = objHotelPaymentRS;

            Session["FailedPrepayBookingID"] = strFailedPrepayBookingID;
            Session["FailedPrepayBookingInfo"] = objFailedPrepayBookingInfo;

            string strFailedPrepayBookingInfo = XHS.WBSUIBizObjects.Serializer.ToString(objFailedPrepayBookingInfo);

            this.WbsMonitor.AddItem(strFailedPrepayBookingID, strFailedPrepayBookingInfo);
        }

        bAsyncBookHotel = true;

        PageAsyncTask task = new PageAsyncTask(new BeginEventHandler(BeginAsyncOperation), new EndEventHandler(EndAsyncOperation), new EndEventHandler(TimeoutAsyncOperation), null);
        RegisterAsyncTask(task);

        return;
    }