public static HotelCancelResponse Cancel(string ConfirmNo) { var UName = ConfigurationSettings.AppSettings["TBOUserName"]; var UPass = ConfigurationSettings.AppSettings["TBOPassword"]; HotelCancelRequest req = new HotelCancelRequest { Credentials = new AuthenticationData() { UserName = UName, Password = UPass }, //RequestType = "HotelCancel", ConfirmationNo = ConfirmNo, Remarks = "test cancel" }; IHotelService proxy = TBOCredentials.CreateProxy(); var sid = new Guid(); ProviderLogger.LogHotelCancelReq(req, sid.ToString()); HotelCancelResponse resp = new HotelCancelResponse(); resp = proxy.HotelCancel(req); ProviderLogger.LogHotelCancelResp(resp, sid.ToString()); return(resp); }
public static void LogHotelCancelResp(HotelCancelResponse HotelCancelResp, string SearchId) { string path = MainPath + @"\TBOLogs\" + DateTime.UtcNow.Date.ToString("dd_MM_yyyy") + @"\" + SearchId + @"\CancelResp\"; Directory.CreateDirectory(path); path = path + "HotelCancelResp.txt"; try { XmlSerializer xmlSerializer = new XmlSerializer(HotelCancelResp.GetType()); using (StreamWriter streamwriter = new StreamWriter(path, append: false)) { xmlSerializer.Serialize(streamwriter, HotelCancelResp); 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); } }