Exemple #1
0
        private async void button_HotelRateAmountNotif_Click(object sender, RoutedEventArgs e)
        {
            //
            // Set up one or more RateAmountMessage.  Just using some random data.
            //

            #region RateAmountMessages setup

            List <RateAmountMessage> rateAmountMessageList = new List <RateAmountMessage>();

            #region Rates setup

            List <RateAmountMessage.Rates.Rate> rateNodeList = new List <RateAmountMessage.Rates.Rate>();

            DateTime start = new DateTime(2016, 8, 15);
            DateTime end   = new DateTime(2016, 8, 18);
            RateAmountMessage.Rates.Rate rate = new RateAmountMessage.Rates.Rate(start, end, "AUD", null, null, null);
            rateNodeList.Add(rate);     // Add a Rate to Rates.

            RateAmountMessage.Rates rates = new RateAmountMessage.Rates(rateNodeList);

            #endregion

            RateAmountMessage.StatusApplicationControl statusApplicationControl = new RateAmountMessage.StatusApplicationControl(null, null, null);
            RateAmountMessage rateAmountMessage = new RateAmountMessage(statusApplicationControl, rates);
            rateAmountMessageList.Add(rateAmountMessage); // Add a RateAmountMessage to RateAmountMessages.

            RateAmountMessages rateAmountMessages = new RateAmountMessages(hotelCode, rateAmountMessageList);

            #endregion


            HotelRateAmountNotifRQResponse availResponse = await OTA_HotelRateAmountNotifRQ(pmsID, username, password, rateAmountMessages);
        }
Exemple #2
0
        static public async Task <HotelRateAmountNotifRQResponse> OTA_HotelRateAmountNotifRQ(string pmsID, string usernameAuthenticate, string passwordAuthenticate, RateAmountMessages rateAmountMessages)
        {
            HotelRateAmountNotifRQResponse response = null;

            try
            {
                PmsXchangeServiceClient    service = new AsyncServiceConnection().service;
                OTA_HotelRateAmountNotifRQ body    = new OTA_HotelRateAmountNotifRQ()
                {
                    Version = 1.0M, EchoToken = Guid.NewGuid().ToString() /* Echo token must be unique.*/, TimeStamp = DateTime.Now, TimeStampSpecified = true, POS = CreatePOS(pmsID), RateAmountMessages = new OTA_HotelRateAmountNotifRQRateAmountMessages()
                };
                body.RateAmountMessages.HotelCode         = rateAmountMessages.HotelCode;
                body.RateAmountMessages.RateAmountMessage = new RateAmountMessageType[rateAmountMessages.RateAmountMessageNodeList.Count];

                //
                // IMPORTANT NOTE:
                //  There was a slight error made in filling out the body elements for this request.  I delegted the bad code
                //  and left this framework.  Use thde codel in the OTA_HotelAvailNotifR API as a model to complete it.

                /*
                 * int index = 0;
                 *
                 * foreach (RateAmountMessages.RateAmountMessage rAM in rateAmountMessages.RateAmountMessageNodeList)
                 * {
                 * }
                 */

                //
                // Send rates update.
                //

                response = await service.HotelRateAmountNotifRQAsync(CreateSecurityHeader(usernameAuthenticate, passwordAuthenticate), body).ConfigureAwait(false);
            }
            catch (NullReferenceException)
            {
                Exception exSetup = new Exception("OTA_HotelRateAmountNotifRQ arguments were not set up properly causing a null reference exception.");
                response = new HotelRateAmountNotifRQResponse();
                response.OTA_HotelRateAmountNotifRS       = new MessageAcknowledgementType();
                response.OTA_HotelRateAmountNotifRS.Items = new object[] { ProcessingException(exSetup) };
            }
            catch (Exception ex)
            {
                response = new HotelRateAmountNotifRQResponse();
                response.OTA_HotelRateAmountNotifRS       = new MessageAcknowledgementType();
                response.OTA_HotelRateAmountNotifRS.Items = new object[] { ProcessingException(ex) };
            }

            return(response);
        }