示例#1
0
        public void GetHotelInfo(int wid, string openid, int hotelId)
        {
            AjaxResult ajaxResult;

            try
            {
                GetHotelResponse responseData = null;
                IAsyncResult     asyncResult  = new BusEntry("WeixinPF.Hotel.Plugins").MyBus.Send("WeixinPF.Hotel.Plugins.Service",
                                                                                                  new GetHotelRequest()
                {
                    HotelId = hotelId
                })
                                                .Register(response =>
                {
                    CompletionResult result = response.AsyncState as CompletionResult;
                    if (result != null)
                    {
                        responseData = result.Messages[0] as GetHotelResponse;
                    }
                }, this);

                WaitHandle asyncWaitHandle = asyncResult.AsyncWaitHandle;
                asyncWaitHandle.WaitOne(WaitSeconds);

                ajaxResult = asyncResult.IsCompleted ?
                             AjaxResult.Succeed(responseData) :
                             AjaxResult.Fail("获取酒店信息失败。");
            }
            catch (Exception ex)
            {
                ajaxResult = AjaxResult.Fail("获取酒店信息失败。");
            }
            this.WriteJson(ajaxResult);
        }
示例#2
0
    private void GetHotelData()
    {
        //Define Credentials
        HotelCredentials credentials = new HotelCredentials();

        credentials.username = "******";
        credentials.password = "******";

        //Define Request parameters
        GetHotelRequest req = new GetHotelRequest();

        req.HotelCredentials = credentials;
        req.hotelId          = 105304;

        //Define a Hotel object
        Hotel hotel = new Hotel();

        //Get Response in the Hotel Object
        GetHotelResponse response = new GetHotelResponse();

        response = soap.GetHotel(req);
        hotel    = response.GetHotelResult;

        if (hotel != null)
        {
            //Bind Data to controls
            lblHotelId.Text     = "Hotel ID: " + hotel.HotelID.ToString();
            lblHotelName.Text   = "Hotel Name: " + (string.IsNullOrEmpty(hotel.Name) ? string.Empty : hotel.Name);
            lblAirportCode.Text = "Hotel AirportCode: " + hotel.AirportCode.ToString();
            lblAddress.Text     = "Hotel Address: " + (string.IsNullOrEmpty(hotel.Address1) ? string.Empty : hotel.Address1)
                                  + "<br />" + (string.IsNullOrEmpty(hotel.Address2) ? string.Empty : hotel.Address2)
                                  + "<br />" + (string.IsNullOrEmpty(hotel.Address3) ? string.Empty : hotel.Address3);
        }
    }