Ejemplo n.º 1
0
 public SearchFlightRequestsRS SearchFlightRequests(string sessionId, string requestType)
 {
     SearchFlightRequestsRS response = new SearchFlightRequestsRS() { IsSuccess = true };
     using (new ApplicationContextScope(new ApplicationContext()))
     {
         ApplicationContext.SetSessionId(sessionId);
         try
         {
             IRequestProvider requestProvider = RequestProviderFactory.GetRequestProvider();
             List<Model.FlightRequest> requests = requestProvider.GetFlightRequests(requestType);
             response.Requests = requests.Select(request => request.ToDataContract()).ToList();
         }
         catch (Exception exception)
         {
             response.IsSuccess = false;
             response.ErrorMessage = exception.Message;
             Logger.LogException(exception, Source, "GetSalesSummary", Severity.Critical);
         }
     }
     return response;
 }
Ejemplo n.º 2
0
        public SearchFlightRequestsRS SearchFlightRequests(string sessionId, string requestType)
        {
            SearchFlightRequestsRS response = new SearchFlightRequestsRS() {IsSuccess = true};
            using (new ApplicationContextScope(new ApplicationContext()))
            {
                ApplicationContext.SetSessionId(sessionId);
                try
                {
                    var channelFactory =
                        new WebChannelFactory<IAirlinesAdminServiceRest>(
                            Configuration.AirlinesAdminServiceConfigurationName);
                    IAirlinesAdminServiceRest channel = channelFactory.CreateChannel();

                    if (channel is IContextChannel)
                        using (new OperationContextScope(channel as IContextChannel))
                        {
                            WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "SearchFlightRequests");
                            response = channel.SearchFlightRequests(sessionId, requestType);
                            return response;
                        }
                }
                catch (Exception exception)
                {
                    response.IsSuccess = false;
                    response.ErrorMessage = exception.Message;
                    Logger.LogException(exception, Source, "SearchFlightRequests", Severity.Major);
                }
            }
            return response;
        }