static public void OTA_NotifReportRQ(string usernameAuthenticate, string passwordAuthenticate) { PmsXchangeServiceClient service = new PmsXchangeServiceClient(); OTA_NotifReportRQ otaRequestBody = new OTA_NotifReportRQ(); service.NotifReportRQ(CreateSecurityHeader(usernameAuthenticate, passwordAuthenticate), otaRequestBody); }
static public async Task <NotifReportRQResponse> OTA_NotifReportRQ(string usernameAuthenticate, string passwordAuthenticate, ReservationError resError, string resStatus, DateTime dateTimeStamp, string msgID, string resIDPMS) { NotifReportRQResponse response = null; try { PmsXchangeServiceClient service = new AsyncServiceConnection().service; OTA_NotifReportRQ body = new OTA_NotifReportRQ() { Version = 1.0M, EchoToken = Guid.NewGuid().ToString() /* Echo token must be unique. */, TimeStamp = DateTime.Now, TimeStampSpecified = true }; if (resError == null) { body.Items = new object[] { new SuccessType() }; } else { ErrorType errorType = API.CreateErrorType(resError.err, resError.ewt, resError.errorText); ErrorsType errors = new ErrorsType(); ErrorType[] error = { errorType }; errors.Error = error; body.Items = new object[] { errors }; } body.NotifDetails = new OTA_NotifReportRQNotifDetails(); body.NotifDetails.HotelNotifReport = new OTA_NotifReportRQNotifDetailsHotelNotifReport(); OTA_NotifReportRQNotifDetailsHotelNotifReportHotelReservations hotelReservations = new OTA_NotifReportRQNotifDetailsHotelNotifReportHotelReservations(); body.NotifDetails.HotelNotifReport.Item = hotelReservations; OTA_NotifReportRQNotifDetailsHotelNotifReportHotelReservationsHotelReservation[] hotelReservationList = new OTA_NotifReportRQNotifDetailsHotelNotifReportHotelReservationsHotelReservation[1]; hotelReservationList[0] = new OTA_NotifReportRQNotifDetailsHotelNotifReportHotelReservationsHotelReservation(); hotelReservations.HotelReservation = hotelReservationList; hotelReservations.HotelReservation[0].ResStatus = resStatus; if (resStatus == "Book") { hotelReservations.HotelReservation[0].CreateDateTime = dateTimeStamp; } else { hotelReservations.HotelReservation[0].LastModifyDateTime = dateTimeStamp; } hotelReservations.HotelReservation[0].UniqueID = new UniqueID_Type[1]; hotelReservations.HotelReservation[0].UniqueID[0] = new UniqueID_Type(); hotelReservations.HotelReservation[0].UniqueID[0].Type = OTA_ID_Type.Reference.ToString("d"); hotelReservations.HotelReservation[0].UniqueID[0].ID = msgID; // // Only include the reservation ID info if there was no error processin this reservation. // if (resError == null) { hotelReservations.HotelReservation[0].ResGlobalInfo = new ResGlobalInfoType(); hotelReservations.HotelReservation[0].ResGlobalInfo.HotelReservationIDs = new HotelReservationIDsTypeHotelReservationID[1]; hotelReservations.HotelReservation[0].ResGlobalInfo.HotelReservationIDs[0] = new HotelReservationIDsTypeHotelReservationID(); hotelReservations.HotelReservation[0].ResGlobalInfo.HotelReservationIDs[0].ResID_Type = OTA_ID_Type.Reservation.ToString("d"); hotelReservations.HotelReservation[0].ResGlobalInfo.HotelReservationIDs[0].ResID_Value = resIDPMS; } body.NotifDetails.HotelNotifReport.Item = hotelReservations; response = await service.NotifReportRQAsync(CreateSecurityHeader(usernameAuthenticate, passwordAuthenticate), body).ConfigureAwait(false); } catch (NullReferenceException) { Exception exSetup = new Exception("OTA_NotifReportRQ arguments were not set up properly causing a null reference exception."); response = new NotifReportRQResponse(); response.OTA_NotifReportRS = new MessageAcknowledgementType(); response.OTA_NotifReportRS.Items = new object[] { ProcessingException(exSetup) }; } catch (Exception ex) { response = new NotifReportRQResponse(); response.OTA_NotifReportRS = new MessageAcknowledgementType(); response.OTA_NotifReportRS.Items = new object[] { ProcessingException(ex) }; } return(response); }