Beispiel #1
0
        public ActionResult BookHotelFinal(FormCollection collection)
        {
            //AuthHeader
            Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader();
            auth.LoginName = "Tra105";
            auth.Password  = "******";

            //SearchHotelRequest
            Common.hotelflowSvc.BookV3Request reqCriteria = new BookV3Request();
            reqCriteria.RecordLocatorId = 0;
            reqCriteria.HotelId         = Convert.ToInt32(collection["hotelCode"]);
            reqCriteria.HotelRoomTypeId = Convert.ToInt32(collection["hotelroomTypeId"]);

            reqCriteria.CheckIn  = Convert.ToDateTime(collection["startDate"]);
            reqCriteria.CheckOut = Convert.ToDateTime(collection["endDate"]);

            reqCriteria.RoomsInfo = new RoomReserveInfo[]
            {
                new RoomReserveInfo {
                    AdultNum  = 1,
                    ChildAges = new ChildAge[] { new ChildAge {
                                                     age = 5
                                                 } },
                    ChildNum         = 1,
                    ContactPassenger = new ContactPassenger {
                        FirstName = "Jack", LastName = "Rowling"
                    }
                }
            };

            reqCriteria.Currency    = "CAD";
            reqCriteria.PaymentType = PaymentTypes.Obligo;

            reqCriteria.RequestedPrice = ExtractDecimalFromString(collection["message"]);

            ViewBag.HotelId         = reqCriteria.HotelId;
            ViewBag.HotelRoomTypeId = reqCriteria.HotelRoomTypeId;

            HotelFlowClient client = new HotelFlowClient();

            RGInfoResults sreq;

            try
            {
                sreq = client.BookHotelV3(auth, reqCriteria, new Feature[] { new Feature {
                                                                                 name = "OriginalImageSize", value = "true"
                                                                             } });
            }
            catch (System.ServiceModel.FaultException ex)
            {
                return(View("PriceChange", ex));
            }
            finally
            {
                client.Close();
            }

            return(View("Confirmation", sreq.ResGroup));
        }
        // public ActionResult BookHotel(int hotelId,int hotelroomTypeId, Decimal occPubPrice)
        public ActionResult BookHotel(FormCollection collection)
        {
            //AuthHeader
            Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader();
            auth.LoginName = "Tra105";
            auth.Password = "******";

            //SearchHotelRequest
            Common.hotelflowSvc.BookV3Request reqCriteria = new BookV3Request();
            reqCriteria.RecordLocatorId = 0;
            reqCriteria.HotelId = Convert.ToInt32(collection["hotelCode"]);
            reqCriteria.HotelRoomTypeId = Convert.ToInt32(collection["hotelroomTypeId"]);

            reqCriteria.CheckIn = Convert.ToDateTime(collection["startDate"]);
            reqCriteria.CheckOut = Convert.ToDateTime(collection["endDate"]);

            reqCriteria.RoomsInfo = new RoomReserveInfo[]
            {
                new RoomReserveInfo {  AdultNum = 1,
                                       ChildAges =  new ChildAge[] { new ChildAge { age = 5 } },
                                       ChildNum  = 1 ,
                                       ContactPassenger = new ContactPassenger { FirstName = "Jack", LastName = "Rowling" }
                                    }
            };

            reqCriteria.Currency = "CAD";
            reqCriteria.PaymentType = PaymentTypes.Obligo;
            reqCriteria.RequestedPrice = Convert.ToDecimal(collection["occPubPrice"]);

            ViewBag.HotelId = reqCriteria.HotelId;
            ViewBag.HotelRoomTypeId = reqCriteria.HotelRoomTypeId;

            HotelFlowClient client = new HotelFlowClient();

            RGInfoResults sreq;

            try
            {
                sreq = client.BookHotelV3(auth, reqCriteria, new Feature[] { new Feature { name = "OriginalImageSize", value = "true" } });

            }
            catch (System.ServiceModel.FaultException ex)
            {
                return View("PriceChange", ex);
            }
            finally
            {
                client.Close();
            }

            return View("Confirmation", sreq.ResGroup);
        }