示例#1
0
        internal OAirport GetOrDefault(string icao)
        {
            VatmapContext db = (VatmapContext)this.serviceProvider.GetService(typeof(VatmapContext));
            OAirport      ret;

            if (this.proxy.TryGetValue(icao, out ret) == false)
            {
                DAirport tmp = db.Airport.FirstOrDefault(q => q.Icao == icao);
                if (tmp != null)
                {
                    ret = new OAirport()
                    {
                        City    = tmp.City,
                        Country = tmp.Country,
                        ICAO    = tmp.Icao,
                        Name    = tmp.Name,
                        Gps     = new Gps()
                        {
                            Latitude = tmp.Latitude, Longitude = tmp.Longitude
                        }
                    };
                }
                else
                {
                    ret = new OAirport()
                    {
                        City    = "",
                        Country = "",
                        Name    = icao,
                        ICAO    = icao,
                        Gps     = null
                    };
                }
                this.proxy[ret.ICAO] = ret;
            }
            return(ret);
        }
示例#2
0
            internal DAirport Get(string icao)
            {
                DAirport ret = this.db.Airport.FirstOrDefault(q => q.Icao == icao);

                return(ret);
            }