public void Page_PreRenderComplete(object sender, EventArgs e)
    {
        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();
        objHotelDescriptiveInfo.Descriptions = new HotelDescription[0];

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

        string strHelpInfoMessage = "";

        for (int i = 0; i < objHotelDescriptiveInfo.Descriptions.Length; i++)
        {
            if (objHotelDescriptiveInfo.Descriptions[i].CategoryCode == HotelDescriptionCategoryCode.MiscellaneousInformation && objHotelDescriptiveInfo.Descriptions[i].MiscCategoryReferenceCode.ToLower().Trim() == _HelpCode.ToLower().Trim())
            {
                strHelpInfoMessage = objHotelDescriptiveInfo.Descriptions[i].ContentText;
                break;
            }

        }

        if (strHelpInfoMessage == "")
        {
            strHelpInfoMessage = (String)GetGlobalResourceObject("HelpResources", _HelpCode);
        }

        lblHelpInfoMessage.Text = strHelpInfoMessage;
        ibHelpInfo.Attributes.Add("Onclick", "return hs.htmlExpand(this, { contentId: '" + this.ClientID + "_HelpInfoPopup'} )");

        return;
    }
    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;
    }
    protected override void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);

        PaymentGatewayInfo objPaymentGatewayInfo = (PaymentGatewayInfo)Session[Constants.Sessions.PaymentGatewayInfo];
        HotelBookingPaymentAllocation[] objHotelBookingPaymentAllocations = (HotelBookingPaymentAllocation[])Session[Constants.Sessions.HotelBookingPaymentAllocations];
        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];

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

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

        HotelPaymentRQ objHotelPaymentRQ = WBSPGHelper.GetHotelPaymentRQ(objPaymentGatewayInfo, objHotelBookingPaymentAllocations, objHotelDescriptiveInfo, objGuestDetailsEntryInfo, WbsUiHelper.SelectedCulture, WbsUiHelper.SelectedUICulture);
        Session["HotelPaymentRQ"] = objHotelPaymentRQ;
        Session["HotelPaymentRS"] = null;

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

        PendingPrepayBookingInfo objPendingPrepayBookingInfo = new PendingPrepayBookingInfo();
        objPendingPrepayBookingInfo.PostingDateTime = DateTime.Now;
        objPendingPrepayBookingInfo.HotelName = objHotelDescriptiveInfo.HotelName;
        objPendingPrepayBookingInfo.StayCriteria = objStayCriteriaSelection;
        objPendingPrepayBookingInfo.RoomRates = objRoomRateSelections;
        objPendingPrepayBookingInfo.AddOnPackages = objAddOnPackageSelections;
        objPendingPrepayBookingInfo.GuestDetails = objGuestDetailsEntryInfo;
        objPendingPrepayBookingInfo.PaymentRequestInfo = objHotelPaymentRQ;

        Session["PendingPrepayBookingID"] = strPendingPrepayBookingID;
        Session["PendingPrepayBookingInfo"] = objPendingPrepayBookingInfo;

        string strPendingPrepayBookingInfo = Serializer.ToString(objPendingPrepayBookingInfo);

        this.WbsMonitor.AddItem(strPendingPrepayBookingID, strPendingPrepayBookingInfo);

        Session["PaymentGatewayRequestActive"] = true;
        Session["PaymentGatewayResponseActive"] = false;

        this.PageComplete();

        Response.Redirect(objPaymentGatewayInfo.SubmitPaymentURL);

        return;
    }
    protected void ConfigureRoomRateSelectControl()
    {
        string strSelectedRoom = (string)Session["SelectedRoom"];

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

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

        ShowMoreRatesIndicator[] objShowMoreRatesIndicators = (ShowMoreRatesIndicator[])Session["ShowMoreRatesIndicators"];

        RoomOccupantSelection objRoomOccupantSelection = new RoomOccupantSelection();

        bool IsRoomRateDescriptionModel;

        if (ConfigurationManager.AppSettings["EnableRoomRateDescriptionModel"] == "1")
            IsRoomRateDescriptionModel = true;
        else
            IsRoomRateDescriptionModel = false;

        for (int i = 0; i < objStayCriteriaSelection.RoomOccupantSelections.Length; i++)
        {
            if (objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID == strSelectedRoom)
            {
                objRoomOccupantSelection = objStayCriteriaSelection.RoomOccupantSelections[i];
                break;
            }

        }

        RoomRateSelection objRoomRateSelection = new RoomRateSelection();

        for (int i = 0; i < objRoomRateSelections.Length; i++)
        {
            if (objRoomRateSelections[i].RoomRefID == strSelectedRoom)
            {
                objRoomRateSelection = objRoomRateSelections[i];
                break;
            }

        }

        HotelRoomAvailInfo objHotelRoomAvailInfo = new HotelRoomAvailInfo();

        for (int i = 0; i < objHotelAvailabilityRS.HotelRoomAvailInfos.Length; i++)
        {
            if (objHotelAvailabilityRS.HotelRoomAvailInfos[i].SegmentRefID == strSelectedRoom)
            {
                objHotelRoomAvailInfo = objHotelAvailabilityRS.HotelRoomAvailInfos[i];
                break;
            }

        }

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

        if (ConfigurationManager.AppSettings["EnableRoomRateGridModel"] != "1")
        {
            string strRoomSelectorItemControlPath = ConfigurationManager.AppSettings["RoomSelectorItemControl.ascx"];
            string strRoomTypeSelectorItemControlPath = ConfigurationManager.AppSettings["RoomTypeSelectorItemControl.ascx"];
            string strRatePlanSelectorItemControlPath = ConfigurationManager.AppSettings["RatePlanSelectorItemControl.ascx"];

            ucRoomRateSelectorControl.Clear();

            ucRoomRateSelectorControl.ID = "RoomRateSelector";
            ucRoomRateSelectorControl.RoomRefID = strSelectedRoom;
            ucRoomRateSelectorControl.HotelRoomAvailInfo = objHotelRoomAvailInfo;
            ucRoomRateSelectorControl.RoomOccupantSelection = objRoomOccupantSelection;

            for (int i = 0; i < objStayCriteriaSelection.RoomOccupantSelections.Length; i++)
            {
                RoomSelectorItemControl ucRoomSelectorItemControl = (RoomSelectorItemControl)LoadControl(strRoomSelectorItemControlPath);
                ucRoomRateSelectorControl.AddRoomSelectorItem(ucRoomSelectorItemControl);

                ucRoomSelectorItemControl.ID = "RoomSelectorItem" + objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;
                ucRoomSelectorItemControl.RoomRefID = objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;
                ucRoomSelectorItemControl.RoomRefIDMenuText = (String)GetGlobalResourceObject("SiteResources", "RoomSelectorMenuText") + " " + objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;

                if (objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID == strSelectedRoom)
                    ucRoomSelectorItemControl.Selected = true;
                else
                    ucRoomSelectorItemControl.Selected = false;
            }

            if (objHotelRoomAvailInfo.RoomTypes != null)
            {
                for (int i = 0; i < objHotelRoomAvailInfo.RoomTypes.Length; i++)
                {
                    bool bRatesAvailable = false;

                    for (int j = 0; j < objHotelRoomAvailInfo.RoomRates.Length; j++)
                    {
                        if (objHotelRoomAvailInfo.RoomRates[j].RoomTypeCode == objHotelRoomAvailInfo.RoomTypes[i].Code)
                        {
                            if (!IsRoomRateDescriptionModel)
                            {
                                bRatesAvailable = true;
                                break;
                            }

                            else
                            {
                                if (objHotelRoomAvailInfo.RoomRates[j].DescriptionStatus == RoomRateDescriptionStatus.Active)
                                {
                                    bRatesAvailable = true;
                                    break;
                                }

                                for (int k = 0; k < objHotelRoomAvailInfo.RatePlans.Length; k++)
                                {
                                    if (objHotelRoomAvailInfo.RatePlans[k].Code == objHotelRoomAvailInfo.RoomRates[j].RatePlanCode)
                                    {
                                        if (objHotelRoomAvailInfo.RatePlans[k].Type == RatePlanType.Negotiated || objHotelRoomAvailInfo.RatePlans[k].Type == RatePlanType.Consortia)
                                        {
                                            bRatesAvailable = true;
                                        }

                                        break;
                                    }

                                }

                                if (bRatesAvailable)
                                    break;
                            }

                        }

                    }

                    if (!bRatesAvailable)
                        continue;

                    RoomTypeSelectorItemControl ucRoomTypeSelectorItemControl = (RoomTypeSelectorItemControl)LoadControl(strRoomTypeSelectorItemControlPath);
                    ucRoomRateSelectorControl.AddRoomTypeSelectorItem(ucRoomTypeSelectorItemControl);

                    ucRoomTypeSelectorItemControl.ID = "RoomTypeSelectorItem" + objHotelRoomAvailInfo.RoomTypes[i].Code;
                    ucRoomTypeSelectorItemControl.RoomRefID = strSelectedRoom;

                    for (int j = 0; j < objHotelDescriptiveInfo.RoomTypes.Length; j++)
                    {
                        if (objHotelDescriptiveInfo.RoomTypes[j].Code == objHotelRoomAvailInfo.RoomTypes[i].Code)
                        {
                            ucRoomTypeSelectorItemControl.RoomType = objHotelDescriptiveInfo.RoomTypes[j];
                            break;
                        }

                    }

                    ucRoomTypeSelectorItemControl.ShowMoreRates = false;

                    for (int j = 0; j < objShowMoreRatesIndicators.Length; j++)
                    {
                        if (objShowMoreRatesIndicators[j].RoomRefID == ucRoomTypeSelectorItemControl.RoomRefID && objShowMoreRatesIndicators[j].RoomTypeCode == ucRoomTypeSelectorItemControl.RoomType.Code)
                        {
                            ucRoomTypeSelectorItemControl.ShowMoreRates = true;
                            break;
                        }

                    }

                    ucRoomTypeSelectorItemControl.Clear();

                    for (int k = 0; k < objHotelRoomAvailInfo.RoomRates.Length; k++)
                    {
                        if (objHotelRoomAvailInfo.RoomRates[k].RoomTypeCode == ucRoomTypeSelectorItemControl.RoomType.Code)
                        {
                            bool bListRatePlan = true;

                            if (IsRoomRateDescriptionModel && objHotelRoomAvailInfo.RoomRates[k].DescriptionStatus == RoomRateDescriptionStatus.Inactive)
                            {
                                for (int l = 0; l < objHotelRoomAvailInfo.RatePlans.Length; l++)
                                {
                                    if (objHotelRoomAvailInfo.RatePlans[l].Code == objHotelRoomAvailInfo.RoomRates[k].RatePlanCode)
                                    {
                                        if (objHotelRoomAvailInfo.RatePlans[l].Type != RatePlanType.Negotiated && objHotelRoomAvailInfo.RatePlans[l].Type != RatePlanType.Consortia)
                                        {
                                            bListRatePlan = false;
                                        }

                                        break;
                                    }

                                }

                            }

                            if (!bListRatePlan)
                                continue;

                            RatePlanSelectorItemControl ucRatePlanSelectorItemControl = (RatePlanSelectorItemControl)LoadControl(strRatePlanSelectorItemControlPath);
                            ucRoomTypeSelectorItemControl.AddRatePlanSelectorItem(ucRatePlanSelectorItemControl);

                            ucRatePlanSelectorItemControl.ID = "RatePlanSelectorItem" + objHotelRoomAvailInfo.RoomRates[k].RatePlanCode;
                            ucRatePlanSelectorItemControl.RoomRefID = strSelectedRoom;
                            ucRatePlanSelectorItemControl.RoomRate = objHotelRoomAvailInfo.RoomRates[k];
                            ucRatePlanSelectorItemControl.CreditCardCodes = objHotelDescriptiveInfo.CreditCardCodes;
                            ucRatePlanSelectorItemControl.Selected = false;

                            for (int m = 0; m < objHotelRoomAvailInfo.RatePlans.Length; m++)
                            {
                                if (objHotelRoomAvailInfo.RatePlans[m].Code == objHotelRoomAvailInfo.RoomRates[k].RatePlanCode)
                                {
                                    ucRatePlanSelectorItemControl.RatePlan = objHotelRoomAvailInfo.RatePlans[m];
                                    break;
                                }

                            }

                            if (objRoomRateSelection.RoomTypeCode == ucRatePlanSelectorItemControl.RoomRate.RoomTypeCode && objRoomRateSelection.RatePlanCode == ucRatePlanSelectorItemControl.RoomRate.RatePlanCode)
                                ucRatePlanSelectorItemControl.Selected = true;
                        }

                    }

                }

            }

        }

        else
        {
            AvailabilityCalendar objAvailabilityCalendar = new AvailabilityCalendar();

            for (int i = 0; i < objHotelAvailabilityRS.HotelRoomAvailInfos.Length; i++)
            {
                if (objHotelAvailabilityRS.HotelRoomAvailInfos[i].SegmentRefID == strSelectedRoom)
                {
                    objAvailabilityCalendar = objHotelAvailabilityRS.HotelRoomAvailInfos[i].AvailabilityCalendar;
                    break;
                }

            }

            DateTime dtRateGridStartDate = (DateTime)Session["RateGridStartDate"];

            string strRoomSelectorItemControlPath = ConfigurationManager.AppSettings["RoomSelectorItemControl.ascx"];
            string strRoomTypeSelectorGridItemControlPath = ConfigurationManager.AppSettings["RoomTypeSelectorGridItemControl.ascx"];
            string strRatePlanSelectorGridItemControlPath = ConfigurationManager.AppSettings["RatePlanSelectorGridItemControl.ascx"];

            ucRoomRateSelectorGridControl.Clear();

            ucRoomRateSelectorGridControl.ID = "RoomRateSelector";
            ucRoomRateSelectorGridControl.RoomRefID = strSelectedRoom;
            ucRoomRateSelectorGridControl.HotelRoomAvailInfo = objHotelRoomAvailInfo;
            ucRoomRateSelectorGridControl.RoomOccupantSelection = objRoomOccupantSelection;
            ucRoomRateSelectorGridControl.GridTodayDate = TZNet.ToLocal(WbsUiHelper.GetTimeZone(objStayCriteriaSelection.HotelCode), DateTime.UtcNow).Date;
            ucRoomRateSelectorGridControl.GridStartDate = dtRateGridStartDate.Date;
            ucRoomRateSelectorGridControl.GridNumberDays = this.NumberDaysInRateGrid;

            for (int i = 0; i < objStayCriteriaSelection.RoomOccupantSelections.Length; i++)
            {
                RoomSelectorItemControl ucRoomSelectorItemControl = (RoomSelectorItemControl)LoadControl(strRoomSelectorItemControlPath);
                ucRoomRateSelectorGridControl.AddRoomSelectorItem(ucRoomSelectorItemControl);

                ucRoomSelectorItemControl.ID = "RoomSelectorItem" + objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;
                ucRoomSelectorItemControl.RoomRefID = objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;
                ucRoomSelectorItemControl.RoomRefIDMenuText = (String)GetGlobalResourceObject("SiteResources", "RoomSelectorMenuText") + " " + objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;

                if (objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID == strSelectedRoom)
                    ucRoomSelectorItemControl.Selected = true;
                else
                    ucRoomSelectorItemControl.Selected = false;
            }

            if (objHotelRoomAvailInfo.RoomTypes != null && objAvailabilityCalendar.RoomRates != null)
            {
                for (int i = 0; i < objHotelRoomAvailInfo.RoomTypes.Length; i++)
                {
                    bool bRatesAvailable = false;

                    for (int j = 0; j < objAvailabilityCalendar.RoomRates.Length; j++)
                    {
                        if (objAvailabilityCalendar.RoomRates[j].RoomTypeCode == objHotelRoomAvailInfo.RoomTypes[i].Code)
                        {
                            if (!IsRoomRateDescriptionModel)
                            {
                                bRatesAvailable = true;
                                break;
                            }

                            else
                            {
                                if (objAvailabilityCalendar.RoomRates[j].DescriptionStatus == RoomRateDescriptionStatus.Active)
                                {
                                    bRatesAvailable = true;
                                    break;
                                }

                                for (int k = 0; k < objHotelRoomAvailInfo.RatePlans.Length; k++)
                                {
                                    if (objHotelRoomAvailInfo.RatePlans[k].Code == objAvailabilityCalendar.RoomRates[j].RatePlanCode)
                                    {
                                        if (objHotelRoomAvailInfo.RatePlans[k].Type == RatePlanType.Negotiated || objHotelRoomAvailInfo.RatePlans[k].Type == RatePlanType.Consortia)
                                        {
                                            bRatesAvailable = true;
                                        }

                                        break;
                                    }

                                }

                                if (bRatesAvailable)
                                    break;
                            }

                        }

                    }

                    if (!bRatesAvailable)
                        continue;

                    RoomTypeSelectorGridItemControl ucRoomTypeSelectorGridItemControl = (RoomTypeSelectorGridItemControl)LoadControl(strRoomTypeSelectorGridItemControlPath);
                    ucRoomRateSelectorGridControl.AddRoomTypeSelectorGridItem(ucRoomTypeSelectorGridItemControl);

                    ucRoomTypeSelectorGridItemControl.ID = "RoomTypeSelectorItem" + objHotelRoomAvailInfo.RoomTypes[i].Code;
                    ucRoomTypeSelectorGridItemControl.RoomRefID = strSelectedRoom;
                    ucRoomTypeSelectorGridItemControl.GridTodayDate = ucRoomRateSelectorGridControl.GridTodayDate;
                    ucRoomTypeSelectorGridItemControl.GridStartDate = ucRoomRateSelectorGridControl.GridStartDate;
                    ucRoomTypeSelectorGridItemControl.GridNumberDays = ucRoomRateSelectorGridControl.GridNumberDays;
                    ucRoomTypeSelectorGridItemControl.GridSelectedStartDate = objStayCriteriaSelection.ArrivalDate;
                    ucRoomTypeSelectorGridItemControl.GridSelectedEndDate = objStayCriteriaSelection.DepartureDate.AddDays(-1);

                    for (int j = 0; j < objHotelDescriptiveInfo.RoomTypes.Length; j++)
                    {
                        if (objHotelDescriptiveInfo.RoomTypes[j].Code == objHotelRoomAvailInfo.RoomTypes[i].Code)
                        {
                            ucRoomTypeSelectorGridItemControl.RoomType = objHotelDescriptiveInfo.RoomTypes[j];
                            break;
                        }

                    }

                    ucRoomTypeSelectorGridItemControl.ShowMoreRates = false;

                    for (int j = 0; j < objShowMoreRatesIndicators.Length; j++)
                    {
                        if (objShowMoreRatesIndicators[j].RoomRefID == ucRoomTypeSelectorGridItemControl.RoomRefID && objShowMoreRatesIndicators[j].RoomTypeCode == ucRoomTypeSelectorGridItemControl.RoomType.Code)
                        {
                            ucRoomTypeSelectorGridItemControl.ShowMoreRates = true;
                            break;
                        }

                    }

                    ucRoomTypeSelectorGridItemControl.Clear();

                    for (int k = 0; k < objAvailabilityCalendar.RoomRates.Length; k++)
                    {
                        if (objAvailabilityCalendar.RoomRates[k].RoomTypeCode == ucRoomTypeSelectorGridItemControl.RoomType.Code)
                        {
                            bool bListRatePlan = true;

                            if (IsRoomRateDescriptionModel && objAvailabilityCalendar.RoomRates[k].DescriptionStatus == RoomRateDescriptionStatus.Inactive)
                            {
                                for (int l = 0; l < objHotelRoomAvailInfo.RatePlans.Length; l++)
                                {
                                    if (objHotelRoomAvailInfo.RatePlans[l].Code == objAvailabilityCalendar.RoomRates[k].RatePlanCode)
                                    {
                                        if (objHotelRoomAvailInfo.RatePlans[l].Type != RatePlanType.Negotiated && objHotelRoomAvailInfo.RatePlans[l].Type != RatePlanType.Consortia)
                                        {
                                            bListRatePlan = false;
                                        }

                                        break;
                                    }

                                }

                            }

                            if (!bListRatePlan)
                                continue;

                            RatePlanSelectorGridItemControl ucRatePlanSelectorGridItemControl = (RatePlanSelectorGridItemControl)LoadControl(strRatePlanSelectorGridItemControlPath);
                            ucRoomTypeSelectorGridItemControl.AddRatePlanSelectorGridItem(ucRatePlanSelectorGridItemControl);

                            ucRatePlanSelectorGridItemControl.ID = "RatePlanSelectorItem" + objAvailabilityCalendar.RoomRates[k].RatePlanCode;
                            ucRatePlanSelectorGridItemControl.RoomRefID = strSelectedRoom;
                            ucRatePlanSelectorGridItemControl.GridStartDate = ucRoomTypeSelectorGridItemControl.GridStartDate;
                            ucRatePlanSelectorGridItemControl.GridNumberDays = ucRoomTypeSelectorGridItemControl.GridNumberDays;
                            ucRatePlanSelectorGridItemControl.GridRoomRate = objAvailabilityCalendar.RoomRates[k];
                            ucRatePlanSelectorGridItemControl.GridRoomRateStartDate = objAvailabilityCalendar.StartDate.Date;
                            ucRatePlanSelectorGridItemControl.ArrivalDate = objStayCriteriaSelection.ArrivalDate.Date;
                            ucRatePlanSelectorGridItemControl.TotalStayNights = ((TimeSpan)(objStayCriteriaSelection.DepartureDate.Date.Subtract(objStayCriteriaSelection.ArrivalDate.Date))).Days;
                            ucRatePlanSelectorGridItemControl.CreditCardCodes = objHotelDescriptiveInfo.CreditCardCodes;
                            ucRatePlanSelectorGridItemControl.Available = false;
                            ucRatePlanSelectorGridItemControl.Selected = false;

                            for (int m = 0; m < objHotelRoomAvailInfo.RatePlans.Length; m++)
                            {
                                if (objHotelRoomAvailInfo.RatePlans[m].Code == objAvailabilityCalendar.RoomRates[k].RatePlanCode)
                                {
                                    ucRatePlanSelectorGridItemControl.RatePlan = objHotelRoomAvailInfo.RatePlans[m];
                                    break;
                                }

                            }

                            for (int m = 0; m < objHotelRoomAvailInfo.RoomRates.Length; m++)
                            {
                                if (objHotelRoomAvailInfo.RoomRates[m].RoomTypeCode == objAvailabilityCalendar.RoomRates[k].RoomTypeCode && objHotelRoomAvailInfo.RoomRates[m].RatePlanCode == objAvailabilityCalendar.RoomRates[k].RatePlanCode)
                                {
                                    ucRatePlanSelectorGridItemControl.Available = true;
                                    ucRatePlanSelectorGridItemControl.RoomRate = objHotelRoomAvailInfo.RoomRates[m];
                                    break;
                                }

                            }

                            for (int m = 0; m < objAvailabilityCalendar.RatePlans.Length; m++)
                            {
                                if (objAvailabilityCalendar.RatePlans[m].RatePlanCode == objAvailabilityCalendar.RoomRates[k].RatePlanCode)
                                {
                                    ucRatePlanSelectorGridItemControl.GridRatePlan = objAvailabilityCalendar.RatePlans[m];
                                    break;
                                }

                            }

                            if (objRoomRateSelection.RoomTypeCode == objAvailabilityCalendar.RoomRates[k].RoomTypeCode && objRoomRateSelection.RatePlanCode == objAvailabilityCalendar.RoomRates[k].RatePlanCode)
                                ucRatePlanSelectorGridItemControl.Selected = true;
                        }

                    }

                }

            }

        }

        return;
    }
    private void ConfigureStaySelectorControl()
    {
        StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];
        HotelSearchRS objAreaListHotelSearchRS = (HotelSearchRS)Session["AreaListHotelSearchRS"];
        HotelSearchRS objPropertyListHotelSearchRS = (HotelSearchRS)Session["PropertyListHotelSearchRS"];
        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];

        CountryListItem[] objCountryListItems = new CountryListItem[0];
        AreaListItem[] objAreaListItems = new AreaListItem[0];
        HotelListItem[] objHotelListItems = new HotelListItem[0];

        if (ConfigurationManager.AppSettings["EnableHotelSearch"] == "1")
        {
            objCountryListItems = this.GetCountryList(objAreaListHotelSearchRS.AreaListItems);
            objAreaListItems = this.GetCountryAreaList(objStayCriteriaSelection.CountryCode, objAreaListHotelSearchRS.AreaListItems);
            objHotelListItems = this.GetAreaHotelList(objStayCriteriaSelection.AreaID, objPropertyListHotelSearchRS.HotelListItems);
        }

        else
        {
            objHotelListItems = objPropertyListHotelSearchRS.HotelListItems;
        }

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

        ucStayCriteriaControl.Clear();

        ucStayCriteriaControl.ID = "StayCriteriaSelector";

        if (ConfigurationManager.AppSettings["EnableHotelSearch"] == "1")
            ucStayCriteriaControl.StayCriteriaSelectorType = StayCriteriaSelectorType.HotelSearch;
        else
            ucStayCriteriaControl.StayCriteriaSelectorType = StayCriteriaSelectorType.HotelList;

        ucStayCriteriaControl.CountryListItems = objCountryListItems;
        ucStayCriteriaControl.AreaListItems = objAreaListItems;
        ucStayCriteriaControl.HotelListItems = objHotelListItems;
        ucStayCriteriaControl.StayCriteriaSelectorMode = StayCriteriaSelectorMode.Change;
        ucStayCriteriaControl.StayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];
        ucStayCriteriaControl.HotelDescriptiveInfo = objHotelDescriptiveInfo;

        return;
    }
    private void ConfigureRoomExtra(RoomDetailSelectorControl ucRoomDetailSelectorControl, HotelRoomAvailInfo objHotelRoomAvailInfo, HotelDescriptiveInfo objHotelDescriptiveInfo)
    {
        // Selected Room Rate
          var selectedRoomRate = (from rrs in RoomRateSelections
                              where rrs.RoomRefID == ucRoomDetailSelectorControl.RoomRefID
                              select rrs).FirstOrDefault();

          if (selectedRoomRate == null || string.IsNullOrWhiteSpace(selectedRoomRate.RatePlanCode))
         return;

          var roomRateInfo = (from item in objHotelRoomAvailInfo.RatePlans
                          where item.Code == selectedRoomRate.RatePlanCode
                          select item).FirstOrDefault();
          var packages = from package in roomRateInfo.Packages
                     where package.RoomTypeCode.Equals(string.Empty) || package.RoomTypeCode == selectedRoomRate.RoomTypeCode
                     select package;

          var roomOccupantSelection = StayCriteriaSelection.RoomOccupantSelections.FirstOrDefault(room => room.RoomRefID == ucRoomDetailSelectorControl.RoomRefID);
          var selectedExtras = from extra in AddOnPackageSelections where extra.RoomRefID == ucRoomDetailSelectorControl.RoomRefID select extra;

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

          //Render selected Extras
          if (selectedExtras.Count() > 0)
          {
         foreach (var extra in selectedExtras)
         {
            var localExtra = extra;
            var selectedPackage = packages.Where(pkg => pkg.Code == localExtra.PackageCode).FirstOrDefault();
            AddOnPackageSelectorItemControl ucAddOnPackageSelectorItemControl = (AddOnPackageSelectorItemControl)LoadControl(strAddOnPackageSelectorItemControlPath);
            ucAddOnPackageSelectorItemControl.ID = string.Format("{0}_{1}_{2}_selected"
                                                                 , "AddOnPackageSelectorItemControl"
                                                                 , ucRoomDetailSelectorControl.RoomRefID
                                                                 , RemoveSpecialCharFromString(selectedPackage.Code));
            ucAddOnPackageSelectorItemControl.IsItemRemovable = (!bIsConfirmed && Step != BookingSteps.GuestInfo);
            ucAddOnPackageSelectorItemControl.RoomRefID = ucRoomDetailSelectorControl.RoomRefID;
            ucAddOnPackageSelectorItemControl.NumberAdults = roomOccupantSelection.NumberAdults;
            ucAddOnPackageSelectorItemControl.NumberStayNights = (StayCriteriaSelection.DepartureDate - StayCriteriaSelection.ArrivalDate).Days;
            ucAddOnPackageSelectorItemControl.PackageDescription = objHotelDescriptiveInfo.Packages.FirstOrDefault(pkg => pkg.Code == selectedPackage.Code);
            ucAddOnPackageSelectorItemControl.PackageRate = packages.FirstOrDefault(pkg => pkg.Code == selectedPackage.Code);
            ucAddOnPackageSelectorItemControl.PackageQuantity = localExtra.Quantity;
            ucAddOnPackageSelectorItemControl.Selected = true;

            ucRoomDetailSelectorControl.AddSelectedRoomExtraItemControl(ucAddOnPackageSelectorItemControl);

         }
          }
          //Render available extras
          if (CurrentRoomRefID == ucRoomDetailSelectorControl.RoomRefID && ucRoomDetailSelectorControl.Step == RoomDetailSelectionStep.SelectExtra)
          {
         foreach (HotelAvailPackage package in packages)
         {
            var localPackage = package;

            if (!packageForShowingInRemoteContent.Contains(localPackage.Code))
               packageForShowingInRemoteContent.Add(localPackage.Code);

            if (selectedExtras.Count() > 0)
            {
               HotelAvailPackage cpPackage = package;
               var selectedAddOn = selectedExtras.Where(addOn => addOn.RoomRefID == CurrentRoomRefID && addOn.PackageCode == cpPackage.Code);
               if (selectedAddOn.Count() > 0)
                  continue;
            }

            AddOnPackageSelectorItemControl ucAddOnPackageSelectorItemControl = (AddOnPackageSelectorItemControl)LoadControl(strAddOnPackageSelectorItemControlPath);
            ucAddOnPackageSelectorItemControl.ID = string.Format("{0}_{1}_{2}_available"
                                                                 , "AddOnPackageSelectorItemControl"
                                                                 , ucRoomDetailSelectorControl.RoomRefID
                                                                 , RemoveSpecialCharFromString(package.Code));
            ucAddOnPackageSelectorItemControl.RoomRefID = ucRoomDetailSelectorControl.RoomRefID;
            ucAddOnPackageSelectorItemControl.NumberAdults = roomOccupantSelection.NumberAdults;
            ucAddOnPackageSelectorItemControl.NumberStayNights = (StayCriteriaSelection.DepartureDate - StayCriteriaSelection.ArrivalDate).Days;
            ucAddOnPackageSelectorItemControl.PackageDescription = objHotelDescriptiveInfo.Packages.FirstOrDefault(pkg => pkg.Code == localPackage.Code);
            ucAddOnPackageSelectorItemControl.PackageRate = packages.FirstOrDefault(pkg => pkg.Code == localPackage.Code);
            ucAddOnPackageSelectorItemControl.PackageQuantity = 0;
            ucAddOnPackageSelectorItemControl.Selected = false;

            ucRoomDetailSelectorControl.AddRoomExtraItemControl(ucAddOnPackageSelectorItemControl);
         }
          }
          if (Step == BookingSteps.SelectRoomDetail && CurrentRoomDetailStep == RoomDetailSelectionStep.SelectExtra && !bShowRoomTypePhoto)
         ucRemoteContentContainer.Src += string.Format("?show={0}", string.Join(",", packageForShowingInRemoteContent));
    }
    private void ConfigureGuestDetailsEntryControl()
    {
        bool bBookingTermsConditionsAccepted = (bool)Session["BookingTermsConditionsAccepted"];

          HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

          PaymentCardApplication enumPaymentCardApplicationStatus = WBSPGHelper.GetPaymentCardApplicationStatus(HotelBookingPaymentAllocations);

          decimal decTotalPaymentCardPayment = WBSPGHelper.GetTotalPaymentCardPayment(HotelBookingPaymentAllocations);

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

          string[] objPaymentCardCodes = objHotelDescriptiveInfo.CreditCardCodes;

          // retrieve supported payment methods.
          PaymentGatewayInfos = WBSPGHelper.GetPaymentGatewayInfos(StayCriteriaSelection.HotelCode);
          // Calculate deposit ammount
          HotelBookingPaymentAllocations = WBSPGHelper.GetPaymentAllocations(HotelPricingHelper.GetHotelPricing(StayCriteriaSelection, RoomRateSelections, AddOnPackageSelections, HotelAvailabilityRS.HotelRoomAvailInfos, CurrencyCode));

          if (PaymentGatewayInfos.Length == 1)
         Session[Constants.Sessions.PaymentGatewayInfo] = PaymentGatewayInfos[0];
          else
         Session[Constants.Sessions.PaymentGatewayInfo] = null; // if multiple gateways configured, payment gateway must be selected by method of payment

          for (int i = 0; i < objPaymentCardCodes.Length; i++) // mask out cards with no name lookup
          {
         if ((String)GetGlobalResourceObject("SiteResources", "CardType" + objPaymentCardCodes[i]) != null && (String)GetGlobalResourceObject("SiteResources", "CardType" + objPaymentCardCodes[i]) != "")
            lPaymentCardCodes.Add(objPaymentCardCodes[i]);
          }

          objPaymentCardCodes = lPaymentCardCodes.ToArray();

          if (PaymentGatewayInfos != null && PaymentGatewayInfos.Length != 0 && decTotalPaymentCardPayment != 0 && ConfigurationManager.AppSettings["EnterGuestDetailsPage.PaymentGatewayAcceptedCardsOnly"] == "1")
         objPaymentCardCodes = WBSPGHelper.GetPaymentGatewayAcceptedCardTypes(PaymentGatewayInfos);

          bool bPaymentGatewayPreSelectRequired = false;

          if (PaymentGatewayInfo == null && WBSPGHelper.IsPaymentGatewayPreSelectRequired(PaymentGatewayInfos, HotelBookingPaymentAllocations))
         bPaymentGatewayPreSelectRequired = true;

          XHS.WBSUIBizObjects.Profile objProfile = WbsUiHelper.GetLoginLinkedProfile();

          bool bDisplayProfileGuarantee = false;

          if (objProfile != null && objProfile.PermitProfileGuarantee && (enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeOnly || enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeAndDeposit))
          {
         bDisplayProfileGuarantee = true;
          }

          ucGuestDetailsEntryControl.HotelDescriptiveInfo = objHotelDescriptiveInfo;
          ucGuestDetailsEntryControl.GuestDetailsEntryInfo = GuestDetailsEntryInfo;
          ucGuestDetailsEntryControl.MembershipPrograms = WbsUiHelper.GetMembershipPrograms(StayCriteriaSelection.HotelCode);
          ucGuestDetailsEntryControl.PaymentCardCodes = objPaymentCardCodes;
          ucGuestDetailsEntryControl.TermsConditionsAccepted = bBookingTermsConditionsAccepted;
          ucGuestDetailsEntryControl.PaymentGatewayInfos = PaymentGatewayInfos;
          ucGuestDetailsEntryControl.PaymentGatewayPreSelectRequired = bPaymentGatewayPreSelectRequired;
          ucGuestDetailsEntryControl.SelectedPaymentGateway = PaymentGatewayInfo;
          ucGuestDetailsEntryControl.PaymentCardApplicationStatus = enumPaymentCardApplicationStatus;
          ucGuestDetailsEntryControl.PaymentCardDepositAmount = decTotalPaymentCardPayment;
          ucGuestDetailsEntryControl.PaymentCardDepositCurrencyCode = objHotelDescriptiveInfo.CurrencyCode;
          ucGuestDetailsEntryControl.DisplayProfileGuarantee = bDisplayProfileGuarantee;

          ucGuestDetailsEntryControl.IsControlConfigured = true;

          return;
    }
    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);
    }
    private HotelImageGallery MakeImageGallery(HotelDescriptiveInfo objHotelDescriptiveInfo)
    {
        string[] objImageTitles = this.GetImageGalleryImageTitles(objHotelDescriptiveInfo);

        List<HotelImageGalleryItem> lHotelImageGalleryItems = new List<HotelImageGalleryItem>();

        for (int i = 0; i < objImageTitles.Length; i++)
        {
            HotelImageGalleryItem objHotelImageGalleryItem = new HotelImageGalleryItem();

            objHotelImageGalleryItem.ThumbnailImage = this.GetImageGalleryThumbnailImage(objImageTitles[i], objHotelDescriptiveInfo);
            objHotelImageGalleryItem.FullSizeImage = this.GetImageGalleryFullSizeImage(objImageTitles[i], objHotelDescriptiveInfo);

            if (objHotelImageGalleryItem.ThumbnailImage != null && objHotelImageGalleryItem.FullSizeImage != null)
            {
                lHotelImageGalleryItems.Add(objHotelImageGalleryItem);
            }

        }

        HotelImageGallery objHotelImageGallery = new HotelImageGallery();

        objHotelImageGallery.HotelCode = objHotelDescriptiveInfo.HotelCode;
        objHotelImageGallery.HotelName = objHotelDescriptiveInfo.HotelName;
        objHotelImageGallery.CurrentImageNumber = 0;
        objHotelImageGallery.CurrentHomeThumbNumber = 0;
        objHotelImageGallery.Images = lHotelImageGalleryItems.ToArray();

        return objHotelImageGallery;
    }
    private void ConfigureBookingSummaryControl()
    {
        HotelAvailabilityRS objHotelAvailabilityRS = (HotelAvailabilityRS)Session["HotelAvailabilityRS"];
        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];

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

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

        HotelPricing[] objHotelPricings = HotelPricingHelper.GetHotelPricing(objStayCriteriaSelection, objRoomRateSelections, objAddOnPackageSelections, objHotelAvailabilityRS.HotelRoomAvailInfos, objHotelDescriptiveInfo.CurrencyCode);

        int intNumberStayNights = ((TimeSpan)objStayCriteriaSelection.DepartureDate.Subtract(objStayCriteriaSelection.ArrivalDate)).Days;

        string strBookingSummaryRoomItemControlPath = ConfigurationManager.AppSettings["BookingSummaryRoomItemControl.ascx"];
        string strBookingSummaryAddOnPackageItemControlPath = ConfigurationManager.AppSettings["BookingSummaryAddOnPackageItemControl.ascx"];

        ucBookingSummaryControl.Clear();

        ucBookingSummaryControl.ID = "BookingSummaryControl";
        ucBookingSummaryControl.HotelDescriptiveInfo = objHotelDescriptiveInfo;
        ucBookingSummaryControl.StayCriteriaSelection = objStayCriteriaSelection;
        ucBookingSummaryControl.GuestDetailsEntryInfo = null;
        ucBookingSummaryControl.HotelPricings = objHotelPricings;
        ucBookingSummaryControl.PaymentReceipt = null;
        ucBookingSummaryControl.MasterConfirmationNumber = "";

        for (int ri = 0; ri < objStayCriteriaSelection.RoomOccupantSelections.Length; ri++)
        {
            RoomRateSelection objRoomRateSelection = new RoomRateSelection();

            for (int i = 0; i < objRoomRateSelections.Length; i++)
            {
                if (objRoomRateSelections[i].RoomRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    objRoomRateSelection = objRoomRateSelections[i];
                    break;
                }

            }

            HotelDescRoomType objHotelDescRoomType = new HotelDescRoomType();

            for (int i = 0; i < objHotelDescriptiveInfo.RoomTypes.Length; i++)
            {
                if (objHotelDescriptiveInfo.RoomTypes[i].Code == objRoomRateSelection.RoomTypeCode)
                {
                    objHotelDescRoomType = objHotelDescriptiveInfo.RoomTypes[i];
                    break;
                }

            }

            HotelRoomAvailInfo objHotelRoomAvailInfo = new HotelRoomAvailInfo();

            for (int i = 0; i < objHotelAvailabilityRS.HotelRoomAvailInfos.Length; i++)
            {
                if (objHotelAvailabilityRS.HotelRoomAvailInfos[i].SegmentRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    objHotelRoomAvailInfo = objHotelAvailabilityRS.HotelRoomAvailInfos[i];
                    break;
                }

            }

            HotelAvailRatePlan objHotelAvailRatePlan = new HotelAvailRatePlan();

            for (int i = 0; i < objHotelRoomAvailInfo.RatePlans.Length; i++)
            {
                if (objHotelRoomAvailInfo.RatePlans[i].Code == objRoomRateSelection.RatePlanCode)
                {
                    objHotelAvailRatePlan = objHotelRoomAvailInfo.RatePlans[i];
                    break;
                }

            }

            HotelAvailRoomRate objHotelAvailRoomRate = new HotelAvailRoomRate();

            for (int i = 0; i < objHotelRoomAvailInfo.RoomRates.Length; i++)
            {
                if (objHotelRoomAvailInfo.RoomRates[i].RoomTypeCode == objRoomRateSelection.RoomTypeCode && objHotelRoomAvailInfo.RoomRates[i].RatePlanCode == objRoomRateSelection.RatePlanCode)
                {
                    objHotelAvailRoomRate = objHotelRoomAvailInfo.RoomRates[i];
                    break;
                }

            }

            HotelPricing objHotelPricing = new HotelPricing();

            for (int i = 0; i < objHotelPricings.Length; i++)
            {
                if (objHotelPricings[i].SegmentRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    objHotelPricing = objHotelPricings[i];
                    break;
                }

            }

            BookingSummaryRoomItemControl ucBookingSummaryRoomItemControl = (BookingSummaryRoomItemControl)LoadControl(strBookingSummaryRoomItemControlPath);
            ucBookingSummaryControl.AddRoomSummaryItem(ucBookingSummaryRoomItemControl);

            ucBookingSummaryRoomItemControl.Clear();

            ucBookingSummaryRoomItemControl.ID = "BookingSummaryRoomItem" + ((int)(ri + 1)).ToString();
            ucBookingSummaryRoomItemControl.RoomRefID = objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID;
            ucBookingSummaryRoomItemControl.RoomOccupantSelection = objStayCriteriaSelection.RoomOccupantSelections[ri];
            ucBookingSummaryRoomItemControl.RoomType = objHotelDescRoomType;
            ucBookingSummaryRoomItemControl.RatePlan = objHotelAvailRatePlan;
            ucBookingSummaryRoomItemControl.RoomRate = objHotelAvailRoomRate;
            ucBookingSummaryRoomItemControl.HotelPricing = objHotelPricing;
            ucBookingSummaryRoomItemControl.ConfirmationNumber = "";

            for (int pi = 0; pi < objAddOnPackageSelections.Length; pi++)
            {
                if (objAddOnPackageSelections[pi].RoomRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    HotelDescPackage objHotelDescPackage = new HotelDescPackage();

                    for (int i = 0; i < objHotelDescriptiveInfo.Packages.Length; i++)
                    {
                        if (objHotelDescriptiveInfo.Packages[i].Code == objAddOnPackageSelections[pi].PackageCode)
                        {
                            objHotelDescPackage = objHotelDescriptiveInfo.Packages[i];
                            break;
                        }

                    }

                    HotelAvailPackage objHotelAvailPackage = new HotelAvailPackage();

                    for (int i = 0; i < objHotelAvailRatePlan.Packages.Length; i++)
                    {
                        if (objHotelAvailRatePlan.Packages[i].Code == objAddOnPackageSelections[pi].PackageCode)
                        {
                            if (objHotelAvailRatePlan.Packages[i].RoomTypeCode == "" || objHotelAvailRatePlan.Packages[i].RoomTypeCode == objRoomRateSelection.RoomTypeCode)
                            {
                                objHotelAvailPackage = objHotelAvailRatePlan.Packages[i];
                                break;
                            }

                        }

                    }

                    BookingSummaryAddOnPackageItemControl ucBookingSummaryAddOnPackageItemControl = (BookingSummaryAddOnPackageItemControl)LoadControl(strBookingSummaryAddOnPackageItemControlPath);
                    ucBookingSummaryRoomItemControl.AddAddOnPackageSummaryItem(ucBookingSummaryAddOnPackageItemControl);

                    ucBookingSummaryAddOnPackageItemControl.ID = "BookingSummaryAddOnPackageItem" + ((int)(pi + 1)).ToString();
                    ucBookingSummaryAddOnPackageItemControl.RoomRefID = objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID;
                    ucBookingSummaryAddOnPackageItemControl.NumberStayNights = intNumberStayNights;
                    ucBookingSummaryAddOnPackageItemControl.PackageQuantity = objAddOnPackageSelections[pi].Quantity;
                    ucBookingSummaryAddOnPackageItemControl.PackageDescription = objHotelDescPackage;
                    ucBookingSummaryAddOnPackageItemControl.PackageRate = objHotelAvailPackage;
                }

            }

        }

        return;
    }
Exemplo n.º 11
0
        public List <HotelDescriptiveInfo> HotelSearch(HotelSearchRequest objHSRQ)
        {
            _database = MongoDBHandler.mDatabase();

            var collection = _database.GetCollection <BsonDocument>("HotelDefinitions");

            FilterDefinition <BsonDocument> filter;

            filter = Builders <BsonDocument> .Filter.Empty;
            //Hotel Name filter
            if (objHSRQ.HotelName != null)
            {
                filter = filter & Builders <BsonDocument> .Filter.Regex("HotelName", new BsonRegularExpression(new Regex(objHSRQ.HotelName, RegexOptions.IgnoreCase)));
            }

            //City Name Filter
            if (objHSRQ.CityName != null)
            {
                filter = filter & Builders <BsonDocument> .Filter.Eq("CityName", objHSRQ.CityName);
            }

            //Country Name filter
            if (objHSRQ.CountryName != null)
            {
                filter = filter & Builders <BsonDocument> .Filter.Eq("CountryName", objHSRQ.CountryName);
            }

            var searchResult = collection.Find(filter).ToList();

            List <HotelDescriptiveInfo> result = new List <HotelDescriptiveInfo>();

            foreach (var docs in searchResult)
            {
                HotelDescriptiveInfo subResult = new HotelDescriptiveInfo();
                subResult.Id          = docs["_id"].AsObjectId;
                subResult.HotelCode   = docs["HotelCode"].AsString;
                subResult.HotelName   = docs["HotelName"].AsString;
                subResult.Rating      = docs["Rating"].AsString;
                subResult.URLs        = docs["URLs"].AsString;
                subResult.AddressLine = docs["AddressLine"].AsString;
                subResult.PostalCode  = docs["PostalCode"].AsString;
                subResult.CityName    = docs["CityName"].AsString;
                subResult.CountryName = docs["CountryName"].AsString;
                var      position       = docs["Position"].AsBsonArray.Select(p => p.AsString).ToArray();
                string[] actualPosition = new string[position.Length];
                int      i = 0;
                foreach (string pos in position)
                {
                    actualPosition[i] = pos;
                    i++;
                }
                subResult.Position    = actualPosition;
                subResult.PhoneNumber = docs["PhoneNumber"].AsString;
                result.Add(subResult);
            }

            collection = null;
            _database  = null;

            return(result);
        }
    private void ConfigureAddOnPackageSelectorControl()
    {
        string strSelectedRoom = (string)Session["SelectedRoom"];

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

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

        RoomOccupantSelection objRoomOccupantSelection = new RoomOccupantSelection();

        for (int i = 0; i < objStayCriteriaSelection.RoomOccupantSelections.Length; i++)
        {
            if (objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID == strSelectedRoom)
            {
                objRoomOccupantSelection = objStayCriteriaSelection.RoomOccupantSelections[i];
                break;
            }

        }

        RoomRateSelection objRoomRateSelection = new RoomRateSelection();

        for (int i = 0; i < objRoomRateSelections.Length; i++)
        {
            if (objRoomRateSelections[i].RoomRefID == strSelectedRoom)
            {
                objRoomRateSelection = objRoomRateSelections[i];
                break;
            }

        }

        HotelRoomAvailInfo objHotelRoomAvailInfo = new HotelRoomAvailInfo();

        for (int i = 0; i < objHotelAvailabilityRS.HotelRoomAvailInfos.Length; i++)
        {
            if (objHotelAvailabilityRS.HotelRoomAvailInfos[i].SegmentRefID == strSelectedRoom)
            {
                objHotelRoomAvailInfo = objHotelAvailabilityRS.HotelRoomAvailInfos[i];
                break;
            }

        }

        List<AddOnPackageSelection> lAddOnPackageSelections = new List<AddOnPackageSelection>();

        for (int i = 0; i < objAddOnPackageSelections.Length; i++)
        {
            if (objAddOnPackageSelections[i].RoomRefID == strSelectedRoom)
            {
                lAddOnPackageSelections.Add(objAddOnPackageSelections[i]);
            }

        }

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

        int intNumberStayNights = ((TimeSpan)objStayCriteriaSelection.DepartureDate.Subtract(objStayCriteriaSelection.ArrivalDate)).Days;

        string strRoomSelectorItemControlPath = ConfigurationManager.AppSettings["RoomSelectorItemControl.ascx"];
        string strAddOnPackageSelectorItemControlPath = ConfigurationManager.AppSettings["AddOnPackageSelectorItemControl.ascx"];

        ucAddOnPackageSelectorControl.Clear();

        ucAddOnPackageSelectorControl.ID = "AddOnPackageSelector";
        ucAddOnPackageSelectorControl.RoomRefID = strSelectedRoom;
        ucAddOnPackageSelectorControl.RoomOccupantSelection = objRoomOccupantSelection;

        for (int i = 0; i < objStayCriteriaSelection.RoomOccupantSelections.Length; i++)
        {
            RoomSelectorItemControl ucRoomSelectorItemControl = (RoomSelectorItemControl)LoadControl(strRoomSelectorItemControlPath);
            ucAddOnPackageSelectorControl.AddRoomSelectorItem(ucRoomSelectorItemControl);

            ucRoomSelectorItemControl.ID = "RoomSelectorItem" + objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;
            ucRoomSelectorItemControl.RoomRefID = objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;
            ucRoomSelectorItemControl.RoomRefIDMenuText = (String)GetGlobalResourceObject("SiteResources", "RoomSelectorMenuText") + " " + objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID;

            if (objStayCriteriaSelection.RoomOccupantSelections[i].RoomRefID == strSelectedRoom)
                ucRoomSelectorItemControl.Selected = true;
            else
                ucRoomSelectorItemControl.Selected = false;
        }

        for (int i = 0; i < objHotelRoomAvailInfo.RatePlans.Length; i++)
        {
            if (objHotelRoomAvailInfo.RatePlans[i].Code == objRoomRateSelection.RatePlanCode)
            {
                for (int j = 0; j < objHotelRoomAvailInfo.RatePlans[i].Packages.Length; j++)
                {
                    if (objHotelRoomAvailInfo.RatePlans[i].Packages[j].RoomTypeCode == "" || objHotelRoomAvailInfo.RatePlans[i].Packages[j].RoomTypeCode == objRoomRateSelection.RoomTypeCode)
                    {
                        AddOnPackageSelectorItemControl ucAddOnPackageSelectorItemControl = (AddOnPackageSelectorItemControl)LoadControl(strAddOnPackageSelectorItemControlPath);
                        ucAddOnPackageSelectorControl.AddAddOnPackageSelectorItem(ucAddOnPackageSelectorItemControl);

                        ucAddOnPackageSelectorItemControl.ID = "AddOnPackageSelectorItemControl" + ((int)(j + 1)).ToString();
                        ucAddOnPackageSelectorItemControl.RoomRefID = strSelectedRoom;
                        ucAddOnPackageSelectorItemControl.NumberAdults = objRoomOccupantSelection.NumberAdults;
                        ucAddOnPackageSelectorItemControl.NumberStayNights = intNumberStayNights;

                        for (int k = 0; k < objHotelDescriptiveInfo.Packages.Length; k++)
                        {
                            if (objHotelDescriptiveInfo.Packages[k].Code == objHotelRoomAvailInfo.RatePlans[i].Packages[j].Code)
                            {
                                ucAddOnPackageSelectorItemControl.PackageDescription = objHotelDescriptiveInfo.Packages[k];
                                break;
                            }

                        }

                        ucAddOnPackageSelectorItemControl.PackageRate = objHotelRoomAvailInfo.RatePlans[i].Packages[j];

                        ucAddOnPackageSelectorItemControl.PackageQuantity = 0;
                        ucAddOnPackageSelectorItemControl.Selected = false;

                        for (int k = 0; k < objAddOnPackageSelections.Length; k++)
                        {
                            if (objAddOnPackageSelections[k].RoomRefID == strSelectedRoom && objAddOnPackageSelections[k].PackageCode == objHotelRoomAvailInfo.RatePlans[i].Packages[j].Code)
                            {
                                ucAddOnPackageSelectorItemControl.PackageQuantity = objAddOnPackageSelections[k].Quantity;
                                ucAddOnPackageSelectorItemControl.Selected = true;
                                break;
                            }

                        }

                    }

                }

                break;
            }

        }

        return;
    }
    private void ConfigureBookingSummaryControl()
    {
        HotelAvailabilityRS objHotelAvailabilityRS = (HotelAvailabilityRS)Session["HotelAvailabilityRS"];
        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];
        HotelBookingRS objHotelBookingRS = (HotelBookingRS)Session["HotelBookingRS"];

        StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection];
        RoomRateSelection[] objRoomRateSelections = (RoomRateSelection[])Session["RoomRateSelections"];
        AddOnPackageSelection[] objAddOnPackageSelections = (AddOnPackageSelection[])Session["AddOnPackageSelections"];
        GuestDetailsEntryInfo objGuestDetailsEntryInfo = (GuestDetailsEntryInfo)Session["GuestDetailsEntryInfo"];
        PaymentGatewayInfo objPaymentGatewayInfo = (PaymentGatewayInfo)Session[Constants.Sessions.PaymentGatewayInfo];
        HotelBookingPaymentAllocation[] objHotelBookingPaymentAllocations = (HotelBookingPaymentAllocation[])Session[Constants.Sessions.HotelBookingPaymentAllocations];
        HotelPaymentRS objHotelPaymentRS = (HotelPaymentRS)Session["HotelPaymentRS"];

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

        HotelPricing[] objHotelPricings = HotelPricingHelper.GetHotelPricing(objStayCriteriaSelection, objRoomRateSelections, objAddOnPackageSelections, objHotelAvailabilityRS.HotelRoomAvailInfos, objHotelDescriptiveInfo.CurrencyCode);

        OnlinePaymentReceipt objOnlinePaymentReceipt = null;

        decimal decTotalPaymentCardPayment = WBSPGHelper.GetTotalPaymentCardPayment(objHotelBookingPaymentAllocations);

        if (objPaymentGatewayInfo != null && decTotalPaymentCardPayment != 0)
        {
            objOnlinePaymentReceipt = new OnlinePaymentReceipt();

            objOnlinePaymentReceipt.PaymentCard = objHotelPaymentRS.PaymentCard;
            objOnlinePaymentReceipt.PaymentGatewayCardType = objHotelPaymentRS.PaymentGatewayCardType;
            objOnlinePaymentReceipt.PaymentDateTime = TZNet.ToLocal(WbsUiHelper.GetTimeZone(objStayCriteriaSelection.HotelCode), DateTime.UtcNow).Date;
            objOnlinePaymentReceipt.AuthCode = objHotelPaymentRS.PaymentAuthCode;
            objOnlinePaymentReceipt.TransRefID = objHotelPaymentRS.PaymentTransRefID;
            objOnlinePaymentReceipt.Amount = decTotalPaymentCardPayment;
            objOnlinePaymentReceipt.CurrencyCode = objHotelDescriptiveInfo.CurrencyCode;
        }

        string strMasterConfirmationNumber = "";

        if (objHotelBookingRS.Segments.Length != 0)
        {
            strMasterConfirmationNumber = objHotelBookingRS.Segments[0].MasterConfirmationNumber;
        }

        int intNumberStayNights = ((TimeSpan)objStayCriteriaSelection.DepartureDate.Subtract(objStayCriteriaSelection.ArrivalDate)).Days;

        string strBookingSummaryRoomItemControlPath = ConfigurationManager.AppSettings["BookingSummaryRoomItemControl.ascx"];
        string strBookingSummaryAddOnPackageItemControlPath = ConfigurationManager.AppSettings["BookingSummaryAddOnPackageItemControl.ascx"];

        ucBookingSummaryControl.Clear();

        ucBookingSummaryControl.ID = "BookingSummaryControl";
        ucBookingSummaryControl.HotelDescriptiveInfo = objHotelDescriptiveInfo;
        ucBookingSummaryControl.StayCriteriaSelection = objStayCriteriaSelection;
        ucBookingSummaryControl.GuestDetailsEntryInfo = objGuestDetailsEntryInfo;
        ucBookingSummaryControl.HotelPricings = objHotelPricings;
        ucBookingSummaryControl.PaymentReceipt = objOnlinePaymentReceipt;
        ucBookingSummaryControl.MasterConfirmationNumber = strMasterConfirmationNumber;

        for (int ri = 0; ri < objStayCriteriaSelection.RoomOccupantSelections.Length; ri++)
        {
            RoomRateSelection objRoomRateSelection = new RoomRateSelection();

            for (int i = 0; i < objRoomRateSelections.Length; i++)
            {
                if (objRoomRateSelections[i].RoomRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    objRoomRateSelection = objRoomRateSelections[i];
                    break;
                }

            }

            HotelDescRoomType objHotelDescRoomType = new HotelDescRoomType();

            for (int i = 0; i < objHotelDescriptiveInfo.RoomTypes.Length; i++)
            {
                if (objHotelDescriptiveInfo.RoomTypes[i].Code == objRoomRateSelection.RoomTypeCode)
                {
                    objHotelDescRoomType = objHotelDescriptiveInfo.RoomTypes[i];
                    break;
                }

            }

            HotelRoomAvailInfo objHotelRoomAvailInfo = new HotelRoomAvailInfo();

            for (int i = 0; i < objHotelAvailabilityRS.HotelRoomAvailInfos.Length; i++)
            {
                if (objHotelAvailabilityRS.HotelRoomAvailInfos[i].SegmentRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    objHotelRoomAvailInfo = objHotelAvailabilityRS.HotelRoomAvailInfos[i];
                    break;
                }

            }

            HotelAvailRatePlan objHotelAvailRatePlan = new HotelAvailRatePlan();

            for (int i = 0; i < objHotelRoomAvailInfo.RatePlans.Length; i++)
            {
                if (objHotelRoomAvailInfo.RatePlans[i].Code == objRoomRateSelection.RatePlanCode)
                {
                    objHotelAvailRatePlan = objHotelRoomAvailInfo.RatePlans[i];
                    break;
                }

            }

            HotelAvailRoomRate objHotelAvailRoomRate = new HotelAvailRoomRate();

            for (int i = 0; i < objHotelRoomAvailInfo.RoomRates.Length; i++)
            {
                if (objHotelRoomAvailInfo.RoomRates[i].RoomTypeCode == objRoomRateSelection.RoomTypeCode && objHotelRoomAvailInfo.RoomRates[i].RatePlanCode == objRoomRateSelection.RatePlanCode)
                {
                    objHotelAvailRoomRate = objHotelRoomAvailInfo.RoomRates[i];
                    break;
                }

            }

            HotelPricing objHotelPricing = new HotelPricing();

            for (int i = 0; i < objHotelPricings.Length; i++)
            {
                if (objHotelPricings[i].SegmentRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    objHotelPricing = objHotelPricings[i];
                    break;
                }

            }

            BookingSummaryRoomItemControl ucBookingSummaryRoomItemControl = (BookingSummaryRoomItemControl)LoadControl(strBookingSummaryRoomItemControlPath);
            ucBookingSummaryControl.AddRoomSummaryItem(ucBookingSummaryRoomItemControl);

            ucBookingSummaryRoomItemControl.Clear();

            ucBookingSummaryRoomItemControl.ID = "BookingSummaryRoomItem" + ((int)(ri + 1)).ToString();
            ucBookingSummaryRoomItemControl.RoomRefID = objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID;
            ucBookingSummaryRoomItemControl.RoomOccupantSelection = objStayCriteriaSelection.RoomOccupantSelections[ri];
            ucBookingSummaryRoomItemControl.RoomType = objHotelDescRoomType;
            ucBookingSummaryRoomItemControl.RatePlan = objHotelAvailRatePlan;
            ucBookingSummaryRoomItemControl.RoomRate = objHotelAvailRoomRate;
            ucBookingSummaryRoomItemControl.HotelPricing = objHotelPricing;
            ucBookingSummaryRoomItemControl.ConfirmationNumber = "";

            for (int pi = 0; pi < objAddOnPackageSelections.Length; pi++)
            {
                if (objAddOnPackageSelections[pi].RoomRefID == objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID)
                {
                    HotelDescPackage objHotelDescPackage = new HotelDescPackage();

                    for (int i = 0; i < objHotelDescriptiveInfo.Packages.Length; i++)
                    {
                        if (objHotelDescriptiveInfo.Packages[i].Code == objAddOnPackageSelections[pi].PackageCode)
                        {
                            objHotelDescPackage = objHotelDescriptiveInfo.Packages[i];
                            break;
                        }

                    }

                    HotelAvailPackage objHotelAvailPackage = new HotelAvailPackage();

                    for (int i = 0; i < objHotelAvailRatePlan.Packages.Length; i++)
                    {
                        if (objHotelAvailRatePlan.Packages[i].Code == objAddOnPackageSelections[pi].PackageCode)
                        {
                            if (objHotelAvailRatePlan.Packages[i].RoomTypeCode == "" || objHotelAvailRatePlan.Packages[i].RoomTypeCode == objRoomRateSelection.RoomTypeCode)
                            {
                                objHotelAvailPackage = objHotelAvailRatePlan.Packages[i];
                                break;
                            }

                        }

                    }

                    BookingSummaryAddOnPackageItemControl ucBookingSummaryAddOnPackageItemControl = (BookingSummaryAddOnPackageItemControl)LoadControl(strBookingSummaryAddOnPackageItemControlPath);
                    ucBookingSummaryRoomItemControl.AddAddOnPackageSummaryItem(ucBookingSummaryAddOnPackageItemControl);

                    ucBookingSummaryAddOnPackageItemControl.ID = "BookingSummaryAddOnPackageItem" + ((int)(pi + 1)).ToString();
                    ucBookingSummaryAddOnPackageItemControl.RoomRefID = objStayCriteriaSelection.RoomOccupantSelections[ri].RoomRefID;
                    ucBookingSummaryAddOnPackageItemControl.NumberStayNights = intNumberStayNights;
                    ucBookingSummaryAddOnPackageItemControl.PackageQuantity = objAddOnPackageSelections[pi].Quantity;
                    ucBookingSummaryAddOnPackageItemControl.PackageDescription = objHotelDescPackage;
                    ucBookingSummaryAddOnPackageItemControl.PackageRate = objHotelAvailPackage;
                }

            }

        }

        return;
    }
    public void Clear()
    {
        _HotelDescriptiveInfo = new HotelDescriptiveInfo();
        _BookingReadSegments = new HotelBookingReadSegment[0];

        lCancelRoomSelectorItemControls = null;
        lConfirmationNumberSelections = null;

        return;
    }
    private void ConfigureCancelRoomSelectorControl()
    {
        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];

          HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

          string strCancelRoomSelectorItemControlPath = ConfigurationManager.AppSettings["CancelRoomSelectorItemControl.ascx"];
          string strCancelAddOnPackageItemControlPath = ConfigurationManager.AppSettings["CancelAddOnPackageItemControl.ascx"];

          ucCancelRoomSelectorControl.Clear();

          ucCancelRoomSelectorControl.ID = "CancelRoomSelectorControl";
          ucCancelRoomSelectorControl.HotelDescriptiveInfo = objHotelDescriptiveInfo;
          ucCancelRoomSelectorControl.BookingReadSegments = HotelBookingReadSegments;
          ucCancelRoomSelectorControl.Mode = bIsCancelled ? SelectionMode.NonModifiable : SelectionMode.Edit;

          for (int si = 0; si < HotelBookingReadSegments.Length; si++)
          {
         int intNumberStayNights = ((TimeSpan)HotelBookingReadSegments[si].DepartureDate.Subtract(HotelBookingReadSegments[si].ArrivalDate)).Days;

         RoomOccupantSelection objRoomOccupantSelection = new RoomOccupantSelection();

         objRoomOccupantSelection.RoomRefID = ((int)(si + 1)).ToString();
         objRoomOccupantSelection.NumberRooms = HotelBookingReadSegments[si].NumRooms;
         objRoomOccupantSelection.NumberAdults = HotelBookingReadSegments[si].NumAdults;
         objRoomOccupantSelection.NumberChildren = HotelBookingReadSegments[si].NumChildren;

         CancelRoomSelectorItemControl ucCancelRoomSelectorItemControl = (CancelRoomSelectorItemControl)LoadControl(strCancelRoomSelectorItemControlPath);
         ucCancelRoomSelectorControl.AddCancelRoomSelectorItem(ucCancelRoomSelectorItemControl);

         ucCancelRoomSelectorItemControl.Clear();

         ucCancelRoomSelectorItemControl.ID = "CancelRoomSelectorItem" + ((int)(si + 1)).ToString();
         ucCancelRoomSelectorItemControl.RoomRefID = ((int)(si + 1)).ToString();
         ucCancelRoomSelectorItemControl.RoomOccupantSelection = objRoomOccupantSelection;
         ucCancelRoomSelectorItemControl.RoomType = HotelBookingReadSegments[si].RoomType;
         ucCancelRoomSelectorItemControl.RatePlan = HotelBookingReadSegments[si].RatePlan;
         ucCancelRoomSelectorItemControl.Rates = HotelBookingReadSegments[si].Rates;
         ucCancelRoomSelectorItemControl.CancelPolicy = HotelBookingReadSegments[si].CancelPolicy;
         ucCancelRoomSelectorItemControl.HotelCode = HotelBookingReadSegments[si].HotelCode;
         ucCancelRoomSelectorItemControl.ArrivalDate = HotelBookingReadSegments[si].ArrivalDate.Date;
         ucCancelRoomSelectorItemControl.ConfirmationNumber = HotelBookingReadSegments[si].ConfirmationNumber;
         ucCancelRoomSelectorItemControl.Selected = false;
         ucCancelRoomSelectorItemControl.SelectionMode = bIsCancelled ? SelectionMode.NonModifiable : SelectionMode.Edit;

         for (int i = 0; i < CancelDetailsEntryInfo.SelectedConfirmationNumbersToCancel.Length; i++)
         {
            if (HotelBookingReadSegments[si].ConfirmationNumber == CancelDetailsEntryInfo.SelectedConfirmationNumbersToCancel[i])
               ucCancelRoomSelectorItemControl.Selected = true;
         }

         for (int pi = 0; pi < HotelBookingReadSegments[si].PackageRates.Length; pi++)
         {
            CancelAddOnPackageItemControl ucCancelAddOnPackageItemControl = (CancelAddOnPackageItemControl)LoadControl(strCancelAddOnPackageItemControlPath);
            ucCancelRoomSelectorItemControl.AddCancelAddOnPackageItem(ucCancelAddOnPackageItemControl);

            ucCancelAddOnPackageItemControl.ID = "CancelAddOnPackageItem" + ((int)(pi + 1)).ToString();
            ucCancelAddOnPackageItemControl.RoomRefID = ((int)(si + 1)).ToString();
            ucCancelAddOnPackageItemControl.NumberStayNights = intNumberStayNights;
            ucCancelAddOnPackageItemControl.PackageQuantity = HotelBookingReadSegments[si].PackageRates[pi].Quantity;
            ucCancelAddOnPackageItemControl.PackageRate = HotelBookingReadSegments[si].PackageRates[pi];
         }

          }

          return;
    }
    private string[] GetImageGalleryImageTitles(HotelDescriptiveInfo objHotelDescriptiveInfo)
    {
        List<string> lTitles = new List<string>();

        if (objHotelDescriptiveInfo != null)
        {
            for (int i = 0; i < objHotelDescriptiveInfo.Images.Length; i++)
            {
                if (objHotelDescriptiveInfo.Images[i].CategoryCode == HotelImageCategoryCode.PhotoGallery && !lTitles.Contains(objHotelDescriptiveInfo.Images[i].ContentTitle))
                    lTitles.Add(objHotelDescriptiveInfo.Images[i].ContentTitle);
            }

        }

        return lTitles.ToArray();
    }
    private HotelImage GetImageGalleryThumbnailImage(string strImageTitle, HotelDescriptiveInfo objHotelDescriptiveInfo)
    {
        for (int i = 0; i < objHotelDescriptiveInfo.Images.Length; i++)
        {
            if (objHotelDescriptiveInfo.Images[i].CategoryCode == HotelImageCategoryCode.PhotoGallery && objHotelDescriptiveInfo.Images[i].ContentTitle == strImageTitle && objHotelDescriptiveInfo.Images[i].ImageSize == HotelImageSize.Thumbnail)
            {
                return objHotelDescriptiveInfo.Images[i];
            }

        }

        return null;
    }
    private void ConfigureGuestDetailsEntryControl()
    {
        HotelAvailabilityRS objHotelAvailabilityRS = (HotelAvailabilityRS)Session["HotelAvailabilityRS"];
        HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];
        RoomRateSelection[] objRoomRateSelections = (RoomRateSelection[])Session["RoomRateSelections"];
        GuestDetailsEntryInfo objGuestDetailsEntryInfo = (GuestDetailsEntryInfo)Session["GuestDetailsEntryInfo"];
        PaymentGatewayInfo[] objPaymentGatewayInfos = (PaymentGatewayInfo[])Session[Constants.Sessions.PaymentGatewayInfos];
        PaymentGatewayInfo objPaymentGatewayInfo = (PaymentGatewayInfo)Session[Constants.Sessions.PaymentGatewayInfo];
        HotelBookingPaymentAllocation[] objHotelBookingPaymentAllocations = (HotelBookingPaymentAllocation[])Session[Constants.Sessions.HotelBookingPaymentAllocations];
        bool bBookingTermsConditionsAccepted = (bool)Session["BookingTermsConditionsAccepted"];

        HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo();

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

        PaymentCardApplication enumPaymentCardApplicationStatus = WBSPGHelper.GetPaymentCardApplicationStatus(objHotelBookingPaymentAllocations);

        decimal decTotalPaymentCardPayment = WBSPGHelper.GetTotalPaymentCardPayment(objHotelBookingPaymentAllocations);

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

        string[] objPaymentCardCodes = objHotelDescriptiveInfo.CreditCardCodes;

        for (int i = 0; i < objPaymentCardCodes.Length; i++) // mask out cards with no name lookup
        {
            if ((String)GetGlobalResourceObject("SiteResources", "CardType" + objPaymentCardCodes[i]) != null && (String)GetGlobalResourceObject("SiteResources", "CardType" + objPaymentCardCodes[i]) != "")
                lPaymentCardCodes.Add(objPaymentCardCodes[i]);
        }

        objPaymentCardCodes = lPaymentCardCodes.ToArray();

        if (objPaymentGatewayInfos != null && objPaymentGatewayInfos.Length != 0 && decTotalPaymentCardPayment != 0 && ConfigurationManager.AppSettings["EnterGuestDetailsPage.PaymentGatewayAcceptedCardsOnly"] == "1")
            objPaymentCardCodes = WBSPGHelper.GetPaymentGatewayAcceptedCardTypes(objPaymentGatewayInfos);

        bool bPaymentGatewayPreSelectRequired = false;

        if (objPaymentGatewayInfo == null && WBSPGHelper.IsPaymentGatewayPreSelectRequired(objPaymentGatewayInfos, objHotelBookingPaymentAllocations))
            bPaymentGatewayPreSelectRequired = true;

        XHS.WBSUIBizObjects.Profile objProfile = WbsUiHelper.GetLoginLinkedProfile();

        bool bDisplayProfileGuarantee = false;

        if (objProfile != null && objProfile.PermitProfileGuarantee && (enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeOnly || enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeAndDeposit))
        {
            bDisplayProfileGuarantee = true;
        }

        ucGuestDetailsEntryControl.HotelDescriptiveInfo = objHotelDescriptiveInfo;
        ucGuestDetailsEntryControl.GuestDetailsEntryInfo = objGuestDetailsEntryInfo;
        ucGuestDetailsEntryControl.MembershipPrograms = WbsUiHelper.GetMembershipPrograms(((StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection]).HotelCode);
        ucGuestDetailsEntryControl.PaymentCardCodes = objPaymentCardCodes;
        ucGuestDetailsEntryControl.TermsConditionsAccepted = bBookingTermsConditionsAccepted;
        ucGuestDetailsEntryControl.PaymentGatewayInfos = objPaymentGatewayInfos;
        ucGuestDetailsEntryControl.PaymentGatewayPreSelectRequired = bPaymentGatewayPreSelectRequired;
        ucGuestDetailsEntryControl.SelectedPaymentGateway = objPaymentGatewayInfo;
        ucGuestDetailsEntryControl.PaymentCardApplicationStatus = enumPaymentCardApplicationStatus;
        ucGuestDetailsEntryControl.PaymentCardDepositAmount = decTotalPaymentCardPayment;
        ucGuestDetailsEntryControl.PaymentCardDepositCurrencyCode = objHotelDescriptiveInfo.CurrencyCode;
        ucGuestDetailsEntryControl.DisplayProfileGuarantee = bDisplayProfileGuarantee;

        return;
    }
    public static HotelPaymentRQ GetHotelPaymentRQ(PaymentGatewayInfo objPaymentGatewayInfo, HotelBookingPaymentAllocation[] objHotelBookingPaymentAllocations, HotelDescriptiveInfo objHotelDescriptiveInfo, GuestDetailsEntryInfo objGuestDetailsEntryInfo, string strCultureCode, string strUICultureCode)
    {
        HotelPaymentRQ objHotelPaymentRQ = new HotelPaymentRQ();

        objHotelPaymentRQ.RequestTransID = Guid.NewGuid().ToString();
        objHotelPaymentRQ.PaymentGateway = objPaymentGatewayInfo;
        objHotelPaymentRQ.PaymentType = PaymentType.Payment;
        objHotelPaymentRQ.PaymentMethod = PaymentMethod.PaymentCard;
        objHotelPaymentRQ.PaymentAmounts = objHotelBookingPaymentAllocations;
        objHotelPaymentRQ.PaymentTransRefID = DateTime.UtcNow.Ticks.ToString("00000000000000000000");
        objHotelPaymentRQ.PaymentTransInfo = "Hotel Accommodation";

        objHotelPaymentRQ.PaymentCard = new HotelBookingPaymentCard();

        if (objPaymentGatewayInfo.Mode == PaymentGatewayMode.MerchantSiteCapturesCardDetails)
        {
            objHotelPaymentRQ.PaymentCard.PaymentCardType = objGuestDetailsEntryInfo.PaymentCardType;
            objHotelPaymentRQ.PaymentCard.PaymentCardNumber = objGuestDetailsEntryInfo.PaymentCardNumber;
            objHotelPaymentRQ.PaymentCard.PaymentCardHolder = objGuestDetailsEntryInfo.PaymentCardHolder;
            objHotelPaymentRQ.PaymentCard.PaymentCardEffectiveDate = objGuestDetailsEntryInfo.PaymentCardEffectiveDate;
            objHotelPaymentRQ.PaymentCard.PaymentCardExpireDate = objGuestDetailsEntryInfo.PaymentCardExpireDate;
            objHotelPaymentRQ.PaymentCard.PaymentCardIssueNumber = objGuestDetailsEntryInfo.PaymentCardIssueNumber;
            objHotelPaymentRQ.PaymentCard.PaymentCardSecurityCode = objGuestDetailsEntryInfo.PaymentCardSecurityCode;
        }

        else if (objPaymentGatewayInfo.Mode == PaymentGatewayMode.PaymentGatewayCapturesCardDetails)
        {
            objHotelPaymentRQ.PaymentCard.PaymentCardType = "";
            objHotelPaymentRQ.PaymentCard.PaymentCardNumber = "";
            objHotelPaymentRQ.PaymentCard.PaymentCardHolder = "";
            objHotelPaymentRQ.PaymentCard.PaymentCardEffectiveDate = "";
            objHotelPaymentRQ.PaymentCard.PaymentCardExpireDate = "";
            objHotelPaymentRQ.PaymentCard.PaymentCardIssueNumber = "";
            objHotelPaymentRQ.PaymentCard.PaymentCardSecurityCode = "";
        }

        objHotelPaymentRQ.HotelCode = objHotelDescriptiveInfo.HotelCode;
        objHotelPaymentRQ.CurrencyCode = objHotelDescriptiveInfo.CurrencyCode;
        objHotelPaymentRQ.CultureCode = strCultureCode;
        objHotelPaymentRQ.UICultureCode = strUICultureCode;

        return objHotelPaymentRQ;
    }
    private void ConfigureRoomRateSelectorControl(RoomDetailSelectorControl ucRoomDetailSelectorControl, HotelRoomAvailInfo objHotelRoomAvailInfo, HotelDescriptiveInfo objHotelDescriptiveInfo)
    {
        // Selected Mode
          var selectedRoomRate = (from rrs in RoomRateSelections
                              where rrs.RoomRefID == ucRoomDetailSelectorControl.RoomRefID
                              select rrs).FirstOrDefault();

          // Edit Mode
          if (Step == BookingSteps.SelectRoomDetail
              && CurrentRoomRefID == ucRoomDetailSelectorControl.RoomRefID
              && ucRoomDetailSelectorControl.Step == RoomDetailSelectionStep.SelectRoomType)
          {
         List<string> roomTypesForFilter = new List<string>();
         foreach (var roomType in objHotelRoomAvailInfo.RoomTypes)
         {
            bool bRatesAvailable = false;
            HotelAvailRoomType localRoomType = roomType;
            var roomRates = objHotelRoomAvailInfo.RoomRates.Where(item => item.RoomTypeCode == localRoomType.Code);
            if (roomRates.Count() <= 0)
               continue;

            foreach (HotelAvailRoomRate roomRate in roomRates)
            {
               var localRoomRate = roomRate;
               if (!IsRoomRateDescriptionModel || localRoomRate.DescriptionStatus == RoomRateDescriptionStatus.Active)
               {
                  bRatesAvailable = true;
                  break;
               }

               var ratePlans = objHotelRoomAvailInfo.RatePlans.Where(ratePlan => ratePlan.Code == localRoomRate.RatePlanCode &&
                       (ratePlan.Type == RatePlanType.Negotiated || ratePlan.Type == RatePlanType.Consortia));

               if (ratePlans.Count() > 0)
                  bRatesAvailable = true;
            }

            if (!bRatesAvailable)
               continue;

            HtmlGenericControl rtPanelWrapper = new HtmlGenericControl("div");
            rtPanelWrapper.Attributes.Add("class", "mm_roomrate_info mm_background_info");
            HtmlGenericControl rtPanel = new HtmlGenericControl("div");
            rtPanel.Attributes.Add("class", "mm_roomrate_content mm_text_info");
            HtmlGenericControl rtName = new HtmlGenericControl("span");
            rtName.Attributes.Add("class", "mm_text_x_strong");
            rtName.InnerText = roomType.Name;
            rtPanelWrapper.Controls.Add(rtPanel);
            rtPanel.Controls.Add(rtName);
            ucRoomDetailSelectorControl.AddRoomTypeControl(rtPanelWrapper);

            foreach (HotelAvailRoomRate roomRate in roomRates)
            {
               var localRoomRate = roomRate;
               if (IsRoomRateDescriptionModel && localRoomRate.DescriptionStatus == RoomRateDescriptionStatus.Inactive)
               {
                  HotelAvailRoomRate cpRoomRate = localRoomRate;
                  var ratePlans = from ratePlan in objHotelRoomAvailInfo.RatePlans
                                  where ratePlan.Code == cpRoomRate.RatePlanCode && ratePlan.Type != RatePlanType.Negotiated && ratePlan.Type != RatePlanType.Consortia
                                  select ratePlan;
                  if (ratePlans.Count() > 0)
                     continue;
               }

               RatePlanSelectorItemControl ucRatePlanSelectorItemControl = (RatePlanSelectorItemControl)LoadControl(strRatePlanSelectorItemControlPath);
               ucRatePlanSelectorItemControl.Mode = (CurrentRoomDetailStep == RoomDetailSelectionStep.SelectRoomType ? SelectionMode.Edit : SelectionMode.Selected);
               ucRatePlanSelectorItemControl.ID = string.Format("{0}_{1}_{2}_{3}", "RatePlanSelectorItem"
                   , ucRoomDetailSelectorControl.RoomRefID
                   , localRoomRate.RoomTypeCode
                   , RemoveSpecialCharFromString(localRoomRate.RatePlanCode));
               ucRatePlanSelectorItemControl.RoomRefID = ucRoomDetailSelectorControl.RoomRefID;
               ucRatePlanSelectorItemControl.RoomRate = localRoomRate;
               ucRatePlanSelectorItemControl.RoomTypeDescription = objHotelDescriptiveInfo.RoomTypes.FirstOrDefault(item => item.Code == localRoomType.Code);
               ucRatePlanSelectorItemControl.CreditCardCodes = objHotelDescriptiveInfo.CreditCardCodes;
               ucRatePlanSelectorItemControl.Selected = false;
               ucRatePlanSelectorItemControl.RatePlan = objHotelRoomAvailInfo.RatePlans.FirstOrDefault(item => item.Code == localRoomRate.RatePlanCode);
               ucRatePlanSelectorItemControl.IsShowPhotoLink = !(Step == BookingSteps.Confirmed || Step == BookingSteps.GuestInfo);
               ucRatePlanSelectorItemControl.RoomRateSelected += ucRoomDetailSelectorControl_RatePlanSelected;

               ucRoomDetailSelectorControl.AddRatePlanSelectorItem(ucRatePlanSelectorItemControl);

               if (!roomTypesForFilter.Contains(roomRate.RoomTypeCode) && !string.IsNullOrWhiteSpace(roomRate.RoomTypeCode))
                  roomTypesForFilter.Add(roomRate.RoomTypeCode);

            }
         }

         if (!bShowRoomTypePhoto)
            ucRemoteContentContainer.Src += string.Format("?show={0}", string.Join(",", roomTypesForFilter));
          }

          else if (selectedRoomRate != null && !string.IsNullOrWhiteSpace(selectedRoomRate.RatePlanCode))
          {
         HotelAvailRoomRate roomRate = (from item in objHotelRoomAvailInfo.RoomRates
                                        where item.RoomTypeCode == selectedRoomRate.RoomTypeCode && item.RatePlanCode == selectedRoomRate.RatePlanCode
                                        select item).FirstOrDefault();

         RatePlanSelectorItemControl ucSelectedRatePlanSelectorItemControl = (RatePlanSelectorItemControl)LoadControl(strRatePlanSelectorItemControlPath);
         ucSelectedRatePlanSelectorItemControl.Mode = (this.bIsConfirmed ? SelectionMode.NonModifiable : SelectionMode.Selected);
         ucSelectedRatePlanSelectorItemControl.ID = string.Format("{0}_{1}_{2}_{3}"
             , "SelectedRatePlanSelectorItem"
             , ucRoomDetailSelectorControl.RoomRefID
             , selectedRoomRate.RoomTypeCode
             , RemoveSpecialCharFromString(selectedRoomRate.RatePlanCode));
         ucSelectedRatePlanSelectorItemControl.RoomRefID = selectedRoomRate.RoomRefID;
         ucSelectedRatePlanSelectorItemControl.RoomRate = roomRate;
         ucSelectedRatePlanSelectorItemControl.RoomTypeDescription = objHotelDescriptiveInfo.RoomTypes.FirstOrDefault(item => item.Code == selectedRoomRate.RoomTypeCode);
         ucSelectedRatePlanSelectorItemControl.CreditCardCodes = objHotelDescriptiveInfo.CreditCardCodes;
         ucSelectedRatePlanSelectorItemControl.RatePlan = objHotelRoomAvailInfo.RatePlans.FirstOrDefault(item => item.Code == selectedRoomRate.RatePlanCode);
         ucSelectedRatePlanSelectorItemControl.IsShowPhotoLink = !(Step == BookingSteps.Confirmed || Step == BookingSteps.GuestInfo);

         ucRoomDetailSelectorControl.AddSelectedRoomRate(ucSelectedRatePlanSelectorItemControl);
          }
    }