protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            //{"error":"NO_DATA unknown airline INVALID"}
            var result = HttpExecutor.AirlineInfo(args);

            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.NoData)
            {
                Errors.Add(result.Error);
            }

            if (QueryArgs.ContainsVariable("airlineCode"))
            {
                result.Data.airlineCode = (string)QueryArgs["airlineCode"].PropertyValue.Value;
            }

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(AirlineInfo));

            var rows = new List <Row>();

            if (result.Error == null)
            {
                rows.Add(new Row()
                {
                    Values = ToValues(result.Data, tableDescriptor)
                });
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            var result = HttpExecutor.AirlineFlightSchedule(args);

            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.NoData)
            {
                Errors.Add(result.Error);
            }

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(AirlineFlightSchedule));

            var rows = new List <Row>();

            if (result.Data != null && result.Error == null)
            {
                foreach (var d in result.Data)
                {
                    var row = new Row()
                    {
                        Values = ToValues(d, tableDescriptor)
                    };
                    rows.Add(row);
                }
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
示例#3
0
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            var result = HttpExecutor.GetInFlightInfo(args);

            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.NoData)
            {
                Errors.Add(result.Error);
            }

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(InFlightInfo));

            var dto  = result.Data;
            var rows = new List <Row>();

            if (result.Error == null)
            {
                rows.Add(new Row()
                {
                    Values = ToValues(dto, tableDescriptor)
                });
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            var result = HttpExecutor.AirportInfo(args);

            if (result.Error != null)
            {
                Errors.Add(result.Error);
            }

            if (QueryArgs.ContainsVariable("airportCode"))
            {
                result.Data.airportCode = (string)QueryArgs["airportCode"].PropertyValue.Value;
            }

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(AirportInfo));

            var rows = new List <Row>();

            if (result.Error == null)
            {
                rows.Add(new Row()
                {
                    Values = ToValues(result.Data, tableDescriptor)
                });
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            var result = HttpExecutor.GetMapFlight(args);

            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.NoData)
            {
                Errors.Add(result.Error);
            }

            var dto = result.Data;

            if (QueryArgs.ContainsVariable("ident"))
            {
                dto.ident = (string)QueryArgs["ident"].PropertyValue.Value;
            }

            long mapHeight = 480;

            if (QueryArgs.ContainsVariable("mapHeight"))
            {
                mapHeight = (long)QueryArgs["mapHeight"].PropertyValue.Value;
            }

            long mapWidth = 640;

            if (QueryArgs.ContainsVariable("mapWidth"))
            {
                mapWidth = (long)QueryArgs["mapWidth"].PropertyValue.Value;
            }

            dto.mapHeight = mapHeight;
            dto.mapWidth  = mapWidth;

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(MapFlight));

            var rows = new List <Row>();

            if (result.Error == null)
            {
                rows.Add(new Row()
                {
                    Values = ToValues(dto, tableDescriptor)
                });
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            var result = HttpExecutor.GetFlightID(args);

            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.NoData)
            {
                Errors.Add(result.Error);
            }

            long departerTimeValue = 0;

            if (QueryArgs.ContainsVariable("departuretime"))
            {
                departerTimeValue = (long)(QueryArgs["departuretime"].PropertyValue.Value ?? 0L);
            }

            string identValue = string.Empty;

            if (QueryArgs.ContainsVariable("ident"))
            {
                identValue = (string)QueryArgs["ident"].PropertyValue.Value;
            }

            var dto = result.Data;

            dto.departureTime = (DateTime)Conversion.ConvertLongToDateTime(departerTimeValue);
            dto.ident         = identValue;

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(GetFlightId));

            var rows = new List <Row>();

            if (result.Error == null)
            {
                rows.Add(new Row()
                {
                    Values = ToValues(dto, tableDescriptor)
                });
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            var result = HttpExecutor.GetInboundFlightInfo(args);

            //{ "error":"INVALID_ARGUMENT Inbound flight is not known"}
            //{ "error":"INVALID_ARGUMENT: invalid {faFlightID}"}
            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.InvalidArgument) //don't show invalid args as errors
            {
                Errors.Add(result.Error);
            }

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(InboundFlightInfo));

            var dto = result.Data;

            dto.ifaFlightID = dto.faFlightID;

            string faFlightID = string.Empty;

            if (QueryArgs.ContainsVariable("faFlightID"))
            {
                faFlightID = (string)QueryArgs["faFlightID"].PropertyValue.Value;
            }

            dto.faFlightID = faFlightID;

            var rows = new List <Row>();

            if (result.Error == null)
            {
                rows.Add(new Row()
                {
                    Values = ToValues(dto, tableDescriptor)
                });
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            var result = HttpExecutor.GetDeparted(args);

            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.NoData)
            {
                Errors.Add(result.Error);
            }

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(Departed));

            var rows = new List <Row>();

            if (result.Data != null && result.Error == null)
            {
                foreach (var d in result.Data)
                {
                    if (QueryArgs.ContainsVariable("airport"))
                    {
                        d.airport = (string)QueryArgs["airport"].PropertyValue.Value;
                    }

                    if (QueryArgs.ContainsVariable("filter"))
                    {
                        d.filter = (string)QueryArgs["filter"].PropertyValue.Value;
                    }

                    var row = new Row()
                    {
                        Values = ToValues(d, tableDescriptor)
                    };
                    rows.Add(row);
                }
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }
示例#9
0
        protected override ExecutedTable ExecuteCore(HttpExecuteArg args)
        {
            //{ "error":"INVALID: invalid {faFlightID}"}
            var result = HttpExecutor.GetHistoricalTrack(args);

            if (result.Error != null && result.Error.Type != ApiExecuteErrorType.NoData)
            {
                Errors.Add(result.Error);
            }

            TableDescriptor tableDescriptor = PropertyDescriptor.GenerateRunDescriptor(typeof(GetHistoricalTrack));

            var rows = new List <Row>();

            if (result.Data != null && result.Error == null)
            {
                foreach (var d in result.Data)
                {
                    if (QueryArgs.ContainsVariable("faFlightID"))
                    {
                        d.faFlightID = (string)QueryArgs["faFlightID"].PropertyValue.Value;
                    }

                    var row = new Row()
                    {
                        Values = ToValues(d, tableDescriptor)
                    };
                    rows.Add(row);
                }
            }

            return(new ExecutedTable(tableDescriptor)
            {
                Rows = rows.ToArray()
            });
        }