public void InitAlernateHotelDescriptiveInfoRQ(ref WBSAPIRouterData objWBSAPIRouterData, string[] objHotelCodes)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelDescriptiveInfoRQ objHotelDescriptiveInfoRQ = new HotelDescriptiveInfoRQ();

        objHotelDescriptiveInfoRQ.RequestHeader = this.GetRequestHeader();

        objHotelDescriptiveInfoRQ.HotelCodes = objHotelCodes;
        objHotelDescriptiveInfoRQ.SendDescriptionInfo = true;
        objHotelDescriptiveInfoRQ.SendGuestRoomInfo = false;
        objHotelDescriptiveInfoRQ.SendPolicyInfo = false;
        objHotelDescriptiveInfoRQ.AreaIDs = new string[0];
        objHotelDescriptiveInfoRQ.BrandCodes = new string[0];
        objHotelDescriptiveInfoRQ.CountryCodes = new string[0];

        gwWBS.InitHotelDescriptionRQ(ref objWBSAPIRouterData, objHotelDescriptiveInfoRQ);

        return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelAvailInfo)
        {
            StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];
            DateTime dtRateGridStartDate = (DateTime)Session["RateGridStartDate"];
            DateTime dtRateGridEndDate = dtRateGridStartDate.AddDays(this.NumberDaysInRateGrid - 1);

            DateTime dtAvailCalStartDate = objStayCriteriaSelection.ArrivalDate;

            if (dtRateGridStartDate.Date < dtAvailCalStartDate.Date)
                dtAvailCalStartDate = dtRateGridStartDate;

            DateTime dtAvailCalEndDate = objStayCriteriaSelection.DepartureDate.AddDays(-1);

            if (dtRateGridEndDate.Date > dtAvailCalEndDate.Date)
                dtAvailCalEndDate = dtRateGridEndDate;

            int intAvailCalNumDays = ((TimeSpan)(dtRateGridEndDate.Date.Subtract(dtAvailCalStartDate.Date))).Days + 1;

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelAvailInfoRQ(ref wbsAPIRouterData, objStayCriteriaSelection, dtAvailCalStartDate, intAvailCalNumDays, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelAvailInfoComplete), null, false);
        }

        else if (bAsyncGetHotelAvailCalendarInfo)
        {
            StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelAvailCalendarInfoRQ(ref wbsAPIRouterData, objStayCriteriaSelection, objStayCriteriaSelection.ArrivalDate, this.NumberDaysInAvailCalendar, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelAvailCalendarInfoComplete), null, false);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    public bool ProcessReadHotelBookingRS(ref WBSAPIRouterData objWBSAPIRouterData)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelBookingReadRS objHotelBookingReadRS = gwWBS.ProcessHotelBookingRetrievalRS(ref objWBSAPIRouterData);

        Session["HotelBookingReadRS"] = objHotelBookingReadRS;

        return !this.ProcessResponseErrors(objHotelBookingReadRS.ResponseHeader);
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelSearchPropertyList)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelSearchPropertyListRQ(ref wbsAPIRouterData);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchPropertyListComplete), null, false);
          }
          else if (bAsyncGetLoginProfile)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitLoginProfileRQ(ref wbsAPIRouterData, Request.QueryString[Constants.DeeplinkParams.Account]);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(LoginProfileComplete), null, false);
          }

          else if (bAsyncGetLinkedProfile)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitLinkedProfileRQ(ref wbsAPIRouterData, strLinkedProfileIdentifier);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(LinkedProfileComplete), null, false);
          }
          else
          {
         // End async page operation

         if (!wbsIISAsyncResult.IsCompleted)
            wbsIISAsyncResult.SetComplete();
          }

          return;
    }
    public void InitBookHotelRQ(ref WBSAPIRouterData objWBSAPIRouterData, BookingAction enumBookingAction)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelAvailabilityRS objHotelAvailabilityRS = (HotelAvailabilityRS)Session["HotelAvailabilityRS"];

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

        PaymentGatewayInfo[] objPaymentGatewayInfos = (PaymentGatewayInfo[])Session[Constants.Sessions.PaymentGatewayInfos];
        PaymentGatewayInfo objPaymentGatewayInfo = (PaymentGatewayInfo)Session[Constants.Sessions.PaymentGatewayInfo];
        HotelBookingPaymentAllocation[] objHotelBookingPaymentAllocations = (HotelBookingPaymentAllocation[])Session[Constants.Sessions.HotelBookingPaymentAllocations];
        HotelPaymentRQ objHotelPaymentRQ = (HotelPaymentRQ)Session["HotelPaymentRQ"];
        HotelPaymentRS objHotelPaymentRS = (HotelPaymentRS)Session["HotelPaymentRS"];

        bool bIsOnlinePayment = WBSPGHelper.IsOnlinePayment(objPaymentGatewayInfos, objHotelBookingPaymentAllocations, objGuestDetailsEntryInfo.PaymentCardType);

        Profile[] objProfiles = (Profile[])Session["LoginProfiles"];
        bool bIsLoggedIn = (bool)Session["IsLoggedIn"];

        Profile objCompanyProfile = ProfileHelper.GetProfile(objProfiles, ProfileType.Corporation);
        Profile objAgencyProfile = ProfileHelper.GetProfile(objProfiles, ProfileType.TravelAgent);

        HotelBookingRQ objHotelBookingRQ = new HotelBookingRQ();

        objHotelBookingRQ.RequestHeader = this.GetRequestHeader();
        objHotelBookingRQ.BookingAction = enumBookingAction;

        List<HotelBookingRequestSegment> lSegments = new List<HotelBookingRequestSegment>();

        if (enumBookingAction == BookingAction.Sell || enumBookingAction == BookingAction.TestSell || enumBookingAction == BookingAction.Modify)
        {
            for (int ri = 0; ri < objStayCriteriaSelection.RoomOccupantSelections.Length; ri++)
            {
                HotelBookingRequestSegment objSegment = new HotelBookingRequestSegment();
                lSegments.Add(objSegment);

                string strRoomRefID = objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID;
                HotelRoomAvailInfo objHotelRoomAvailInfo = this.GetHotelRoomAvailInfo(objHotelAvailabilityRS.HotelRoomAvailInfos, strRoomRefID);
                RoomRateSelection objRoomRateSelection = this.GetRoomRateSelection(objRoomRateSelections, strRoomRefID);
                HotelAvailRatePlan objHotelAvailRatePlan = this.GetRatePlanInfo(objHotelRoomAvailInfo.RatePlans, objRoomRateSelection.RatePlanCode);
                AddOnPackageSelection[] objRoomAddOnPackageSelections = this.GetAddOnPackageSelections(objAddOnPackageSelections, strRoomRefID);

                objSegment.SegmentRefID = strRoomRefID;

                objSegment.HotelCode = objStayCriteriaSelection.HotelCode;
                objSegment.ChainCode = ConfigurationManager.AppSettings["HotelChainCode"];

                objSegment.ConfirmationNumber = "";

                objSegment.ArrivalDate = objStayCriteriaSelection.ArrivalDate.Date;
                objSegment.DepartureDate = objStayCriteriaSelection.DepartureDate.Date;

                objSegment.RoomTypeCode = objRoomRateSelection.RoomTypeCode;
                objSegment.RatePlanCode = objRoomRateSelection.RatePlanCode;
                objSegment.PromoCode = objStayCriteriaSelection.PromotionCode;

                objSegment.NumRooms = objStayCriteriaSelection.RoomOccupantSelections[ri].NumberRooms;
                objSegment.NumAdults = objStayCriteriaSelection.RoomOccupantSelections[ri].NumberAdults;
                objSegment.NumChildren = objStayCriteriaSelection.RoomOccupantSelections[ri].NumberChildren;

                // Enhancement: special requests section needs to be "by room" in guest details

                objSegment.NumCribs = objGuestDetailsEntryInfo.NumberCribs;
                objSegment.NumRollawaysAdult = objGuestDetailsEntryInfo.NumberRollawaysAdult;
                objSegment.NumRollawaysChild = objGuestDetailsEntryInfo.NumberRollawaysChild;
                objSegment.SpecialInstructions = objGuestDetailsEntryInfo.SpecialInstructions;

                objSegment.IsBaseOccupancyPricing = false;
                objSegment.NumBaseOccupants = 0;

                // Enhancement: arrival time needs to be "by room" in guest details

                objSegment.FlightNumber = objGuestDetailsEntryInfo.FlightNumber;

                if (objGuestDetailsEntryInfo.ArrivalTime != null && objGuestDetailsEntryInfo.ArrivalTime != "")
                {
                    DateTime dtArrivalTime;

                    if (DateTime.TryParse(objGuestDetailsEntryInfo.ArrivalTime, out dtArrivalTime))
                    {
                        objSegment.ArrivalTime = dtArrivalTime;
                        objSegment.ArrivalTimeSpecified = true;
                    }

                    else
                    {
                        objSegment.ArrivalTime = DateTime.Today.Date;
                        objSegment.ArrivalTimeSpecified = false;
                    }

                }

                else
                {
                    objSegment.ArrivalTime = DateTime.Today.Date;
                    objSegment.ArrivalTimeSpecified = false;
                }

                List<Profile> lProfiles = new List<Profile>();

                Profile objGuest = new Profile();
                lProfiles.Add(objGuest);

                objGuest.Type = ProfileType.Traveler;
                objGuest.PersonNamePrefix = objGuestDetailsEntryInfo.NamePrefix;
                objGuest.PersonFirstName = objGuestDetailsEntryInfo.FirstName;
                objGuest.PersonLastName = objGuestDetailsEntryInfo.LastName;
                objGuest.CompanyName = "";
                objGuest.Address1 = objGuestDetailsEntryInfo.Address1;
                objGuest.Address2 = objGuestDetailsEntryInfo.Address2;
                objGuest.City = objGuestDetailsEntryInfo.City;
                objGuest.StateRegion = objGuestDetailsEntryInfo.StateRegion;
                objGuest.PostalCode = objGuestDetailsEntryInfo.PostalCode;
                objGuest.Country = objGuestDetailsEntryInfo.Country;
                objGuest.Phone = objGuestDetailsEntryInfo.Phone;
                objGuest.Fax = "";
                objGuest.Email = objGuestDetailsEntryInfo.Email;
                objGuest.SubscribeToNewsletter = objGuestDetailsEntryInfo.SubscribeToNewsletter;
                objGuest.TravelPurpose = objGuestDetailsEntryInfo.TravelPurpose;

                List<ProfileIdentifier> lGuestProfileIdentifiers = new List<ProfileIdentifier>();

                if (objGuestDetailsEntryInfo.HotelProgramCode != null && objGuestDetailsEntryInfo.HotelProgramCode != "")
                {
                    ProfileIdentifier objProfileIdentifier = new ProfileIdentifier();
                    lGuestProfileIdentifiers.Add(objProfileIdentifier);

                    objProfileIdentifier.Type = ProfileIdentifierType.HotelLoyaltyProgram;
                    objProfileIdentifier.ProgramCode = objGuestDetailsEntryInfo.HotelProgramCode;
                    objProfileIdentifier.Identifier = objGuestDetailsEntryInfo.HotelProgramIdentifier;
                }

                if (objGuestDetailsEntryInfo.AirlineProgramCode != null && objGuestDetailsEntryInfo.AirlineProgramCode != "")
                {
                    ProfileIdentifier objProfileIdentifier = new ProfileIdentifier();
                    lGuestProfileIdentifiers.Add(objProfileIdentifier);

                    objProfileIdentifier.Type = ProfileIdentifierType.AirlineLoyaltyProgram;
                    objProfileIdentifier.ProgramCode = objGuestDetailsEntryInfo.AirlineProgramCode;
                    objProfileIdentifier.Identifier = objGuestDetailsEntryInfo.AirlineProgramIdentifier;
                }

                objGuest.ProfileIdentifiers = lGuestProfileIdentifiers.ToArray();

                if (objCompanyProfile != null)
                {
                    lProfiles.Add(objCompanyProfile);
                }

                else if (objGuestDetailsEntryInfo.CompanyName != null && objGuestDetailsEntryInfo.CompanyName != "")
                {
                    Profile objCompany = new Profile();
                    lProfiles.Add(objCompany);

                    objCompany.Type = ProfileType.Corporation;
                    objCompany.PersonNamePrefix = "";
                    objCompany.PersonFirstName = "";
                    objCompany.PersonLastName = "";
                    objCompany.CompanyName = objGuestDetailsEntryInfo.CompanyName;
                    objCompany.Address1 = "";
                    objCompany.Address2 = "";
                    objCompany.City = "";
                    objCompany.StateRegion = "";
                    objCompany.PostalCode = "";
                    objCompany.Country = "";
                    objCompany.Phone = "";
                    objCompany.Fax = "";
                    objCompany.Email = "";
                    objCompany.SubscribeToNewsletter = false;
                    objCompany.TravelPurpose = TravelPurpose.NotIdentified;
                    objCompany.ProfileIdentifiers = new ProfileIdentifier[0];
                }

                if (objAgencyProfile != null)
                {
                    lProfiles.Add(objAgencyProfile);
                }

                else if (objGuestDetailsEntryInfo.TravelAgencyIATA != null && objGuestDetailsEntryInfo.TravelAgencyIATA != "")
                {
                    Profile objAgency = new Profile();
                    lProfiles.Add(objAgency);

                    objAgency.Type = ProfileType.TravelAgent;
                    objAgency.PersonNamePrefix = "";
                    objAgency.PersonFirstName = "";
                    objAgency.PersonLastName = "";
                    objAgency.CompanyName = "";
                    objAgency.Address1 = "";
                    objAgency.Address2 = "";
                    objAgency.City = "";
                    objAgency.StateRegion = "";
                    objAgency.PostalCode = "";
                    objAgency.Country = "";
                    objAgency.Phone = "";
                    objAgency.Fax = "";
                    objAgency.Email = "";
                    objAgency.SubscribeToNewsletter = false;
                    objAgency.TravelPurpose = TravelPurpose.NotIdentified;

                    ProfileIdentifier objAgencyIATA = new ProfileIdentifier();
                    objAgencyIATA.Type = ProfileIdentifierType.IATA;
                    objAgencyIATA.Identifier = objGuestDetailsEntryInfo.TravelAgencyIATA;
                    objAgencyIATA.ProgramCode = "";

                    objAgency.ProfileIdentifiers = new ProfileIdentifier[1];
                    objAgency.ProfileIdentifiers[0] = objAgencyIATA;
                }

                objSegment.Profiles = lProfiles.ToArray();

                objSegment.PackageQuantities = new HotelBookingPackageQuantity[objRoomAddOnPackageSelections.Length];

                for (int i = 0; i < objRoomAddOnPackageSelections.Length; i++)
                {
                    HotelBookingPackageQuantity objHotelBookingPackageQuantity = new HotelBookingPackageQuantity();
                    objSegment.PackageQuantities[i] = objHotelBookingPackageQuantity;

                    objHotelBookingPackageQuantity.Code = objRoomAddOnPackageSelections[i].PackageCode;
                    objHotelBookingPackageQuantity.Quantity = objRoomAddOnPackageSelections[i].Quantity;
                }

                objSegment.GuaranteeType = objHotelAvailRatePlan.GuaranteeType;
                objSegment.PaymentCard = null;
                objSegment.DepositPaymentAmount = 0;
                objSegment.PaymentAuthCode = "";
                objSegment.PaymentTransRefID = "";

                if (objHotelAvailRatePlan.GuaranteeType == GuaranteeType.CCDCVoucher && objGuestDetailsEntryInfo.ProfileGuaranteeRequested)
                {
                    objSegment.GuaranteeType = GuaranteeType.Profile;
                }

                else if (objHotelAvailRatePlan.GuaranteeType == GuaranteeType.CCDCVoucher)
                {
                    HotelBookingPaymentCard objPaymentCard = new HotelBookingPaymentCard();
                    objSegment.PaymentCard = objPaymentCard;

                    objPaymentCard.PaymentCardType = objGuestDetailsEntryInfo.PaymentCardType;
                    objPaymentCard.PaymentCardNumber = objGuestDetailsEntryInfo.PaymentCardNumber;
                    objPaymentCard.PaymentCardHolder = objGuestDetailsEntryInfo.PaymentCardHolder;
                    objPaymentCard.PaymentCardEffectiveDate = objGuestDetailsEntryInfo.PaymentCardEffectiveDate;
                    objPaymentCard.PaymentCardExpireDate = objGuestDetailsEntryInfo.PaymentCardExpireDate;
                    objPaymentCard.PaymentCardIssueNumber = objGuestDetailsEntryInfo.PaymentCardIssueNumber;
                    objPaymentCard.PaymentCardSecurityCode = objGuestDetailsEntryInfo.PaymentCardSecurityCode;

                    objSegment.CurrencyCode = objHotelAvailRatePlan.DepositRequiredCurrencyCode;
                }

                else if (objHotelAvailRatePlan.GuaranteeType == GuaranteeType.Deposit || objHotelAvailRatePlan.GuaranteeType == GuaranteeType.PrePay)
                {
                    HotelBookingPaymentCard objPaymentCard = new HotelBookingPaymentCard();
                    objSegment.PaymentCard = objPaymentCard;

                    objPaymentCard.PaymentCardType = objGuestDetailsEntryInfo.PaymentCardType;
                    objPaymentCard.PaymentCardNumber = objGuestDetailsEntryInfo.PaymentCardNumber;
                    objPaymentCard.PaymentCardHolder = objGuestDetailsEntryInfo.PaymentCardHolder;
                    objPaymentCard.PaymentCardEffectiveDate = objGuestDetailsEntryInfo.PaymentCardEffectiveDate;
                    objPaymentCard.PaymentCardExpireDate = objGuestDetailsEntryInfo.PaymentCardExpireDate;
                    objPaymentCard.PaymentCardIssueNumber = objGuestDetailsEntryInfo.PaymentCardIssueNumber;
                    objPaymentCard.PaymentCardSecurityCode = objGuestDetailsEntryInfo.PaymentCardSecurityCode;

                    objSegment.CurrencyCode = objHotelAvailRatePlan.DepositRequiredCurrencyCode;

                    decimal decDepositPaymentAmount = WBSPGHelper.GetBookingSegmentPayment(objHotelBookingPaymentAllocations, strRoomRefID);

                    if (bIsOnlinePayment && decDepositPaymentAmount != 0)
                    {
                        objSegment.PaymentCard = objHotelPaymentRS.PaymentCard;
                        objSegment.DepositPaymentAmount = decDepositPaymentAmount;
                        objSegment.PaymentAuthCode = objHotelPaymentRS.PaymentAuthCode;
                        objSegment.PaymentTransRefID = objHotelPaymentRS.PaymentTransRefID;

                        objSegment.PaymentCard.PaymentCardSecurityCode = ""; // remove security code (no longer needed)
                    }

                }

            }

        }

        if (enumBookingAction == BookingAction.Cancel)
        {
            for (int ci = 0; ci < objCancelDetailsEntryInfo.SelectedConfirmationNumbersToCancel.Length; ci++)
            {
                HotelBookingRequestSegment objSegment = new HotelBookingRequestSegment();
                lSegments.Add(objSegment);

                objSegment.SegmentRefID = ((int)(ci + 1)).ToString();
                objSegment.ConfirmationNumber = objCancelDetailsEntryInfo.SelectedConfirmationNumbersToCancel[ci];
            }

        }

        objHotelBookingRQ.Segments = lSegments.ToArray();

        gwWBS.InitHotelBookingRQ(ref objWBSAPIRouterData, objHotelBookingRQ);

        return;
    }
    public bool ProcessHotelSearchPropertyListRS(ref WBSAPIRouterData objWBSAPIRouterData)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelSearchRS objHotelSearchRS = gwWBS.ProcessHotelSearchRS(ref objWBSAPIRouterData);

        Session["PropertyListHotelSearchRS"] = objHotelSearchRS;

        return !this.ProcessResponseErrors(objHotelSearchRS.ResponseHeader);
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetSearchHotelAvailCalendarInfo)
        {
            StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];
            DateTime dtSearchRateGridStartDate = (DateTime)Session["SearchRateGridStartDate"];
            HotelSearchRS objPropertyListHotelSearchRS = (HotelSearchRS)Session["PropertyListHotelSearchRS"];

            HotelListItem[] objHotelListItems = this.GetAreaHotelList(objStayCriteriaSelection.AreaID, objPropertyListHotelSearchRS.HotelListItems);

            List<string> lHotelCodes = new List<string>();

            for (int i = 0; i < objHotelListItems.Length; i++)
                lHotelCodes.Add(objHotelListItems[i].HotelCode);

            SearchHotelCodes = lHotelCodes.ToArray();

            if (SearchHotelCodes.Length != 0)
            {
                wbsAPIRouterData = new WBSAPIRouterData();
                this.WbsApiRouterHelper.InitSearchHotelAvailCalendarInfoRQ(ref wbsAPIRouterData, SearchHotelCodes, objStayCriteriaSelection, dtSearchRateGridStartDate, this.NumberDaysInRateGrid, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
                this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(SearchHotelAvailCalendarInfoComplete), null, false);
            }

            else
            {
                this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoHotelsLocatedInSearch"));

                // End async page operation

                if (!wbsIISAsyncResult.IsCompleted)
                    wbsIISAsyncResult.SetComplete();
            }

        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    public void InitReadHotelBookingRQ(ref WBSAPIRouterData objWBSAPIRouterData, string strConfirmationNumber)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelBookingReadRQ objHotelBookingReadRQ = new HotelBookingReadRQ();

        objHotelBookingReadRQ.RequestHeader = this.GetRequestHeader();

        objHotelBookingReadRQ.BookingReferenceNumberType = BookingReferenceNumberType.ConfirmationNumber;
        objHotelBookingReadRQ.BookingReferenceNumber = strConfirmationNumber;

        gwWBS.InitHotelBookingRetrievalRQ(ref objWBSAPIRouterData, objHotelBookingReadRQ);

        return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncBookHotel)
        {
            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitBookHotelRQ(ref wbsAPIRouterData, BookingAction.Cancel);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(BookHotelComplete), null, true);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelSearchPropertyList)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelSearchPropertyListRQ(ref wbsAPIRouterData);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchPropertyListComplete), null, false);
          }
          else
          {
         // End async page operation

         if (!wbsIISAsyncResult.IsCompleted)
            wbsIISAsyncResult.SetComplete();
          }

          return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelAvailCalendarInfo)
        {
            StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelAvailCalendarInfoRQ(ref wbsAPIRouterData, objStayCriteriaSelection, objStayCriteriaSelection.ArrivalDate, this.NumberDaysInAvailCalendar, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelAvailCalendarInfoComplete), null, false);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelSearchPropertyList)
        {
            string strAreaID = "";

            if (Request.QueryString.Get("area") != null)
            {
                strAreaID = Request.QueryString.Get("area");
            }

            string[] objAreaIDs = new string[0];

            if (strAreaID != "")
            {
                objAreaIDs = new string[] { strAreaID };
            }

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelSearchPropertyListRQ(ref wbsAPIRouterData, objAreaIDs);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchPropertyListComplete), null, false);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelDescriptiveInfo)
        {
            CancelDetailsEntryInfo objCancelDetailsEntryInfo = (CancelDetailsEntryInfo)Session["CancelDetailsEntryInfo"];

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelDescriptiveInfoRQ(ref wbsAPIRouterData, objCancelDetailsEntryInfo.HotelCode);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelDescriptiveInfoComplete), null, false);
        }

        else if (bAsyncReadHotelBooking)
        {
            CancelDetailsEntryInfo objCancelDetailsEntryInfo = (CancelDetailsEntryInfo)Session["CancelDetailsEntryInfo"];

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitReadHotelBookingRQ(ref wbsAPIRouterData, objCancelDetailsEntryInfo.ConfirmationNumber);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(ReadHotelBookingComplete), null, false);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    public void InitHotelSearchPropertyListRQ(ref WBSAPIRouterData objWBSAPIRouterData, string[] objAreaIDs)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelSearchRQ objHotelSearchRQ = new HotelSearchRQ();

        objHotelSearchRQ.RequestHeader = this.GetRequestHeader();

        objHotelSearchRQ.SearchAction = SearchAction.PropertyList;
        objHotelSearchRQ.BrandCodes = this.GetHotelBrandCodes();
        objHotelSearchRQ.CountryCodes = new string[0];
        objHotelSearchRQ.AreaIDs = objAreaIDs;

        gwWBS.InitHotelSearchRQ(ref objWBSAPIRouterData, objHotelSearchRQ);

        return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelSearchAreaList)
        {
            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelSearchAreaListRQ(ref wbsAPIRouterData);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchAreaListComplete), null, false);
        }

        else if (bAsyncGetHotelSearchPropertyList)
        {
            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelSearchPropertyListRQ(ref wbsAPIRouterData);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchPropertyListComplete), null, false);
        }

        else if (bAsyncGetSearchHotelDescriptiveInfo)
        {
            StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];
            HotelSearchRS objPropertyListHotelSearchRS = (HotelSearchRS)Session["PropertyListHotelSearchRS"];

            HotelListItem[] objHotelListItems = this.GetAreaHotelList(objStayCriteriaSelection.AreaID, objPropertyListHotelSearchRS.HotelListItems);

            List<string> lHotelCodes = new List<string>();

            for (int i = 0; i < objHotelListItems.Length; i++)
                lHotelCodes.Add(objHotelListItems[i].HotelCode);

            SearchHotelCodes = lHotelCodes.ToArray();

            if (SearchHotelCodes.Length != 0)
            {
                wbsAPIRouterData = new WBSAPIRouterData();
                this.WbsApiRouterHelper.InitSearchHotelDescriptiveInfoRQ(ref wbsAPIRouterData, SearchHotelCodes);
                this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(SearchHotelDescriptiveInfoComplete), null, false);
            }

            else
            {
                this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoHotelsLocatedInSearch"));

                // End async page operation

                if (!wbsIISAsyncResult.IsCompleted)
                    wbsIISAsyncResult.SetComplete();
            }

        }

        else if (bAsyncGetSearchHotelAvailCalendarInfo)
        {
            StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];

            int intNumDays;

            if (ConfigurationManager.AppSettings["EnableRoomRateGridModel"] != "1")
            {
                intNumDays = ((TimeSpan)objStayCriteriaSelection.DepartureDate.Date.Subtract(objStayCriteriaSelection.ArrivalDate.Date)).Days;
            }

            else
            {
                intNumDays = this.NumberDaysInRateGrid;
                Session["SearchRateGridStartDate"] = objStayCriteriaSelection.ArrivalDate.Date;
            }

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitSearchHotelAvailCalendarInfoRQ(ref wbsAPIRouterData, SearchHotelCodes, objStayCriteriaSelection, objStayCriteriaSelection.ArrivalDate, intNumDays, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(SearchHotelAvailCalendarInfoComplete), null, false);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    public void InitLoginProfileRQ(ref WBSAPIRouterData objWBSAPIRouterData, string strProfileLogonName)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        ProfileReadRQ objProfileReadRQ = new ProfileReadRQ();

        objProfileReadRQ.RequestHeader = this.GetRequestHeader();

        objProfileReadRQ.ReadContext = ProfileReadContext.ProfileLogonName;
        objProfileReadRQ.ReadIdentifier = strProfileLogonName;

        gwWBS.InitProfileReadRQ(ref objWBSAPIRouterData, objProfileReadRQ);

        return;
    }
    protected virtual void Page_Init(object sender, EventArgs e)
    {
        dtPageStartTime = DateTime.Now;

        if (Context.Session != null)
        {
            bool bIsNewSessionOverride = false;

            if (Context.Items["IsNewSessionOverride"] != null)
                bIsNewSessionOverride = (bool)Context.Items["IsNewSessionOverride"];

            if (Session.IsNewSession && !bIsNewSessionOverride)
            {
                Response.Redirect("~/Default.aspx");
                return;
            }

        }

        bIsProduction = XnGR_WBS_Page.IsProductionMode();

        if (ConfigurationManager.AppSettings["WBSBookingMode"] == "Production")
            bIsBookThrough = true;
        else
            bIsBookThrough = false;

        if (ConfigurationManager.AppSettings["GuestDetailsTestPrefill"] == "1")
            bIsGuestDetailsTestPrefill = true;
        else
            bIsGuestDetailsTestPrefill = false;

        bIsParentPreRender = false;
        bIsDeepLinkNav = false;

        objEventLog = (FileLog)Application["EventLog"];
        objExceptionEventLog = (ExceptionLog)Application["ExceptionEventLog"];

        wbsAPIRouter = WBSAPIRouter.GetWbsApiRouter(Context.Cache, objEventLog, objExceptionEventLog, bIsProduction, (int)Application["WBSAPIRouter.RequestExpirationSeconds"], (int)Application["WBSAPIRouter.WindowUnitSeconds"], (int)Application["WBSAPIRouter.WindowUnits"]);
        wbsAPIRouterData = null;
        wbsIISAsyncResult = null;

        wbsAPI = new WBSAPIRouterHelper(Session, Page, objEventLog, objExceptionEventLog, bIsProduction);
        wbsPG = new WBSPGHelper(Session, Page, objEventLog, objExceptionEventLog, bIsProduction);
        wbsUI = new WBSUIHelper(Session, Page);

        wbsPerfCounters = WBSPerfCounters.GetWbsPerfCounters(Context.Cache, objEventLog, objExceptionEventLog, (string)Application["WBSPerfCounters.PerformanceMonitorGroupName"]);
        wbsServiceTimesUpdater = WBSServiceTimesUpdater.GetWbsServiceTimesUpdater(Context.Cache, objEventLog, objExceptionEventLog, bIsProduction, (int)Application["WBSAPIRouter.RequestExpirationSeconds"], (int)Application["WBSAPIRouter.WindowUnitSeconds"], (int)Application["WBSAPIRouter.WindowUnits"], (string)Application["WBSPerfCounters.PerformanceMonitorGroupName"]); // retrieved only as a "keep-alive" mechanism

        wbsMonitor = WBSMonitor.GetWbsMonitor(Context.Cache, objEventLog, objExceptionEventLog, bIsProduction, (int)Application["WBSMonitor.ExpirationSeconds"]); // Used for pending prepay bookings logging

        this.InitPageErrors();

        if (!IsPostBack)
        {
            if (Request.QueryString.Get("CrossPageErrors") == "1")
                this.RestoreCrossPageErrors();

            if (Request.QueryString.Get("DeepLinkNav") == "1") // used wtih Response.Redirect
                bIsDeepLinkNav = true;

            if ((string)Context.Items["DeepLinkNav"] == "1") // used with Server.Transfer
                bIsDeepLinkNav = true;
        }

        return;
    }
    public void InitSearchHotelAvailCalendarInfoRQ(ref WBSAPIRouterData objWBSAPIRouterData, string[] objHotelCodes, StayCriteriaSelection objStayCriteriaSelection, DateTime dtAvailCalStartDate, int intAvailCalNumDays, string strLinkedProfileID)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelAvailabilityRQ objHotelAvailabilityRQ = new HotelAvailabilityRQ();

        objHotelAvailabilityRQ.RequestHeader = this.GetRequestHeader();

        objHotelAvailabilityRQ.HotelRoomAvailRequests = new HotelRoomAvailRequest[objHotelCodes.Length];

        for (int i = 0; i < objHotelCodes.Length; i++)
        {
            HotelRoomAvailRequest objHotelRoomAvailRequest = new HotelRoomAvailRequest();
            objHotelAvailabilityRQ.HotelRoomAvailRequests[i] = objHotelRoomAvailRequest;

            objHotelRoomAvailRequest.SegmentRefID = objHotelCodes[i];
            objHotelRoomAvailRequest.ReturnAlternateAvailability = false;
            objHotelRoomAvailRequest.IsModify = false;

            objHotelRoomAvailRequest.HotelCode = objHotelCodes[i];
            objHotelRoomAvailRequest.ArrivalDate = objStayCriteriaSelection.ArrivalDate;
            objHotelRoomAvailRequest.DepartureDate = objStayCriteriaSelection.DepartureDate;
            objHotelRoomAvailRequest.PromotionCode = objStayCriteriaSelection.PromotionCode;
            objHotelRoomAvailRequest.ProfileIdentifier = strLinkedProfileID;

            objHotelRoomAvailRequest.NumberRooms = objStayCriteriaSelection.RoomOccupantSelections[0].NumberRooms;
            objHotelRoomAvailRequest.NumberAdults = objStayCriteriaSelection.RoomOccupantSelections[0].NumberAdults;
            objHotelRoomAvailRequest.NumberChildren = objStayCriteriaSelection.RoomOccupantSelections[0].NumberChildren;

            objHotelRoomAvailRequest.ReturnAvailabilityCalendar = true;
            objHotelRoomAvailRequest.ReturnAvailabilityCalendarOnly = true;
            objHotelRoomAvailRequest.ReturnAvailabilityCalendarAvailRatesOnly = true;
            objHotelRoomAvailRequest.ReturnAvailabilityCalendarSummaryOnly = true;
            objHotelRoomAvailRequest.ApplyAvailabilityCalendarSummaryFilter = true;
            objHotelRoomAvailRequest.AvailCalendarStartDate = dtAvailCalStartDate;
            objHotelRoomAvailRequest.AvailCalendarNumDays = intAvailCalNumDays;

            objHotelRoomAvailRequest.RequestedPublicRatePlanCategories = new string[0];
            objHotelRoomAvailRequest.RequestedRoomTypeCodes = new string[0];
            objHotelRoomAvailRequest.RequestedSpecialRatePlanCodes = new string[0];
        }

        gwWBS.InitHotelAvailabilityRQ(ref objWBSAPIRouterData, objHotelAvailabilityRQ);

        return;
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelSearchAreaList)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelSearchAreaListRQ(ref wbsAPIRouterData);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchAreaListComplete), null, false);
          }

          else if (bAsyncGetHotelSearchPropertyList)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelSearchPropertyListRQ(ref wbsAPIRouterData);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchPropertyListComplete), null, false);
          }

          else if (bAsyncGetHotelDescriptiveInfo)
          {
         StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];

         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelDescriptiveInfoRQ(ref wbsAPIRouterData, objStayCriteriaSelection.HotelCode);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelDescriptiveInfoComplete), null, false);
          }

          else if (bAsyncGetHotelAvailInfo)
          {
         StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];

         int intAvailCalNumDays = 0;

         if (ConfigurationManager.AppSettings["EnableRoomRateGridModel"] == "1")
         {
            intAvailCalNumDays = ((TimeSpan)(objStayCriteriaSelection.DepartureDate.Date.Subtract(objStayCriteriaSelection.ArrivalDate.Date))).Days;

            if (intAvailCalNumDays < this.NumberDaysInRateGrid)
               intAvailCalNumDays = this.NumberDaysInRateGrid;

            Session["RateGridStartDate"] = objStayCriteriaSelection.ArrivalDate.Date;
         }

         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelAvailInfoRQ(ref wbsAPIRouterData, objStayCriteriaSelection, objStayCriteriaSelection.ArrivalDate, intAvailCalNumDays, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelAvailInfoComplete), null, false);
          }

          else if (bAsyncGetAlernateHotelDescriptiveInfo)
          {
         HotelAvailabilityRS objHotelAvailabilityRS = (HotelAvailabilityRS)Session["HotelAvailabilityRS"];

         List<string> lAlternateHotels = new List<string>();

         for (int i = 0; i < objHotelAvailabilityRS.HotelRoomAvailInfos.Length; i++)
         {
            if (objHotelAvailabilityRS.HotelRoomAvailInfos[i].IsAlternateAvailability)
            {
               if (!lAlternateHotels.Contains(objHotelAvailabilityRS.HotelRoomAvailInfos[i].HotelCode))
                  lAlternateHotels.Add(objHotelAvailabilityRS.HotelRoomAvailInfos[i].HotelCode);
            }

         }

         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitAlernateHotelDescriptiveInfoRQ(ref wbsAPIRouterData, lAlternateHotels.ToArray());
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(AlernateHotelDescriptiveInfoComplete), null, false);
          }

          else
          {
         // End async page operation

         if (!wbsIISAsyncResult.IsCompleted)
            wbsIISAsyncResult.SetComplete();
          }

          return;
    }
    public bool ProcessHotelAvailInfoRS(ref WBSAPIRouterData objWBSAPIRouterData)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelAvailabilityRS objHotelAvailabilityRS = gwWBS.ProcessHotelAvailabilityRS(ref objWBSAPIRouterData);

        Session["HotelAvailabilityRS"] = objHotelAvailabilityRS;
        Session["HotelAvailabilityCalendarRS"] = null;

        return !this.ProcessResponseErrors(objHotelAvailabilityRS.ResponseHeader);
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelSearchAreaList)
        {
            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelSearchAreaListRQ(ref wbsAPIRouterData);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchAreaListComplete), null, false);
        }

        else if (bAsyncGetHotelSearchPropertyList)
        {
            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelSearchPropertyListRQ(ref wbsAPIRouterData);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchPropertyListComplete), null, false);
        }

        else if (bAsyncGetLoginProfile)
        {
            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitLoginProfileRQ(ref wbsAPIRouterData, ucProfileLoginControl.ProfileLoginInfo.LogonName);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(LoginProfileComplete), null, false);
        }

        else if (bAsyncGetLinkedProfile)
        {
            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitLinkedProfileRQ(ref wbsAPIRouterData, strLinkedProfileIdentifier);
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(LinkedProfileComplete), null, false);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        return;
    }
    public bool ProcessLoginProfileRS(ref WBSAPIRouterData objWBSAPIRouterData)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        ProfileReadRS objProfileReadRS = gwWBS.ProcessProfileReadRS(ref objWBSAPIRouterData);

        Session["LoginProfileReadRS"] = objProfileReadRS;

        return !this.ProcessResponseErrors(objProfileReadRS.ResponseHeader);
    }
    private void BeginResumeAsyncDataCapture()
    {
        if (bAsyncGetHotelSearchPropertyList)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelSearchPropertyListRQ(ref wbsAPIRouterData);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelSearchPropertyListComplete), null, false);
          }

          else if (bAsyncGetHotelAvailCalendarInfo)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         DateTime availCalStart = AvailCalStartDate;
         DateTime availCalEnd = availCalStart.AddMonths(1).AddDays(12);
         TimeSpan dayInMonth = availCalEnd - availCalStart;
         this.WbsApiRouterHelper.InitHotelAvailCalendarInfoRQ(ref wbsAPIRouterData, StayCriteriaSelection, availCalStart, dayInMonth.Days, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelAvailCalendarInfoComplete), null, false);
          }

          else if (bAsyncGetHotelDescriptiveInfo)
          {
         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelDescriptiveInfoRQ(ref wbsAPIRouterData, StayCriteriaSelection.HotelCode);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelDescriptiveInfoComplete), null, false);
          }

          else if (bAsyncGetHotelAvailInfo)
          {
         DateTime dtRateGridStartDate = (DateTime)Session["RateGridStartDate"];
         DateTime dtRateGridEndDate = dtRateGridStartDate.AddDays(this.NumberDaysInRateGrid - 1);

         DateTime dtAvailCalStartDate = StayCriteriaSelection.ArrivalDate;

         if (dtRateGridStartDate.Date < dtAvailCalStartDate.Date)
            dtAvailCalStartDate = dtRateGridStartDate;

         int intAvailCalNumDays = dtRateGridEndDate.Date.Subtract(dtAvailCalStartDate.Date).Days + 1;

         if (string.IsNullOrWhiteSpace(StayCriteriaSelection.HotelCode))
            Response.Redirect(ResolveUrl("~/Pages/Default.aspx"));

         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitHotelAvailInfoRQ(ref wbsAPIRouterData, StayCriteriaSelection, dtAvailCalStartDate, intAvailCalNumDays, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, HotelAvailInfoComplete, null, false);
          }
          else if (bAsyncBookHotel)
          {
         BookingAction enumBookingAction = this.IsBookThrough ? BookingAction.Sell : BookingAction.TestSell;

         wbsAPIRouterData = new WBSAPIRouterData();
         this.WbsApiRouterHelper.InitBookHotelRQ(ref wbsAPIRouterData, enumBookingAction);
         this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(BookHotelComplete), null, true);
          }

          else
          {
         // End async page operation

         if (!wbsIISAsyncResult.IsCompleted)
            wbsIISAsyncResult.SetComplete();
          }
    }
    public bool ProcessSearchHotelDescriptiveInfoRS(ref WBSAPIRouterData objWBSAPIRouterData)
    {
        WBSAPIRouterGateway gwWBS = new WBSAPIRouterGateway(objEventLog, objExceptionEventLog, bIsProduction);

        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = gwWBS.ProcessHotelDescriptionRS(ref objWBSAPIRouterData);

        Session["SearchHotelDescriptiveInfoRS"] = objHotelDescriptiveInfoRS;

        return !this.ProcessResponseErrors(objHotelDescriptiveInfoRS.ResponseHeader);
    }
    private void BeginResumeAsyncDataCapture()
    {
        this.EventLog.Write(Page.Session.SessionID + ", enter BeginResumeAsyncDataCapture, " + DateTime.Now.ToString("MM dd yyyy HH:mm:ss.ffffff"));

        if (bAsyncGetHotelAvailInfo)
        {
            StayCriteriaSelection objStayCriteriaSelection = new StayCriteriaSelection();

            objStayCriteriaSelection.HotelCode = "XN00031";
            objStayCriteriaSelection.AreaID = "1";
            objStayCriteriaSelection.CountryCode = "AU";
            objStayCriteriaSelection.ArrivalDate = new DateTime(2009, 12, 24);
            objStayCriteriaSelection.DepartureDate = objStayCriteriaSelection.ArrivalDate.AddDays(1);
            objStayCriteriaSelection.PromotionCode = "";
            objStayCriteriaSelection.RoomOccupantSelections = new RoomOccupantSelection[1];
            objStayCriteriaSelection.RoomOccupantSelections[0] = new RoomOccupantSelection();
            objStayCriteriaSelection.RoomOccupantSelections[0].RoomRefID = "1";
            objStayCriteriaSelection.RoomOccupantSelections[0].NumberAdults = 2;
            objStayCriteriaSelection.RoomOccupantSelections[0].NumberChildren = 0;
            objStayCriteriaSelection.RoomOccupantSelections[0].NumberRooms = 1;

            int intAvailCalNumDays = 0;

            if (ConfigurationManager.AppSettings["EnableRoomRateGridModel"] == "1")
            {
                intAvailCalNumDays = this.NumberDaysInRateGrid;
            }

            wbsAPIRouterData = new WBSAPIRouterData();
            this.WbsApiRouterHelper.InitHotelAvailInfoRQ(ref wbsAPIRouterData, objStayCriteriaSelection, objStayCriteriaSelection.ArrivalDate, intAvailCalNumDays, this.WbsUiHelper.GetLoginLinkedProfileIdentifier());
            this.WbsApiRouter.QueueNewRequest(wbsAPIRouterData, new AsyncCallback(HotelAvailInfoComplete), null, false);
        }

        else
        {
            // End async page operation

            if (!wbsIISAsyncResult.IsCompleted)
                wbsIISAsyncResult.SetComplete();
        }

        this.EventLog.Write(Page.Session.SessionID + ", exit BeginResumeAsyncDataCapture, " + DateTime.Now.ToString("MM dd yyyy HH:mm:ss.ffffff"));

        return;
    }