コード例 #1
0
        public override async Task ListFlights(FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context)
        {
            var flightInfos = _flightStore.Flights.Select(x => x.Value.GetFlightInfo()).ToList();

            foreach (var flightInfo in flightInfos)
            {
                await responseStream.WriteAsync(flightInfo);
            }
        }
コード例 #2
0
 public override async Task ListFlights(
     FlightCriteria request,
     IAsyncStreamWriter <FlightInfo> responseStream,
     ServerCallContext context
     )
 {
     foreach (var flight in _flightData.Flights.Values)
     {
         await responseStream.WriteAsync(flight);
     }
 }
コード例 #3
0
ファイル: FlightClient.cs プロジェクト: TheVinhLuong102/arrow
        public AsyncServerStreamingCall <FlightInfo> ListFlights(FlightCriteria criteria = null, Metadata headers = null)
        {
            if (criteria == null)
            {
                criteria = FlightCriteria.Empty;
            }

            var response      = _client.ListFlights(criteria.ToProtocol(), headers);
            var convertStream = new StreamReader <Protocol.FlightInfo, FlightInfo>(response.ResponseStream, inFlight => new FlightInfo(inFlight));

            return(new AsyncServerStreamingCall <FlightInfo>(convertStream, response.ResponseHeadersAsync, response.GetStatus, response.GetTrailers, response.Dispose));
        }
コード例 #4
0
        public override async Task ListFlights(FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context)
        {
            var tables = _koraliumTransportService.GetTables();

            var httpContext = context.GetHttpContext();

            foreach (var table in tables)
            {
                var selectAllSql = table.SelectAllColumnsStatement();
                await responseStream.WriteAsync(GetFlightInfo(selectAllSql, context));
            }
        }
コード例 #5
0
        private async Task <BrandedFareInfo> GetFareBrandInfo(FlightCriteria criteria, string token, int criteriaIndex)
        {
            BrandedFareInfo response = null;

            try
            {
                string origin = criteria.Origin.Trim();
                string dest   = criteria.Destination.Trim();
                string url    = string.Format("{0}/{1}/{2}/{3}/{4}", ConfigurationManager.AppSettings["BrandedFareServiceUrl"], origin, dest, Constants.AirportCountryCodes[origin], Constants.AirportCountryCodes[dest]);
                response = await _httpClentService.GetAsync <BrandedFareInfo>(url, token);

                response.SegmentId = criteriaIndex;
            }
            catch (Exception ex)
            {
                string json = File.ReadAllText(@"D:\Sreekanth\Work\POCs\Ethihad Web\Temp\AUH_BAH BrandedFares.json");
                response           = Newtonsoft.Json.JsonConvert.DeserializeObject <BrandedFareInfo>(json);
                response.SegmentId = criteriaIndex;
            }
            return(response);
        }
コード例 #6
0
ファイル: FlightServer.cs プロジェクト: TheVinhLuong102/arrow
 public virtual Task ListFlights(FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context)
 {
     throw new NotImplementedException();
 }