public static HotelBookingDetailResponse DetailService(string CRefNo) { var UName = ConfigurationSettings.AppSettings["TBOUserName"]; var UPass = ConfigurationSettings.AppSettings["TBOPassword"]; IHotelService proxy = TBOCredentials.CreateProxy(); HotelBookingDetailRequest req = new HotelBookingDetailRequest { Credentials = new AuthenticationData() { UserName = UName, Password = UPass }, //BookingId = BookId, //ConfirmationNo = ConfirmNo, ClientReferenceNumber = CRefNo }; var sid = new Guid(); ProviderLogger.LogBookingDetailReq(req, sid.ToString()); HotelBookingDetailResponse resp = new HotelBookingDetailResponse(); resp = proxy.HotelBookingDetail(req); ProviderLogger.LogBookingDetailRsp(resp, sid.ToString()); return(resp); }
public static void LogBookingDetailRsp(HotelBookingDetailResponse BookDetailResp, string SearchId) { string path = MainPath + @"\TBOLogs\" + DateTime.UtcNow.Date.ToString("dd_MM_yyyy") + @"\" + SearchId + @"\BookDetailResp\"; Directory.CreateDirectory(path); path = path + "BookDetailResp.txt"; try { XmlSerializer xmlSerializer = new XmlSerializer(BookDetailResp.GetType()); using (StreamWriter streamwriter = new StreamWriter(path, append: false)) { xmlSerializer.Serialize(streamwriter, BookDetailResp); streamwriter.Close(); } } catch (FileNotFoundException Ex) { throw new LoggerException(LoggerErrorCodes.LoggerFileNotFound, LoggerErrorCodes.LoggerFileNotFound + " -This path (" + path + ") doesn't exist with file name " + Ex.FileName + " .", Ex.Message); } catch (IOException Ex) { throw new LoggerException(LoggerErrorCodes.LoggerFileINProcess, LoggerErrorCodes.LoggerFileINProcess + " -This Logger File (" + path + ") in another process you can not access it right now.", Ex.Message); } catch (Exception Ex) { throw new LoggerException(LoggerErrorCodes.FailedLogIntoLogger, LoggerErrorCodes.FailedLogIntoLogger + " -Failed Log Into Logger with path (" + path + ").", Ex.Message); } }