public ActionResult Index(FormCollection collection)
        {
            HotelRateDescriptionRS priceBreakup = null;
            HotelSelectDto select = new HotelSelectDto();
            select.StartDate = Request.QueryString["startDate"];
            select.EndDate = Request.QueryString["endDate"];
            select.TotalTravellers = Request.QueryString["totalTravellers"];
            select.HotelCode = Request.QueryString["hotelCode"];
            select.RPHNumber = Request.QueryString["propertyRphNumber"];

            var session = SabreSessionManager.Create();
            select.SessionId = session.SecurityValue.BinarySecurityToken;
            var hotelDesc = new HotelPropertyDescription()
               .HotelDescription(select);

            //Get pricing information
            if (hotelDesc.RoomStay != null && hotelDesc.RoomStay.RoomRates != null)
            {
                HotelPricing pricing = new HotelPricing();
                select.RPHNumber = select.RPHNumber;
                priceBreakup = pricing.GetPricing(select);
            }

            SessionClose closeSession = new SessionClose();
            closeSession.Close(select.SessionId);

            return View(priceBreakup);
        }
        public EndTransactionRS Book(HotelSelectDto hotelSelectDto)
        {
            var session = SabreSessionManager.Create();
            hotelSelectDto.SessionId = session.SecurityValue.BinarySecurityToken;

            try
            {
                var hotelDescription = new HotelPropertyDescription()
                    .HotelDescription(hotelSelectDto);

                var addTravelerInfo = new AddTravelerInfo()
                    .AddTraveler(session.SecurityValue.BinarySecurityToken);

                var bookHotel = new BookHotel()
                    .Book(session.SecurityValue.BinarySecurityToken, hotelSelectDto.propertyRphNumber);

                var readTravelerInfo = new ReadTravelerInfo()
                    .ReadInfo(session.SecurityValue.BinarySecurityToken);

                var endTransaction = new EndTransaction().End(session.SecurityValue.BinarySecurityToken);

                return endTransaction;
                //var pnrDetails = new ReadTravelerInfo().ReadInfo(session.SecurityValue.BinarySecurityToken, endTransaction.ItineraryRef.ID);
                //return pnrDetails;
            }
            catch
            {
                throw;
            }
            finally
            {
                SessionClose close = new SessionClose();
                close.Close(session.SecurityValue.BinarySecurityToken);
            }
        }
Esempio n. 3
0
        public HotelRateDescriptionRS GetPricing(HotelSelectDto searchCriteria)
        {
            Security1 sec = new Security1();
            HotelRateDescriptionRQ req = new HotelRateDescriptionRQ();
            HotelRateDescriptionRQAvailRequestSegment availSeg =
                new HotelRateDescriptionRQAvailRequestSegment();
            HotelRateDescriptionRQAvailRequestSegmentGuestCounts guests =
                new HotelRateDescriptionRQAvailRequestSegmentGuestCounts();
            HotelRateDescriptionRQAvailRequestSegmentHotelSearchCriteria searchCrit =
                new HotelRateDescriptionRQAvailRequestSegmentHotelSearchCriteria();
            HotelRateDescriptionRQAvailRequestSegmentHotelSearchCriteriaCriterion criterian =
                new HotelRateDescriptionRQAvailRequestSegmentHotelSearchCriteriaCriterion();
            HotelRateDescriptionRQAvailRequestSegmentHotelSearchCriteriaCriterionHotelRef hotelRef =
                new HotelRateDescriptionRQAvailRequestSegmentHotelSearchCriteriaCriterionHotelRef();
            HotelRateDescriptionRQAvailRequestSegmentTimeSpan journeyDate =
                new HotelRateDescriptionRQAvailRequestSegmentTimeSpan();
            HotelRateDescriptionRQAvailRequestSegmentRatePlanCandidates ratePlans =
                new HotelRateDescriptionRQAvailRequestSegmentRatePlanCandidates();
            HotelRateDescriptionRQAvailRequestSegmentRatePlanCandidatesRatePlanCandidate ratePlan =
                new HotelRateDescriptionRQAvailRequestSegmentRatePlanCandidatesRatePlanCandidate();

            var startDate = Convert.ToDateTime(searchCriteria.StartDate);
            var endDate = Convert.ToDateTime(searchCriteria.EndDate);
            journeyDate.Start = startDate.Month.ToString() + "-" + startDate.Day.ToString();
            journeyDate.End = endDate.Month.ToString() + "-" + endDate.Day.ToString(); ;

            hotelRef.HotelCode = searchCriteria.HotelCode;
            criterian.HotelRef = hotelRef;
            searchCrit.Criterion = criterian;

            guests.Count = searchCriteria.TotalTravellers;

            ratePlan.RateCode = "USD";
            ratePlan.RPH = searchCriteria.RPHNumber.TrimStart('0');
            ratePlans.RatePlanCandidate = ratePlan;

            /*availSeg.HotelSearchCriteria = searchCrit;
            availSeg.GuestCounts = guests;
            availSeg.TimeSpan = journeyDate;              */
            availSeg.RatePlanCandidates = ratePlans;

            req.AvailRequestSegment = availSeg;

            HotelRateDescriptionService client = new HotelRateDescriptionService();
            client.MessageHeaderValue = Get("HotelRateDescriptionLLSRQ", "HotelRateDescriptionRQ");
            sec.BinarySecurityToken = searchCriteria.SessionId;
            client.Security = sec;

            var result = client.HotelRateDescriptionRQ(req);

            var XML = Common.Utility.Serialize(result);
            return result;
        }
        public ActionResult Index(FormCollection collection)
        {
            HotelSelectDto select = new HotelSelectDto();
            select.StartDate = collection["startDate"];
            select.EndDate = collection["endDate"];
            select.TotalTravellers = collection["totalTravellers"];
            select.HotelCode = collection["hotelCode"];
            select.propertyRphNumber = collection["propertyRphNumber"].TrimStart('0');

            var pnrDetails = new HotelBookingManager().Book(select);

            return View(pnrDetails);
        }
        public HotelPropertyDescriptionRS HotelDescription(HotelSelectDto search)
        {
            HotelPropertyDescriptionRQ hpdrq = new HotelPropertyDescriptionRQ();

            hpdrq.AvailRequestSegment
                = new HotelPropertyDescriptionRQAvailRequestSegment();

            hpdrq.AvailRequestSegment.GuestCounts
                = new HotelPropertyDescriptionRQAvailRequestSegmentGuestCounts();
            hpdrq.AvailRequestSegment.GuestCounts.Count = search.TotalTravellers;

            hpdrq.AvailRequestSegment.HotelSearchCriteria =
                new HotelPropertyDescriptionRQAvailRequestSegmentHotelSearchCriteria();
            hpdrq.AvailRequestSegment.HotelSearchCriteria.Criterion
                = new HotelPropertyDescriptionRQAvailRequestSegmentHotelSearchCriteriaCriterion();
            hpdrq.AvailRequestSegment.HotelSearchCriteria.Criterion.HotelRef
                = new HotelPropertyDescriptionRQAvailRequestSegmentHotelSearchCriteriaCriterionHotelRef();
            hpdrq.AvailRequestSegment.HotelSearchCriteria.Criterion.HotelRef.HotelCode = search.HotelCode;

            hpdrq.AvailRequestSegment.TimeSpan
                = new HotelPropertyDescriptionRQAvailRequestSegmentTimeSpan();
            hpdrq.AvailRequestSegment.TimeSpan.Start = search.StartDate;
            hpdrq.AvailRequestSegment.TimeSpan.End = search.EndDate;

            Security1 security = new Security1();
            security.BinarySecurityToken = search.SessionId;

            HotelPropertyDescriptionService hpds = new HotelPropertyDescriptionService();

            hpds.MessageHeaderValue = this.CreateMessageHeader();
            hpds.Security = security;

            var result =  hpds.HotelPropertyDescriptionRQ(hpdrq);
            var XML = Common.Utility.Serialize(result);
            return result;
        }