Exemplo n.º 1
0
        private async void button_NotifReport_Click(object sender, RoutedEventArgs e)
        {
            WriteResponseLine(string.Format("Sending OTA_NotifReportRQ..."));

            foreach (HotelReservationType hotelReservation in reservationList.Items)
            {
                //
                // Get the pmsXchange reservation reference.
                //

                UniqueID_Type[] uniqueIDs = hotelReservation.UniqueID;
                string          resType   = uniqueIDs[0].Type;
                string          resIDPMS  = uniqueIDs[0].ID;

                string msgType = uniqueIDs[1].Type;
                string msgID   = uniqueIDs[1].ID;

                string   resStatusText = hotelReservation.ResStatus;
                DateTime dateTimeStamp = resStatusText == "Book" ? hotelReservation.CreateDateTime : hotelReservation.LastModifyDateTime;

                //
                // Send a reservation confirmation.
                //

                NotifReportRQResponse confirmResponse = null;

                if (checkBox_Conf_Errror.IsChecked == false)
                {
                    confirmResponse = await OTA_NotifReportRQ(username, password, null, resStatusText, dateTimeStamp, msgID, resIDPMS);
                }
                else
                {
                    ReservationError resError = new ReservationError((OTA_EWT)comboBox_OTA_EWT.SelectedValue, (OTA_ERR)comboBox_OTA_ERR.SelectedValue, null);
                    confirmResponse = await OTA_NotifReportRQ(username, password, null, resStatusText, dateTimeStamp, msgID, resIDPMS);
                }

                //
                // Make sure that no errors were generated during confirmation!
                //

                if (confirmResponse.OTA_NotifReportRS.Items[0].GetType() == typeof(SuccessType))
                {
                    //
                    // Confirmation was processed correctly.
                    //

                    WriteResponseLine(string.Format("Reservation resID: {0} confirmed successfully.", resIDPMS));
                    button_NotifReport.IsEnabled = false;
                }
                else
                {
                    //
                    // Confirmation error.
                    //

                    string     timestamp = confirmResponse.OTA_NotifReportRS.TimeStamp.ToString();
                    ErrorsType errors    = (ErrorsType)confirmResponse.OTA_NotifReportRS.Items[0];

                    foreach (var error in errors.Error)
                    {
                        WriteResponseLine(string.Format("OTA_NotifReportRS error - Timestamp: {2},  Type: {0},  Value: {1}", error.Type, error.Value, timestamp));
                    }
                }
            }

            WriteResponseLine(string.Format(""));
        }
 public ReservationError ReservationError(DataRow row)
 {
     ReservationError result = new ReservationError
     {
         orderid = row.ReadNullableTrimmedString("orderid"),
         number = row.ReadInt("errnum", 0),
         message = row.ReadNullableTrimmedString("errmessage"),
         usermessage = row.ReadNullableTrimmedString("usermessage"),
         isstop = row.ReadBoolean("stop")
     };
     string errortype = row.ReadNullableTrimmedString("errtype");
     if (errortype != null)
     {
         string text = errortype.ToLower();
         if (text != null)
         {
             if (!(text == "system"))
             {
                 if (text == "user")
                 {
                     result.errortype = ReservationErrorType.user;
                 }
             }
             else
             {
                 result.errortype = ReservationErrorType.system;
             }
         }
     }
     return result;
 }
Exemplo n.º 3
0
 public ReservationException(ReservationError er)
 {
     _er = er;
 }