public static void LogAvailablityPricingProviderRsp(AvailabilityAndPricingResponse AvailablityPricingRsp, string SearchId)
        {
            string path = MainPath + @"\TBOLogs\" + DateTime.UtcNow.Date.ToString("dd_MM_yyyy") + @"\" + SearchId + @"\AvailablityPricingResp\";

            Directory.CreateDirectory(path);
            path = path + "AvailablityPricingRsp.txt";
            try
            {
                XmlSerializer xmlSerializer = new XmlSerializer(AvailablityPricingRsp.GetType());
                using (StreamWriter streamwriter = new StreamWriter(path, append: false))
                {
                    xmlSerializer.Serialize(streamwriter, AvailablityPricingRsp);
                    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);
            }
        }
Example #2
0
        public static AvailabilityAndPricingResponse PricingService(AvailabilityAndPricingRequest req, string SID)
        {
            var UName = ConfigurationSettings.AppSettings["TBOUserName"];
            var UPass = ConfigurationSettings.AppSettings["TBOPassword"];

            req.Credentials = new AuthenticationData()
            {
                UserName = UName,
                Password = UPass
            };

            IHotelService proxy = TBOCredentials.CreateProxy();

            ProviderLogger.LogAvailablityPricingReq(req, SID);
            AvailabilityAndPricingResponse resp = new AvailabilityAndPricingResponse();

            resp = proxy.AvailabilityAndPricing(req);
            ProviderLogger.LogAvailablityPricingProviderRsp(resp, SID);
            return(resp);
        }